To find solutions to the problem that the tuberculosis detectors based on the traditional machine learning method arepoor generalization ability and low detection accuracy, this paper proposed a deep learning method based on focal loss to detect tuberculosis lesions called Tuberculosis Neural Net (TBNN), which makes full use of pneumonia and tuberculosis as respiratory diseases and has similar characteristics on chest X ray. During model training, the feature extraction sub network is pretrained based on transfer learning to reduce the impact of insufficient tuberculosis chest X ray samples. Firstly, the feature extraction network was trained on a large open pneumonia dataset to obtain the rich deep image semantic features. Secondly fine tune the model parameters with the tuberculosis dataset and then outputs were used as inputs to the TBNN classification sub network to calculate tuberculosis lesion detection results. The experimental results show that TBNN is superior to the traditional machine learning methods in classification accuracy and performance. Compared with other deep learning detectors in classification accuracy, TBNN is better, and its ability to locate lesion area has reached the level of human radiologists.