## 4 Methodology
### Mobile-Based Framework for Cervical Cytology Screening: Pipeline Overview  
Figure 4 depicts the general pipeline of the mobile-based solution for automated cervical cytology screening, in which the nucleus-based cervical lesion detection module proposed in this work can be integrated. The proposed pipeline starts with a pre-processing module to ensure that the input images meet the demands presented by the detection models in terms of input standardization and computational limitations, which includes the following image processing steps: (i) optical disk segmentation (according to the approach proposed in [24]); (ii) cropping the region of interest in accordance with the optic disk segmentation mask; and (iii) patch slicing (320 \(\times\) 320 pixels) with adjustable patch overlap percentage. As shown in Figure 4, the pipeline can comprise different object detection and classification modules that can be coupled together in the same framework to serve different purposes; e.g., the nucleus-based model previously proposed can be used for automated adequacy assessment of cytological samples [5], while the nucleus-based deep learning approach proposed in this work can be used to detect cervical lesions in images of LBC samples digitalized with the portable microscope uSmartScope [28]. Since this device uses an objective magnification of 40\(\times\), several images of different microscopic fields must be acquired for each slide to cover a representative sample area. Finally, the pipeline also includes a post-processing module responsible for the harmonization of the model's outputs, namely to merge the patches of each microscopic field into a single image, which allows defining the following parameters: (i) NMS threshold and (ii) score threshold for each detected class.  
\begin{table}
\begin{tabular}{c c c c c c} \hline  & **ASC-US** & **LSIL** & **ASC-H** & **HSIL-SCC** & **Normal** \\ \hline \multirow{3}{*}{Train} & Annotations & 596 & 82 & 101 & 315 & 897 \\ \cline{2-6}  & Patches with annotations & & & 669 & & \\ \cline{2-6}  & Empty patches & & & 1165 & & \\ \hline \multirow{3}{*}{Test} & Annotations & 169 & 61 & 31 & 35 & 12,739 \\ \cline{2-6}  & Patches with annotations & & & 182 & & \\ \cline{2-6}  & Empty patches & & & 19,886 & & \\ \hline \end{tabular}
\end{table}
Table 2: Distribution of nucleus annotations per TBS class for the training and test sets of the Nucleus-Based Cervical Lesion Dataset (after patch slicing).  
As shown in Figure 4, the pre-processing module is responsible for slicing the images into patches of fixed dimensions, with the possibility of overlap. Patches are then fed to the object detection model, and outputs are collected. Since each patch will pass individually through the model, the outputs (bounding boxes and respective classifications) will be in reference to the patch. Therefore, to obtain the compiled results for each microscopic field, they must be transferred to a global reference by combining into a single image the outputs of the associated patches. For scenarios with overlapped patches, the detected objects with two or more overlapped predictions are handled using a non-maximum suppression (NMS) algorithm to eliminate the duplicates. In the end, the image-level information of all images that belong to the same slide is then aggregated to provide an overall report regarding the detected cervical lesions for each sample.