Lightweight CNN Architecture for Gram-Stained Bacterial Image Classification
Keywords:
Lightweight CNN, Gram-stained bacterial classification, floating-point operationsAbstract
Accurate classification of Gram-stained bacterial images is essential for timely clinical decision-making. Traditional image analysis methods rely on handcrafted features and machine learning classifiers, which are often limited in robustness and scalability. Deep learning, particularly convolutional neural networks has improved accuracy in biomedical imaging but existing architectures such as ResNet, DenseNet, and VGG are computationally demanding, with tens of millions of parameters and billions of floating-point operations. This complexity restricts their use in laboratories with limited resources and in real-time applications. This study introduces a lightweight CNN tailored for Gram-stained bacterial classification. The model integrates a compact stem, three depthwise-separable convolutional blocks, and a global average pooling layer, reducing parameters and FLOPs while maintaining strong feature extraction capability. An optional attention module was assessed in ablation experiments to evaluate its contribution. Experiments were conducted on six bacterial species and results were compared with six deep learning baselines, including ResNet-18, MobileNetV2, VGG16, DenseNet-121, InceptionV3, and EfficientNet-B0. The proposed CNN achieved an average accuracy of 96.8%, with precision, recall, and F1-score consistently above 96%, while requiring fewer than 1.2 million parameters and approximately 0.3 GFLOPs. These findings confirm the practicality of the proposed model for edge computing, embedded devices, and microbiological diagnostics.




