Related Experiment Video
Updated: Jul 29, 2025

04:23
A Swin Transformer-Based Model for Thyroid Nodule Detection in Ultrasound Images
Published on: April 21, 2023
1.9K
Lightweight Visual Transformers Outperform Convolutional Neural Networks for Gram-Stained Image Classification: An
Hee E Kim1, Mate E Maros1, Thomas Miethke2
1Department of Biomedical Informatics at the Center for Preventive Medicine and Digital Health (CPD), Medical Faculty Mannheim, Heidelberg University, Theodor-Kutzer-Ufer 1-3, 68167 Mannheim, Germany.
Biomedicines
|May 27, 2023
Summary
Visual transformers (VT) automate Gram-stain analysis for faster bacterial detection. VTs outperformed convolutional neural networks (CNNs) in most settings, offering a promising approach for infection diagnosis.
Area of Science:
- Medical diagnostics
- Computational pathology
- Machine learning in healthcare
Background:
- Bacterial infections require rapid identification for effective treatment.
- Gram-stain analysis is a fundamental but time-consuming diagnostic technique.
- Automating Gram-stain analysis can significantly improve diagnostic workflows.
Purpose of the Study:
- To automate Gram-stain analysis using visual transformers (VT).
- To compare the performance of various VT configurations against convolutional neural networks (CNNs).
- To evaluate efficiency in terms of accuracy, inference time, and model size.
Main Methods:
- Comparative analysis of six VT models (BEiT, DeiT, MobileViT, PoolFormer, Swin, ViT) and two CNNs (ResNet, ConvNeXT).
- Evaluation across different configurations: model size (small vs. large), training epochs (1 vs. 100), and quantization (float32, int8).
- Testing on combined datasets: publicly available (DIBaS, n=660) and local (n=8500).
Main Results:
- Visual transformers (VTs) consistently outperformed CNNs in Gram-stain classification.
- Smaller VT models achieved 1-2x faster inference speeds (FPS) than larger counterparts.
- The DeiT small model in int8 configuration demonstrated the highest speed (6.0 FPS).
Conclusions:
- VTs offer a superior alternative to CNNs for automated Gram-stain analysis.
- Optimized VT configurations can achieve high accuracy and rapid inference times.
- This automation accelerates bacterial strain detection, aiding in timely infection management.

