## 1 Introduction  
According to a report from the World Health Organization, 1.6 million people died from _Mycobacterium tuberculosis_ infection in 2017 [1]. Although most mycobacterial infections occur in developing countries, they can spread easily via global transportation. The clinical patterns of mycobacterial infection in immunocompromised patients are usually nonspecific and atypical from those in healthy individuals, leading to a delayed diagnosis or misdiagnosis due to inadequate biopsy [2]. Inadequate biopsy and poor culture or smear techniques may cause a delayed diagnosis and subsequently death in patients [3]. Therefore, a correct and timely diagnostic tool is important for mycobacterial disease control. Diagnostic tools for mycobacterial infection include microscopy examination, smears, bacterial cultures, histopathological examination, and molecular technology. However, none of these tools is perfect [4]. Examination of both histopathologic and microbiologic results is necessary for an accurate diagnosis of mycobacterial infection [5]. For cutaneous mycobacteria infection, histopathology is essential for diagnosis [5,6]. Acid-fast staining has been shown to have good sensitivity and specificity for the diagnosis of mycobacterial infection [7]. However, screening for acid-fast stained bacilli is a highly laborious task for pathologists. Bacilli are easily missed in paucibacillary disease, and pathologists often must review several tissue sections for accurate diagnosis [8]. Tissue slides are examined under 400\(\times\) magnifications or even higher magnification (1000\(\times\)) with oil immersion, which is a very laborious and time-consuming task [3,9]. With advances in slide scanning technology, full digitalization of stained tissue sections in histopathology has the potential to transform clinical practice [10], where fully digitalized histopathology systems have been approved by the US Food and Drug Administration for primary diagnosis [11]. Whole-slide images contain a large amount of information and is very convenient for image processing, as pathologists can easily change image magnification and focus on regions of interest. Other advantages include the ease of interactive learning and navigation and digital images that do not bleach or break [12,13]. Whole-slide images (WSIs) can be used to perform automatic image analysis and reduce high inter- and intraobserver variability [10]. Numerous large studies have revealed that digital pathology images are not inferior to traditional glass slides for clinical diagnosis [14, 15, 16]. According to previous investigations, applying WSIs for mycobacterial infection slides is practical. The availability of WSIs has made digital pathology a very popular area of application for computer-aided diagnosis [17, 18, 19]. Conventional computer-aided diagnosis (CAD) is a well-established tool in the medical imaging field, whose procedures usually include segmentation, feature extraction, and classification [20]. CAD systems based on numerous image processing algorithms have been developed for digital pathology slides, especially to assist with laborious tasks such as detection and quantification in pattern recognition. The primary goal of implementing a CAD system is to increase sensitivity while reducing false negative rates due to fatigue of observers [16,21]. With the recent success of deep learning methods, the applications for computer-aided diagnosis in different clinical fields can be improved [10,21,22]. Previous works related to digital pathology have applied deep learning techniques to detect, segment, and classify diseases of interest from the nucleus and cell level all the way to the organ level [23]. In digital pathology, deep learning methods have been applied to whole-slide image analysis for predicting lung and prostate cancer diagnoses and the detection of breast cancer metastases [17, 18, 19].