?
A Reproducible Microscopy Acquisition Pipeline and Microscopy-Aware Attention for Classification, Detection, and Segmentation of Microorganisms
Automated microscopic image analysis is essential for quantitative microbiology, yet manual acquisition and generic recognition models struggle with morphological variability and scene artifacts. We address both ends of this pipeline. First, we present a low-cost, open-source acquisition system, based on an Arduino UNO R3 microcontroller and NEMA 17 stepper motors, that automates focusing, magnification, and illumination on microscopes from the Levenhuk MED series, including the Levenhuk MED 20T, MED 25T, MED 30T, MED 35T, and MED 40T, and applies a standardized, programmable control procedure intended to improve the reproducibility of imaging conditions. Using this system, we construct a benchmark of 100,000 microscopy images across five classes (micrococci, diplococci, streptococci, bacilli, and background), with annotations for classification, detection, and segmentation. Second, we propose Microscopy-Aware Attention (MAA), which augments standard self-attention with six learnable, biologically motivated priors capturing cell boundaries, focus quality, internal-structure contrast, spatial compactness, shape, and local density. MAA is evaluated on six classification backbones, six detection backbones, and five segmentation backbones against no-attention, Squeeze-and-Excitation, spatial-attention, and CBAM baselines. It consistently yields the best results, raising weighted F1 for classification from 0.947 to 0.975 (DINOv3), mAP50
for detection from 0.901 to 0.928 (InternImage-H), and mIoU for segmentation from 0.834 to 0.862 (SegMAN), with component-wise ablations showing task-specific contributions of each prior.