To establish an artificial intelligence (AI)-assisted diagnostic system for lung cancer via deep transfer learning. The researchers collected 519 lung pathologic slides from 2016 to 2019, covering various lung tissues, including normal tissues, adenocarcinoma, squamous cell carcinoma and small cell carcinoma, from the Beijing Chest Hospital, the Capital Medical University. The slides were digitized by scanner, and 316 slides were used as training set and 203 as the internal test set. The researchers labeled all the training slides by pathologists and establish a semantic segmentation model based on DeepLab v3 with ResNet-50 to detect lung cancers at the pixel level. To perform transfer learning, the researchers utilized the gastric cancer detection model to initialize the deep neural network parameters. The lung cancer detection convolutional neural network was further trained by fine-tuning of the labeled data. The deep learning model was tested by 203 slides in the internal test set and 1 081 slides obtained from TCIA database, named as the external test set. The model trained with transfer learning showed substantial accuracy advantage against the one trained from scratch for the internal test set [area under curve (AUC) 0.988 vs. 0.971, Kappa 0.852 vs. 0.832]. For the external test set, the transferred model achieved an AUC of 0.968 and Kappa of 0.828, indicating superior generalization ability. By studying the predictions made by the model, the researchers obtained deeper understandings of the deep learning model. The lung cancer histopathological diagnostic system achieves higher accuracy and superior generalization ability. With the development of histopathological AI, the transfer learning can effectively train diagnosis models and shorten the learning period, and improve the model performance.