Abstract
Rapid and accurate bacterial identification is essential for timely treatment of infections like sepsis. While traditional methods are reliable, they lack speed, and advanced molecular techniques often suffer from cost and complexity. The bacterial detection technology based on optical scattering system offers a rapid, label-free alternative but traditionally relies on complex lasers and analysis. Our enhanced approach utilizes RGB light emitting diodes (LEDs) as the light source. Three diffraction images of bacterial colonies from different LED colors are separately captured by a USB camera and combined using an image registration algorithm to enhance image sharpness. Our approach utilizes an object detection model, i.e., YOLOv8, for analysis achieving high-accuracy differentiation between bacterial strains. We demonstrate the effectiveness of this approach, achieving an average accuracy of 97% (mAP50 of 0.97), including accurate discrimination of closely related strains and the significant pathogen Staphylococcus aureus MRSA 1320. Our enhancement offers advantages in affordability, usability, and seamless integration into existing workflows, providing an alternative for rapid bacterial identification.
Similar content being viewed by others
Introduction
Rapid and precise bacterial identification is pivotal in modern healthcare for numerous reasons. Firstly, it dramatically enhances treatment efficacy in critical conditions such as sepsis, where every hour count1. Timely and accurate identification of the causative bacterial agent enables clinicians to promptly administer the most effective antibiotics, thereby significantly improving patient survival rates. Furthermore, the ability to identify bacteria quickly plays a vital role in combating antibiotic resistance. By reducing the need for broad-spectrum antibiotics, which are often used when the causative agent is unknown, targeted therapy based on precise bacterial identification helps preserve the efficacy of these critical drugs. This targeted approach also minimizes the risk of antibiotic misuse, a major factor in the development of antibiotic-resistant strains of bacteria2. Economically, rapid bacterial identification can lead to significant healthcare savings. By enabling quicker diagnosis and treatment, it can reduce the length of hospital stays and the associated costs3. This efficiency not only benefits patients but also helps healthcare systems manage resources more effectively. In terms of patient safety, rapid and precise identification minimizes the risk of adverse reactions associated with inappropriate antibiotic use. In summary, effective bacterial identification is a fundamental aspect of contemporary healthcare, playing a critical role in improving clinical outcomes, preventing the spread of infections, reducing healthcare costs, enhancing patient safety, and aiding the global fight against antibiotic resistance.
Various bacterial detection techniques have both specific benefits and drawbacks. Traditional culture methods are dependable but slow, often requiring several days for conclusive results4. Spectroscopic techniques such as Near-infrared (NIR) and Raman spectroscopy specify macromolecular composition of bacterial cells, such as nucleic acids, proteins, carbohydrates, and fatty acids, providing distinct absorption spectra5. However, the challenge in microbial spectroscopy lies in the fact that most microorganisms have similar chemical compositions, resulting in very similar spectra. Polymerase Chain Reaction (PCR) is utilized to detect bacterial pathogens by targeting specific DNA sequences with specific primers. Higher sensitivity is offered by PCR compared to traditional culture and staining methods6, and the process is completed within a few hours7. However, certain drawbacks are associated with PCR: its specificity may be lower, which increases the risk of false positives8. Additionally, because specific primers are necessary for identifying different microorganisms, potential pathogens must often be identified by physicians before performing selective PCR. Sequencing methods, particularly Whole Genome Sequencing (WGS), play a crucial role in providing detailed information on bacterial species, proving instrumental in identifying pathogens, detecting antimicrobial-resistant genes, and tracing bacterial outbreaks9. A key advantage of WGS over PCR is its lack of requirement for specific targeting, which means it does not need constant updates in primer development in response to bacterial mutations. Next-Generation Sequencing (NGS) has advanced this technology by enabling the simultaneous sequencing of millions of fragments in a single run, facilitating microscale reactions on a chip10. Despite these advancements, challenges persist in sample handling, sequencing, and data analysis, with potential for errors and biases11. Matrix-Assisted Laser Desorption Ionization-Time-of-Flight mass spectrometry (MALDI-TOF MS) differentiates microorganisms by their unique protein profiles, primarily ribosomal and housekeeping proteins12. It generates a Peptide Mass Fingerprint (PMF) for identification by comparing spectra with reference databases. While cost-effective and rapid, MALDI-TOF MS requires significant initial investment and ongoing maintenance. Drawbacks include difficulty in distinguishing closely related bacteria and variability in reference databases and scoring algorithms among manufacturers13. These advanced methods are not only complex but also demand specialized skills for their operation and data analysis. Furthermore, such sophisticated equipment might not be readily available in all laboratories, especially those with limited resources.
Bacterial rapid detection using optical scattering technology (BARDOT), a noninvasive and label-free system, utilized forward light scattering combined with an advanced image analysis system to differentiate distinct scattering patterns among various microorganisms14. This technique achieved 91–100% accuracy in differentiating different species. It effectively detected and identified bacterial colonies from various genera such as Escherichia, Salmonella, and Listeria. BARDOT can distinguish between bacterial micro-colonies within 6 h after plate streaking15,16. Enhancements in BARDOT's capabilities include the integration of Digital In-Line holographic microscopy (DIHM)17. This enhancement analyzed both amplitude and phase properties of bacterial colonies enabling identification of bacteria with nearly 99% accuracy. Recently, as artificial intelligence algorithms have gained popularity, they have been integrated into the holographic identification of biological cells. A label-free sensor using DIHM combined with machine learning algorithms was proposed to automatically classify erythrocytes, achieving high accuracy with a decision tree model18. This methodology is effectively used to detect abnormal erythrocytes and supports the computer-aided diagnosis of hematological diseases. A miniaturized holographic imaging system was developed for lens-free imaging of white blood cells19. This system automated data analysis and classification to ensure accuracy. Ground truth was established using reference holographic images, and features were extracted with machine learning algorithms to achieve 99% classification accuracy. An automatic label-free detection of unstained malaria-infected red blood cells using DIHM combined with machine learning algorithms was proposed20. The highest accuracy was achieved by the support vector machine (SVM) model, with healthy and malaria-infected RBCs being accurately distinguished with 97% accuracy. DIHM was also utilized for tracking the three-dimensional swimming of motile microorganisms, which enabled species identification21. Real-time analysis on single-board computers was facilitated using a common neural network, allowing for rapid localization of cells in three dimensions as they swam. With AI assistance and DIHM enables high-throughput detection and enumeration of biological cells, removing barriers like specialized knowledge and manual interpretation while enhancing accuracy and efficiency. However, this technology relies on a coherent light source that necessitates a complex optical setup, which is expensive and sensitive to optical alignment, susceptible to environmental factors such as vibrations.
To simplify the optical setup, we employ RGB light emitting diodes (LED) as a light source. Traditionally, LEDs are considered partially coherent light sources22. Their limited temporal and spatial coherence have been perceived as a disadvantage. While temporal coherence affects speckle formation, spatial coherence can be enhanced with spatial filters (e.g., pinholes). In 2017, a study revealed a linear relationship between image sharpness and spatial coherence23. This coherence can be improved by adjusting the light source size and propagation distance. It was suggested that a light source size under 300 microns achieves sharp holographic images, even with short propagation distances. Many modern LED modules, such as the SMD5050, feature individual LEDs that meet this size requirement. This makes them suitable and cost-effective light sources for obtaining bacterial colony scattering patterns. Moreover, the use of commercial LED modules eliminates the need for complicated optical setups and increases their potential applications.
In this present work, an object detection model has been also integrated for image analysis. Particularly, the You Only Look Once (YOLO) model24,25, which is renowned for both its precision and speed, is employed. YOLO's accessibility is enhanced across various platforms, from edge devices to the cloud, while maintaining computational cost-effectiveness. YOLO's success in diverse fields such as computer vision, plant science, and medical research, including the detection of blood cells, cancer, tumors, and bone fractures26,27,28,29,30,31,32,33, highlights its potential for our purposes. In addition to YOLO, RCNN and Fast RCNN were considered. RCNN and Fast RCNN are effective at detecting small objects but are slower and unsuitable for real-time detection34. RCNN involves a region proposal process followed by classification, resulting in high accuracy but increased computational time35. Fast RCNN integrates these steps for improved efficiency but still lacks real-time performance36. YOLO was chosen for its balance of speed and accuracy, essential for real-time analysis. Unlike RCNN and Fast RCNN, YOLO processes images in a single pass, providing high efficiency and suitability for dynamic environments. YOLO's real-time capabilities and streamlined workflow make it a practical choice for this research. Although deep learning models such as YOLO can provide accurate outputs, due to their inherent opacity, their decision-making processes cannot be directly interpreted by human intuition. To gain insight into the decision-making processes of the YOLOv8 models, Eigen-CAM was used to highlight the regions of an image that contributed significantly to the prediction37. A class activation map (CAM) is generated by Eigen-CAM using the first principal components (PC1) of feature maps, which capture the most significant variance in the data. The CAM visually indicates critical regions of the image for the CNN's predictions, presenting a heatmap overlay that illustrates areas of high activation within the input image. Eigen-CAM's versatility is notable, as it can be universally applied across all CNN models without requiring modifications to layers or retraining.
To demonstrate the capability of our approach in the detection and identification of both Gram-positive and Gram-negative, as well as closely related species, four bacterial strains were selected: Escherichia coli ATCC 11775, E. coli ATCC 25922, Staphylococcus aureus ATCC 25923, and S. aureus MRSA ATCC 25923. E. coli, which are Gram-negative species, are commonly used in microbiology laboratories. S. aureus, on the other hand, are Gram-positive species. MRSA (Methicillin-resistant Staphylococcus aureus) is a significant health concern. This Gram-positive bacterium is one of the primary contributors to the emergence of infections that are challenging to treat due to its innate resistance to drugs38. The complexity of MRSA treatment and its classification as a priority pathogen by the World Health Organization (WHO) is due to its resistance to β-lactams39. Although molecular diagnostics such as PCR are employed for MRSA detection, their cost and complexity limit their widespread use40.
This study introduces an enhanced bacteria detection system based on optical scattering that incorporates a simplified optical arrangement using a commercial RGB LED module, and a detection model using YOLOv8. We demonstrats for the first time that LED-generated diffraction patterns of bacterial colonies can be successfully used for bacterial identification. An image registration algorithm was employed to improve diffraction image quality. The integration of Arduino and YOLOv8 automated the analysis process, enabling the detection and identification of bacterial strains. Three YOLOv8 model sizes were evaluated to determine the optimal variant for our application. The effectiveness of this LED-YOLOv8 approach is demonstrated by accurately detecting and identifying four bacterial species: E. coli ATCC 11775, E. coli ATCC 25922, S. aureus ATCC 25923, and S. aureus MRSA 1320. Eigen-CAM was employed to gain insight into the decision-making processes of the model during prediction.
Results
Comparison of YOLOv8 model sizes
The YOLOv8 series includes models of different sizes designed to balance speed and accuracy. Larger models, such as YOLOv8m, prioritize accuracy and require more memory. On the other hand, smaller models like YOLOv8n focus on speed, offering faster processing with a smaller memory footprint. Comparison experiments were conducted to evaluate the performance of YOLOv8 models in three different sizes. YOLOv8s and YOLOv8m consistently outperformed YOLOv8n in terms of both the mAP50 and mAP50-95 metrics. Table 1 lists the performance of the YOLOv8 variants. Even though YOLOv8s and YOLOv8m boasted a considerably larger number of parameters than YOLOv8n, their mAP50 scores remained similar. The mAP50 score of 0.97 demonstrates the model's overall ability to detect and localize objects. The YOLOv8s and YOLOv8m models demonstrated similar mAP50 scores, however, slightly higher precision and recall values were observed for the YOLOv8s model. This suggests the YOLOv8s model may offer a more balanced performance. The lower precision of the YOLOv8m model indicates that while it performs well in object detection (recall), it may exhibit a higher rate of false positives (precision). Despite the increased complexity of the YOLOv8m model, no significant improvement in performance was observed.
Bacterial species detection and identification
Figure 1 shows the results from a custom trained YOLOv8s model. The images depict four distinct bacterial strains: E. coli ATCC 11775 (a–d), E. coli ATCC 25922 (e–h), S. aureus ATCC 25923 (i–l) and S. aureus MRSA 1320 (m–p). All strains were cultured under identical conditions for 24 h. E. coli and S. aureus can be easily distinguished from one another due to their distinct colony size differences. However, accurately identifying bacterial strains, particularly those with similar colony size, can be challenging through the examination of bacterial diffraction patterns. According to our results, the diffraction pattern of ATCC 11775 appeared as a bright circular ring with a dark circle (a–d). A notably rugged and jagged pattern was usually observed around the periphery of ATCC 25922 colonies compared to that of ATCC 11775 (e–g). Occasionally, a faint rugged pattern was observed (h), making it similar to ATCC 11775. For S. aureus, ATCC 25923 appeared as a small circle with a small ring inside (i–l). A pronounced radial pattern encircling the orange inner ring was displayed by S. aureus MRSA 1320 (m–p). Although some patterns remain difficult to discriminate because of the close relationship between strains, our results demonstrate that the LED-based setup, coupled with a YOLOv8 model, successfully identified bacterial strains. Furthermore, the YOLOv8s model enabled the identification of diverse bacterial colony shapes (b, e, and n) and demonstrated its capability for multiple simultaneous detections (h and o). Additionally, it allows detection without opening the cover of the culture plate, as condensation on the cover did not affect the results (a, m, n, and o).
Table 2 shows the YOLOv8s algorithm's performance for detecting and identifying species of bacterial colonies. High precision, recall, and mAP50 scores were demonstrated across all bacterial classes. Evaluation metrics remained consistent across different species, suggesting that YOLOv8s is adaptable to variations in bacterial colony appearance. High mAP50 scores (> 0.97) were observed, highlighting the model's strong ability to correctly identify and localize bacterial colonies. The slightly lower mAP50-95 score indicates a potential limitation in the model's ability to generate extremely precise bounding boxes under stricter IoU thresholds. The misclassification of ATCC11775 as ATCC25922 results in low precision for ATCC25922 at a level of 0.8.
Figure 2 illustrates the confusion matrix for our model. Diagonal values above 0.90 indicate that the model demonstrates consistently high accuracy across three bacterial species. However, it is observed that ATCC11775 is misclassified as ATCC25922 with a probability of 0.20. On the other hand, ATCC25922 is accurately classified with a probability of 0.98. The high misclassification rate of ATCC11775 as ATCC25923 suggests a potential overlap in features between these two strains. Conversely, the high classification accuracy for ATCC25922 indicates a distinct set of features that are effectively captured by the model. Figure 3 shows the precision and recall analysis at different confident thresholds. Increasing the confidence threshold improves precision, but at the cost of reduced recall for both strains. Notably, the recall of ATCC11775 declines more rapidly than that of ATCC25922, suggesting that the majority of misclassifications originate from ATCC11775.
Figure 4 demonstrates class activation maps (CAM) calculated from different target layers. The heatmaps generated by Eigen-CAM indicated the significance of diffraction patterns in identifying bacterial colonies. Because YOLOv8 is a detection model, the target layers involved in the feature extraction (a and b) and detection (c and d) can be observed. The results from Eigen-CAM confirmed that the model learns features and accurately locates bacterial colonies.
Discussion
In the present report, we present an enhanced bacteria identification technique based on LED and YOLOv8 that can detect and identify the species of bacterial colonies. Our work simplifies the measurement setup and data analysis procedures. To achieve this enhancement, a coherent light source (e.g., a laser) was replaced with LEDs, and YOLOv8 was employed for the analysis. This modified framework presented here focuses on enhancing accessibility and cost-effectiveness while maintaining a high level of accuracy. The imaging setup primarily comprises three components: an LED module, a culture plate, and a USB camera (Fig. 5a). A two-dimensional scanner and an Arduino were integrated for full automation (Fig. 5b). A Python script connects all the steps from scanning to bacterial identification using YOLOv8. This design ensures ease of operation with simple user control. Users only needed to place the culture plate on the holder and run the program.
In this work, the focus is solely on obtaining sharp diffraction patterns from bacterial colonies. Since individual LEDs in our setup were smaller than 200 microns (Fig. 6), each LED acted as a point source, providing sufficient sharpness for diffraction patterns without additional components. Using LEDs as a light source opens the door to wider applications, such as portable devices, due to the simplicity of the optical alignment. The only requirement is to align the position of the LED above the camera, eliminating concerns about misalignment. However, the diffraction pattern obtained from a single-color LED is far inferior to that from Point-Source Digital In-Line Holography (PSDIH) (Fig. 7). To address this, three images from three LED colors are captured separately and then aligned using an image registration algorithm (Fig. 8). The alignment of images captured under different LED colors contributes to the overall sharpness of the diffraction image. This improvement was demonstrated by an increase in the contrast ratio (Fig. 9). The contrast maps revealed that the red LED offered superior overall contrast, whereas the green LED provided higher contrast in the outer region of the diffraction image. The blue LED provided a lower overall contrast with less noticeable patterns around its center. Although the red LED appeared to be the best option, it is important to recognize that other factors, such as the bacterial species or culture medium, may influence the outcome. Variations in culture medium composition can influence the images acquired from different LED colors. As illustrated in Figure S1, certain culture media, such as Max Conkey, Xylose Lysine Deoxycholate, and Salmonella Shigella Agar, exhibited higher absorption of red light than other wavelengths. Consequently, the diffraction images obtained using green and blue LEDs may become more critical for successful image analysis in such environments. Although a single color LED might yield inferior results compared to PSDIH, combining all three colors produced an image with consistently good contrast. Additionally, the use of three distinct wavelengths enables both diffraction and absorption analysis of bacterial colonies. This method offers color information comparable to white light, while also providing the enhanced benefit of clear diffraction patterns. The combination of images acquired from three distinct LED sources enabled a comprehensive information extraction process. This approach negated the necessity for careful selection of specific culture media or LED colors, thereby ensuring the acquisition of maximal data. Although this study utilizes only three wavelengths, integrating additional wavelengths, such as infrared (IR) LEDs, is feasible. Different wavelengths are expected to offer varied diffraction characteristics. Moreover, incorporating additional diffraction characteristics is expected to enhance the accuracy of the detection model by increasing the number of available input channels.
This study demonstrated the potential of integrating LEDs and YOLOv8s for bacterial detection and identification (Fig. 1). An overall mAP50 of 0.97 was achieved, with the ability to differentiate closely related bacterial strains (Table 2). Importantly, this study demonstrated that MRSA can be discriminated with high accuracy (mAP50 > 0.98) within 24 h using the LED-YOLOv8s approach. Moreover, our approach not only facilitated the identification of bacterial species but also showcased its ability to detect diverse shapes and perform multiple detections simultaneously. Furthermore, the model enabled detection without requiring the culture plate cover to be opened, as it remained unaffected by condensation, thereby ensuring consistently reliable results. Additionally, the inclusion of images with potential interference in the training dataset may have played a role in achieving this advantage. At low confidence threshold of 0.25, the misclassification of E. coli ATCC11775 as ATCC25922 indicated an overlap in features between these two strains (Fig. 2). The misclassification can be attributed to the notably rugged and jagged pattern observed around the periphery of ATCC 25922 colonies. When these patterns are faint, they can resemble those of ATCC 11775. Since both E. coli strains ATCC 11775 and ATCC 25922 belong to the same species, their genomes exhibit high similarity41,42. The primary difference between them lies in the specific antigen type on their cell surfaces. Consequently, the misclassification at a low threshold can be attributed to their substantial genetic and phenotypic resemblance. Increasing the confidence threshold can reduce this misclassification, enhancing precision while reducing recall (Fig. 3).
YOLOv8 differentiates between culture media and bacteria by being trained on a diverse dataset containing labeled images of bacterial colonies and the surrounding culture media. During training, the model learns to recognize specific features and patterns associated with the bacteria, such as shape, size, texture, and diffraction patterns, while distinguishing these from the relatively uniform background of the culture media. Figure 4 displays class activation maps (CAM) from different YOLOv8 target layers, highlighting the importance of diffraction patterns in bacterial colony identification. Eigen-CAM heatmaps confirm the model's ability to learn and utilize these features effectively. YOLOv8's architecture includes layers for feature extraction (Fig. 4a, b) and detection (Fig. 4c, d).
In summary, our approach not only achieves high accuracy but also offers several additional advantages, including cost-effectiveness and user-friendliness. Importantly, it enables the detection and identification of bacteria without the need for chemical agents or opening the culture plate cover, facilitating seamless integration into current laboratory practices. Our approach prioritizes affordability and accessibility, intended for standalone use or alongside existing methods as a screening tool for preliminary diagnosis.
Conclusion
This study introduced a significantly enhanced approach for a label-free bacterial identification technique. Our development replaced the laser with LEDs and used YOLOv8 powered analysis, simplifying both the imaging setup and analysis. This enhanced method offers improved accessibility and cost-effectiveness, while maintaining high accuracy for strain-level differentiation. The LEDs and YOLOv8 integration modification successfully addressed the perceived limitations, achieving adequate sharpness of the diffraction patterns. This study demonstrated the effectiveness of LEDs and YOLOv8s integration, achieving an overall mAP50 of 0.97 and differentiating closely related bacterial strains. Importantly, S. aureus MRSA 1320, a major health threat, was accurately detected (mAP50 > 0.98) within 24 h. The advantages of this modified framework include affordability, user-friendliness, and the ability to perform detection without opening the culture plate cover. This facilitates easy integration into workflows and, combined with YOLOv8s robustness, ensures reliable performance even with potential interference.
Method
LED-based bacterial detection using optical scattering technology
A schematic of the LED-based setup is shown in Fig. 5. The setup comprises an LED module, bacteria culture plate, camera, scanner, and Arduino. We utilized a commercially available SMD5050 LED module (Fig. 6a), consisting of individual LEDs smaller than 200 microns in size (Fig. 6b) to ensure optimal spatial coherence. The commercial SMD5050 LED module offers three distinct wavelength ranges, peaking at 635 nm (red), 532 nm (green), and 475 nm (blue), with a full-width half maximum of 20 nm (Fig. 6c). This design allows each LED to function as a point source, resulting in clear diffraction patterns. The LED module was positioned 5 cm above a bacterial culture plate. A standard USB camera below the plate was used for image acquisition, with the sample-to-sensor distance fixed at 2 mm. A two-dimensional scanner was connected to the bacterial plate holder. Both the scanner and LED module were controlled by an Arduino, while a Python script automated the entire process. This setup enabled efficient scanning of a 10 × 10 cm2 culture plate area in less than 3 min. During the scan, each LED and the camera were triggered sequentially to capture three images per area. The captured images will be sent to a PC for image registration, before being sent to YOLOv8 for bacterial detection.
Image registration
The comparison in Fig. 7 demonstrates the differences in optical diffraction image quality between Point-Source Digital In-Line Holography (PSDIH) (Fig. 7a) and an LED-based setup (Fig. 7b), respectively. It is clear from the comparison that PSDIH produces images with superior contrast and brightness compared to LED-based setup. Although a single-color LED yielded lower initial contrast than PSDIH, image registration techniques can be used to improve overall contrast by combining images from multiple LEDs. Owing to the circuit configuration of the red, green, and blue LEDs within the SMD 5050 module, the diffraction patterns generated by these LEDs exhibited spatial shifts. To combine images from these LED sources, an image registration algorithm based on cross-correlation analysis was employed to align the images, ensuring the spatial overlap of corresponding features. First, a centrally cropped 1050 × 1050-pixel square region was extracted from one image as a reference. Next, the remaining two images were systematically shifted across the reference while calculating the cross-correlation values. This generated a correlation map for each image pair (Fig. 8a). The maximum correlation value within each map reveals the optimal pixel shift for precise alignment. Lastly, the remaining two images were shifted to the optimal position and cropped to the same size. Following the alignment, the three images were merged into a single image using the standard RGB color format (Fig. 8b), combining the information captured under all three LED wavelengths. Note that the bacterial colony of E. coli in Figs. 7 and 8 was cultured for 48 h. It serves as a suitable comparison for the diffraction characteristics obtained from different setups.
To assess image quality and sharpness, the contrast ratio (R) was employed. R is defined as:
where \({I}_{max}\) is the maximum intensity and \({I}_{min}\) is the minimum intensity. \(R\) serves as a quantitative measure of the image contrast. The image was subdivided into smaller compartments (10 × 10 pixels), and the contrast ratio was calculated for each compartment. These values were then visualized as a contrast map (Fig. 9).
Yolov8 model architecture
The YOLOv8 object detection architecture was designed for efficiency and adaptability. The standard structures of the backbone, neck, and head are presented (Fig. 10), with design choices within each component ensuring performance and versatility.
Model architecture of YOLOv8. It is composed of (a) a backbone for initial feature extraction, (b) a neck for feature fusion, and (c) a head for object classification and bounding box regression. Enhancing its functionality are four specialized modules: (d) SPPF for efficient feature pooling, (e) C2f. for streamlined feature extraction, (f) Bottleneck module, and (g) ConvModele for effective information processing. This schematic was adapted from51.
Backbone: A CrossStage Partial (CSP) design43 forms the backbone of YOLOv8, balancing the extraction of complex features with computational efficiency. Feature representation was further enriched by the inclusion of the C2f. module from the YOLOv8 network44. To reduce the processing overhead, block counts were strategically decreased compared to YOLOv5 Inference speed is prioritized with the inclusion of the Spatial Pyramid Pooling—Fast (SPPF) module in the final stage.
Neck: YOLOv8 employs a Feature Pyramid Network (FPN)45 and Path Aggregation Network (PAN)46 for the robust detection of objects across multiple scales. This component merges features extracted at different network depths, where the upper layers possess stronger semantic information, and the lower layers retain finer spatial details. Upsampling processes within the neck were optimized for computational efficiency.
Head: A decoupled head design was used in YOLOv847, separating the tasks of object classification and bounding box regression. Binary cross-entropy loss (BCE Loss) was used for classification33, while Distribution Focal Loss (DFL)48 and Complete IoU (CIoU)49 were employed for bounding box regression. This approach offers potential benefits in terms of flexibility and training dynamics. Furthermore, an anchor-free detection strategy50 was adopted, which simplified the process and improved its overall efficiency.
Dataset
Bacterial colonies were prepared using the pour plate method with four bacterial species (E. coli ATCC 11775, E. coli ATCC 25922, S. aureus ATCC 25923, and S. aureus MRSA 1320). The bacteria were obtained from stock plates and diluted to 10–5 dilution in normal saline and Luria–Bertani (LB) agar at ratio 1:10. 10 ml of the diluted bacteria were then poured into plates and cultured at 37 °C for 24 h. Following incubation, the growth patterns of E. coli and S. aureus were distinct. E. coli predominantly formed large colonies (10–25 colonies per plate), with an average of 20 colonies per plate. The average colony size of E. coli was ~ 2.2 mm (ranging from 1.5 to 3 mm). Conversely, S. aureus produced small colonies (40–90 colonies per plate), with an average of 20 colonies per plate. The average colony size of S. aureus was ~ 1.1 mm (ranging from 0.6 to 1.7 mm). Optical diffraction images of the bacterial colonies were acquired using an LED-based setup and were subsequently aligned using the process described in the previous section. Bounding box annotations for the four classes were manually created using cvat.ai and exported in the YOLO format. The dataset was then randomly divided into the training and validation sets. The random split resulted in a training set of 4402 images (1079 instances), validation set of 2006 images (620 instances), and testing set of 1949 images (653 instances).
Model training
We selected the lightweight YOLOv8n model (3.01 million parameters) and employed transfer learning with pre-trained YOLOv8n weights on a similar dataset for improved performance. The training was conducted in a robust environment using Ultralytics 8.0.198, Python 3.11.5, PyTorch 2.1.0, Pytorch-CUDA 12.1, and CUDA-Toolkit 11.8.0, supported by an NVIDIA GeForce RTX 4060 Ti 16GB GPU. The model was trained using the Stochastic Gradient Descent (SGD) optimizer with an initial learning rate of 0.01 and momentum of 0.9. These parameters were chosen based on the default training settings provided by the YOLOv8 framework, and we did not modify these parameters.
Evaluation metrices
This section described essential tools for evaluating model performance: precision, recall, intersection over union (IoU), and mean average precision at IoU of 0.5 (mAP50).
Intersection over union (IoU): This metric measures the overlap between the model's predicted bounding box and the ground truth (correct) bounding box. Higher IoU values indicate better localization accuracy. It is calculated as:
Precision: Precision indicates the proportion of correct positive predictions out of all positive predictions made by the model. A high precision means the model that accurately identifies positive labels with minimal errors.
Recall: The metric evaluates the model's effectiveness in identifying all positive cases. A high recall indicates that the model hardly missed any of the positives in the dataset.
mAP50: The mean average precision at IoU of 0.5 (mAP50) is critical for assessing the performance of object detection models in computer vision. The mAP50 was calculated as the mean of average precision values for each class at an IoU of 0.5. The formula is:
where N denotes the total number of classes. The mAP50 captures the model's precision-recall performance across multiple classes, considering variations in precision at the specified confidence level. A higher mAP50 score indicates a model's ability to accurately identify objects while balancing precision and recall trade-offs, making it a valuable metric for evaluating object detection algorithms in real-world scenarios.
The confusion matrix: The confusion matrix is a valuable tool for evaluating the performance of classification models, including object detection algorithms. It provided a clear breakdown of a model's correct and incorrect predictions. The rows in the matrix represent the true object categories, whereas the columns represent the categories predicted by the model. The number of instances for each type of bacteria indicates the frequency at which the model made a specific type of correct or incorrect classification.
Data availability
Data supporting the findings of this study are available within the paper and its Supplementary Information file. Datasets used for model training are available from the corresponding author upon reasonable request.
References
Kumar, A. et al. Duration of hypotension before initiation of effective antimicrobial therapy is the critical determinant of survival in human septic shock. Crit. Care Med. 34, 1589–1596. https://doi.org/10.1097/01.Ccm.0000217961.75225.E9 (2006).
Malik, B. & Bhattacharyya, S. Antibiotic drug-resistance as a complex system driven by socio-economic growth and antibiotic misuse. Sci. Rep. 9, 9788. https://doi.org/10.1038/s41598-019-46078-y (2019).
Shrestha, P. et al. Enumerating the economic cost of antimicrobial resistance per antibiotic consumed to inform the evaluation of interventions affecting their use. Antimicrob. Resist. Infect. Control 7, 98. https://doi.org/10.1186/s13756-018-0384-3 (2018).
Xihong, Z., Chii-Wann, L. & Jun, W. Advances in rapid detection methods for foodborne pathogens. J. Microbiol. Biotechnol. 24, 297–312. https://doi.org/10.4014/jmb.1310.10013 (2014).
Harz, M., Rösch, P. & Popp, J. Vibrational spectroscopy—A powerful tool for the rapid identification of microbial cells at the single-cell level. Cytom. Part A 75A, 104–113. https://doi.org/10.1002/cyto.a.20682 (2009).
Waters, D. L. & Shapter, F. M. in Cereal Genomics: Methods and Protocols, 65–75 (2014).
Abu-Eleinen, K. G. et al. Polymerase chain reaction-guided diagnosis of infective keratitis—A hospital based study. Curr. Eye Res. 37, 1005–1011 (2012).
Walker, B., Powers-Fletcher, M. V., Schmidt, R. L. & Hanson, K. E. Cost-effectiveness analysis of multiplex PCR with magnetic resonance detection versus empiric or blood culture-directed therapy for management of suspected candidemia. J. Clin. Microbiol. 54, 718–726 (2016).
Hasman, H. et al. Rapid whole-genome sequencing for detection and characterization of microorganisms directly from clinical samples. J. Clin. Microbiol. 52, 139–146. https://doi.org/10.1128/jcm.02452-13 (2014).
Ronholm, J. Editorial: Game changer—Next generation sequencing and its impact on food microbiology. Front. Microbiol. https://doi.org/10.3389/fmicb.2018.00363 (2018).
den Besten, H. M. W. et al. Next generation of microbiological risk assessment: Potential of omics data for exposure assessment. Int. J. Food Microbiol. 287, 18–27. https://doi.org/10.1016/j.ijfoodmicro.2017.10.006 (2018).
Cheng, K., Chui, H., Domish, L., Hernandez, D. & Wang, G. Recent development of mass spectrometry and proteomics applications in identification and typing of bacteria. Proteomics Clin. Appl. 10, 346–357. https://doi.org/10.1002/prca.201500086 (2016).
Ferone, M., Gowen, A., Fanning, S. & Scannell, A. G. M. Microbial detection and identification methods: Bench top assays to omics approaches. Compr. Rev. Food Sci. Food Saf. 19, 3106–3129. https://doi.org/10.1111/1541-4337.12618 (2020).
Banada, P. P. et al. Optical forward-scattering for detection of Listeria monocytogenes and other Listeria species. Biosens. Bioelectron. 22, 1664–1671. https://doi.org/10.1016/j.bios.2006.07.028 (2007).
Banada, P. P. et al. Label-free detection of multiple bacterial pathogens using light-scattering sensor. Biosens. Bioelectron. 24, 1685–1692. https://doi.org/10.1016/j.bios.2008.08.053 (2009).
Marcoux, P. R. et al. Optical forward-scattering for identification of bacteria within microcolonies. Appl. Microbiol. Biotechnol. 98, 2243–2254. https://doi.org/10.1007/s00253-013-5495-4 (2014).
Buzalewicz, I., Kujawińska, M., Krauze, W. & Podbielska, H. Novel perspectives on the characterization of species-dependent optical signatures of bacterial colonies by digital holography. PLOS ONE 11, e0150449. https://doi.org/10.1371/journal.pone.0150449 (2016).
Go, T., Byeon, H. & Lee, S. J. Label-free sensor for automatic identification of erythrocytes using digital in-line holographic microscopy and machine learning. Biosens. Bioelectron. 103, 12–18. https://doi.org/10.1016/j.bios.2017.12.020 (2018).
Li, Y. et al. Accurate label-free 3-part leukocyte recognition with single cell lens-free imaging flow cytometry. Comput. Biol. Med. 96, 147–156. https://doi.org/10.1016/j.compbiomed.2018.03.008 (2018).
Go, T., Kim, J. H., Byeon, H. & Lee, S. J. Machine learning-based in-line holographic sensing of unstained malaria-infected red blood cells. J. Biophotonics 11, e201800101. https://doi.org/10.1002/jbio.201800101 (2018).
Matthews, S. A. et al. Real-time 3D tracking of swimming microbes using digital holographic microscopy and deep learning. PLOS ONE 19, e0301182. https://doi.org/10.1371/journal.pone.0301182 (2024).
Mehta, D. S., Saxena, K., Dubey, S. K. & Shakher, C. Coherence characteristics of light-emitting diodes. J. Lumin. 130, 96–102. https://doi.org/10.1016/j.jlumin.2009.07.027 (2010).
Deng, Y. & Chu, D. Coherence properties of different light sources and their effect on the image sharpness and speckle of holographic displays. Sci. Rep. 7, 5893. https://doi.org/10.1038/s41598-017-06215-x (2017).
Glenn Jocher, A. C., Qiu Jing. Ultralytics YOLO, https://ultralytics.com (2023).
Terven, J. & Cordova-Esparza, D. A comprehensive review of YOLO: From YOLOv1 and Beyond. arXiv:2304.00501 (2023).
Yang, S., Wang, W., Gao, S. & Deng, Z. Strawberry ripeness detection based on YOLOv8 algorithm fused with LW-Swin transformer. Comput. Electron. Agric. 215, 108360. https://doi.org/10.1016/j.compag.2023.108360 (2023).
Wang, G. et al. UAV-YOLOv8: A small-object-detection model based on improved YOLOv8 for UAV aerial photography scenarios. Sensors 23, 7190 (2023).
Orchi, H., Sadik, M., Khaldoun, M. & Sabir, E. in International Wireless Communications and Mobile Computing (IWCMC) 1690–1696 (2023).
Wu, Y. et al. SDE-YOLO: A novel method for blood cell detection. Biomimetics 8, 404 (2023).
Inui, A. et al. Detection of elbow OCD in the ultrasound image by artificial intelligence using YOLOv8. Appl. Sci. 13, 7623 (2023).
Selcuk, B. & Serif, T. in 8th International Conference on Computer Science and Engineering (UBMK) 477–481 (2023).
Sahoo, P. K. et al. Localization of colorectal cancer lesions in contrast-computed tomography images via a deep learning approach. Bioengineering 10, 972 (2023).
Ju, R.-Y. & Cai, W. Fracture detection in pediatric wrist trauma X-ray images using YOLOv8 algorithm. Sci. Rep. 13, 20077. https://doi.org/10.1038/s41598-023-47460-7 (2023).
Malhotra, P. & Garg, E. in 7th International Conference on Smart Structures and Systems (ICSSS) 1–4 (2020).
Girshick, R., Donahue, J., Darrell, T. & Malik, J. in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition 580–587.
Girshick, R. in Proceedings of the IEEE International Conference on Computer Vision 1440–1448.
Muhammad, M. B. & Yeasin, M. in International Joint Conference on Neural Networks (IJCNN) 1–7 (2020).
van Belkum, A. et al. Co-evolutionary aspects of human colonisation and infection by Staphylococcus aureus. Infect. Genet. Evol. 9, 32–47. https://doi.org/10.1016/j.meegid.2008.09.012 (2009).
Monecke, S. et al. Molecular typing of ST239-MRSA-III from diverse geographic locations and the evolution of the SCCmec III element during its intercontinental spread. Front. Microbiol. https://doi.org/10.3389/fmicb.2018.01436 (2018).
Organization, W. H. in Global antimicrobial resistance surveillance system (GLASS): Molecular methods for antimicrobial resistance (AMR) diagnostics to enhance the global antimicrobial resistance surveillance system (2019).
ATCC 11775, Escherichia coli, Genome Portal, genome.atcc.org, https://genomes.atcc.org/genomes/9c4325c2692f4534
ATCC 25922, Escherichia coli, Genome Portal, genome.atcc.org, https://genomes.atcc.org/genomes/ccbc9e61ad334c2c
Wang, C.-Y. et al. in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops 390–391.
Wang, C.-Y., Bochkovskiy, A. & Liao, H.-Y. M. in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition 7464–7475.
Lin, T.-Y. et al. in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition 2117–2125.
Liu, S., Qi, L., Qin, H., Shi, J. & Jia, J. in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition 8759–8768.
Ge, Z., Liu, S., Wang, F., Li, Z. & Sun, J. Yolox: Exceeding yolo series in 2021. arXiv:2107.08430 (2021).
Li, X. et al. Generalized focal loss: Learning qualified and distributed bounding boxes for dense object detection. Adv. Neural Inf. Process. Syst. 33, 21002–21012 (2020).
Zheng, Z. et al. in Proceedings of the AAAI Conference on Artificial Intelligence 12993–13000.
Tian, Z., Shen, C., Chen, H. & He, T. FCOS: A simple and strong anchor-free object detector. IEEE Trans. Pattern Anal. Mach. Intell. 44, 1922–1933 (2020).
RangeKing. Brief summary of YOLOv8 model structure, https://github.com/ultralytics/ultralytics/issues/189 (2023).
Acknowledgements
This work was financially supported by The Office of the Permanent Secretary, Ministry of Higher Education, Science, Research, and Innovation, Thailand (Grant No. RGNS 65-146). The authors would also like to thank Buddhachinaraj Pitsanulok Hospital for their support providing bacterial culture media.
Author information
Authors and Affiliations
Contributions
T.W. and S.R. conceived and designed the experiments. N.W. and D.P. prepared bacterial samples. S.R. conducted the experiments. S.R., N.W., D.P., P.B., and T.W. discussed the results. S.R. wrote the first draft of the manuscript. All of the authors edited the manuscript and approved the final version.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary Information
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Romphosri, S., Pissuwan, D., Wattanavichean, N. et al. Rapid alignment-free bacteria identification via optical scattering with LEDs and YOLOv8. Sci Rep 14, 20498 (2024). https://doi.org/10.1038/s41598-024-71238-0
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-024-71238-0