Development of an AI Algorithm for Automatic Classification of Gram Stain Images in Microbiology
Musaji, S.; Kibsey, P.; Musaji, A.
Show abstract
This paper reflects on the development and performance of an advanced artificial intelligence (AI) algorithm for the automated processing and classification of Gram stain images obtained from actual microbiology samples used in clinical microbiology. The aim of the project was to effectively categorize non-standardized Gram stain images into the six most common categories: Gram-negative rods, Gram-positive cocci in chains, Gram-positive cocci in clusters, Gram-positive rods, Gram-negative cocci, and yeasts. The development and testing relied on 1,077 Gram stain images of varying sizes, originating from different laboratories and captured using diverse microscopes at different points in time, resulting in differences in image quality, scaling, color balance, and the presence of artifacts. The dataset was split into 80% training and 20% testing subsets, with the split performed in a stratified manner so that each object group was proportionally represented in both the training and testing sets. Preprocessing involved computer vision techniques to improve contrast and color balance, detect contours and object borders, and implement filtering mechanisms to remove unwanted artifacts. Morphological analysis of shapes was then performed to extract parameters characterizing each contour. Next, human-like classification criteria--based on gradient, morphological features (e.g., shape, size) and spatial arrangement that mimic microbiologists visual assessment--were established, achieving around 92% accuracy in image classification without using machine learning (ML) methods. However, any further improvements turned practically impossible, prompting the use of ML methods. Building on pre-obtained features, a random forest ML algorithm was employed to further refine the criteria, with three models trained and tested successively. The first model determined the Gram stain reaction (positive or negative) of each object. The second model classified objects into one of six predefined categories. The third model aggregated individual object classifications to generate an overall classification for each slide, based on the number of objects observed in each category and their occupied area. Overall, the ML solution was significantly more accurate, reaching 99.9% accuracy in classifying the images into one of the aforementioned groups. The algorithms limitations include inability to classify mixed cultures, as it primarily focuses on the dominant category. In cases where positive and negative objects coexist, the algorithm tends to prioritize Gram-positive objects. Additionally, the current morphological assessment is insufficient for yeast classification. Addressing these limitations is a crucial avenue for future research to enhance the algorithms versatility and accuracy.
Matching journals
The top 6 journals account for 50% of the predicted probability mass.