Development and Evaluation of YOLO26-Refined: A P2-FPN and CBAM-Enhanced Architecture for Detection of Gram-Stained Bacterial Cells in Microscopic Images
Dmitriy Berillo, Kainizhamal Iklassova, Rustem Tashibayev, Gulnar Kim, Vladislav Semenyuk, Ildar Kurmashev, Danila ZhirnovGram staining remains a primary diagnostic method in clinical microbiology, but manual interpretation of stained smears is time-consuming, subject to inter-operator variability, and impractical for continuous 24/7 monitoring. Automated detection offers faster turnaround, standardized classification independent of operator experience, and scalability for routine water-quality surveillance. This study evaluates seven YOLO-based architectures for four-class detection of Gram-stained bacterial cells (Gram-positive cocci, Gram-negative cocci, Gram-positive rods, Gram-negative rods) in microscopic images at 1000× magnification. Four baseline nano-scale models (YOLOv10n, YOLO11n, YOLO12n, YOLO26n) were trained and compared with three modified architectures based on YOLO26, including the proposed YOLO26-Refined, which extends the feature pyramid to the P2/4 level, applies a CBAM attention module after the P3 stage, disables shortcut connections in neck blocks, and uses reg_max = 16 for Distribution Focal Loss. All models were trained on a dataset of 5994 annotated images (69/21/10 split) using an NVIDIA RTX 4080 GPU. YOLO26-Refined achieved the best overall performance, with mAP50 = 0.934, mAP50-95 = 0.616, Precision = 0.846, and Recall = 0.888, outperforming the YOLO26n baseline (mAP50 = 0.923) by 0.011. Per-class results show the highest accuracy for Gram-negative rods (mAP50 = 0.965) and the lowest for Gram-positive rods (mAP50 = 0.890). With 2.63 million parameters, 9.9 GFLOPs, and an inference latency of approximately 1.8 ms per image on an RTX 4080 GPU (batch = 1, FP16), the model remains suitable for edge deployment, supporting its application in automated water-quality microbiological monitoring under the IRN BR28712227 research grant.