Deep Learning Classification of Urine Crystal Images using Convolutional Neural Networks - Kaewprasert, Ronnarong (Journal of Health Sciences Sukhothai hospital, 2026)
Background: Urinalysis is a fundamental component of routine clinical laboratory screening. Despite the widespread adoption of automated analyzers, manual microscopic classification of urinary sediment remains the gold standard. However, this manual process is time-consuming and susceptible to inter-observer variability among laboratory personnel. This research addresses these limitations by developing an automated classification system for urine crystals leveraging Deep Learning techniques. Objectives: The primary objective of this study is to develop a high-precision automated classification system for urine crystals using a custom Convolutional Neural Network (CNN). The secondary objective is to deploy the model as a real-time web application to minimize diagnostic errors and enhance the operational efficiency of laboratory technologists. Method: The study utilized a dataset of 4,539 images categorized into 13 distinct types of urine crystals: Acyclovir, Bilirubin, Calcium Carbonate, Leucine, Calcium Phosphate, Uric Acid, Triple Phosphate, Calcium Oxalate, Ammonium Biurate, Hippuric Acid, Tyrosine, Cystine, and Cholesterol. The dataset was partitioned into training and testing sets. Development was conducted using Python within the Google Colab environment, employing a Sequential CNN architecture with three convolutional layers. Furthermore, a web application was developed using the FastAPI framework to facilitate real-time image prediction. Results: The experimental results demonstrate that the model achieved an overall accuracy of 92% on the test dataset. Exceptional performance was observed in several classes; notably, Acyclovir, Hippuric Acid, and Leucine achieved perfect F1-scores of 1.00. Other high-performing classes included Ammonium Biurate (F1-score: 0.98) and Cystine (F1-score: 0.92). Training monitored over 10 epochs showed consistent improvement, with both training and validation accuracy exceeding 90%, while the validation loss decreased in tandem with the training loss, indicating a well-generalized model without overfitting. Conclusion: This research successfully demonstrates the effectiveness of a custom CNN model for high-precision automated urine crystal classification. Deployment via a FastAPI-based interface provides a practical and efficient tool for clinical laboratories. The system effectively reduces workload, saves time, and minimizes subjectivity in diagnosis, serving as a rapid screening tool to enhance the overall standards of urinalysis.