Title : TB-AI: Automated detection of acid-fast bacilli from Ziehl–Neelsen-stained sputum smear microscopy using EfficientNet-based computer vision and HiResCAM heatmapping
Abstract:
Background: Tuberculosis (TB) remains one of the leading infectious causes of death worldwide, with the greatest burden occurring in low- and middle-income countries. Although molecular diagnostic tests have expanded access to rapid diagnosis, Ziehl Neelsen-stained sputum smear microscopy remains the most widely used frontline diagnostic method in resource-limited settings because of its affordability and accessibility. However, manual microscopy is labor-intensive, time-consuming, and susceptible to inter-observer variability, contributing to delayed diagnosis and treatment. This study presents TB-AI, an artificial intelligence-based diagnostic platform designed to support automated tuberculosis detection from sputum smear microscopy.
Methods: TB-AI utilizes an EfficientNet-based convolutional neural network for automated detection of acid-fast bacilli (AFB) from Ziehl Neelsen-stained sputum smear microscopy images. The model was developed using 45,000 annotated microscopy images, including 30,000 pre-annotated images acquired using conventional brightfield microscopy and 15,000 high-resolution digital microscopy images obtained from collaborating clinical laboratories and publicly available datasets. Ground-truth annotations were provided by experienced microbiologists. Images were divided into training (70%), validation (15%), and testing (15%) datasets. Image augmentation techniques, including rotation, scaling, normalization, and contrast adjustment, were applied to enhance model generalization. HiResCAM heatmapping was incorporated to generate high-resolution activation maps highlighting image regions contributing to model predictions.
Results: TB-AI achieved a sensitivity of 98.5%, specificity of 97.2%, and an overall accuracy of 97.9% for automated AFB detection. HiResCAM heatmaps consistently localized image regions associated with AFB, supporting interpretation of model predictions, while EfficientNet demonstrated robust performance across heterogeneous microscopy image sources. These findings suggest that the framework can provide accurate and reliable assistance for smear microscopy interpretation.
Conclusion: TB-AI demonstrates the potential of combining EfficientNet-based computer vision with HiResCAM heatmapping to enhance tuberculosis diagnosis from Ziehl Neelsen-stained sputum smear microscopy images. By supporting standardized interpretation, reducing reliance on manual microscopy, and improving laboratory efficiency, the platform offers a scalable approach for strengthening TB diagnostic services in resource-constrained healthcare settings. Future studies will focus on prospective multicentre clinical validation and integration into routine tuberculosis laboratory workflows.
Keywords: Tuberculosis; Artificial Intelligence; EfficientNet; HiResCAM; Ziehl Neelsen Smear Microscopy; Computer Vision; Laboratory Diagnostics; Global Health

