Enterprise AI Analysis
Deep learning-based classification of nitrate and nitrite concentrations from water samples using colorimetric test strip images
Authors: Muhammad Roman · Mazhar Sher · Chamika Kuruppuarachchi · Arshid Ali · Chulwoo Pack · Azlan Zahid · Ali Mirzakhani Nafchi
Published online: 11 April 2026
Accurate monitoring of nitrate and nitrite concentrations in water is essential for sustainable agriculture, safeguarding public health, and protecting aquatic ecosystems from nutrient pollution. Traditional methods for detecting nitrate and nitrite in water samples are precise but costly, complex, and time-consuming, limiting their practicality for frequent on-site testing. This research proposes deep learning-based computer vision techniques to classify nitrate and nitrite concentrations using images of colorimetric test strips. An RGB IMX219 camera was used to acquire images of colorimetric test strips under standardized, controlled illumination conditions to ensure consistent image quality. A total of 1938 nitrate images and 1190 nitrite images were collected before augmentation. After preprocessing and training-only data augmentation, both classical machine learning baselines based on hand-crafted color and texture features and deep learning models—including a multilayer perceptron (MLP) and convolutional neural networks (AlexNet, VGG16, ResNet18, and GoogLeNet)—were trained and evaluated using an independent test set and stratified fivefold cross-validation. For nitrate classification, ResNet18 and GoogLeNet achieved near-perfect 100% test accuracy, with mean cross-validation accuracy of 99.97% ±0.04%, substantially outperforming classical baseline models based on hand-crafted color and texture features, which achieved at most 83.5% test accuracy. For nitrite classification, GoogLeNet achieved the strongest overall performance, with a test accuracy of 97.48% and a fivefold cross-validation accuracy of 95.22% ±1.17%, substantially outperforming the best classical baseline model, which achieved a maximum test accuracy of 83.19%. These results demonstrate that deep CNN-based feature learning provides a significant performance advantage over simpler methods under controlled imaging conditions, supporting the suitability of the proposed system for rapid, image-based water quality assessment and motivating future evaluation under broader real-world deployment scenarios.
Keywords: Precision agriculture · Image classification · Water quality monitoring · Deep learning
Accelerating Water Quality Monitoring with AI
This research leverages deep learning to significantly enhance the accuracy and efficiency of nitrate and nitrite detection in water, offering critical advantages for environmental and agricultural stakeholders.
Deep Analysis & Enterprise Applications
Select a topic to dive deeper, then explore the specific findings from the research, rebuilt as interactive, enterprise-focused modules.
Enterprise Process Flow
The study employed a rigorous methodology, starting with the careful collection of 1938 nitrate and 1190 nitrite images under standardized conditions. This dataset was then preprocessed, resized, and augmented to ensure robust training. Five deep learning models (MLP, AlexNet, VGG16, ResNet18, and GoogLeNet) along with classical machine learning baselines were trained and evaluated, leveraging GPU acceleration for optimized performance.
Deep Learning vs. Classical ML for Water Quality
| Feature | Deep Learning (ResNet18/GoogLeNet) | Classical ML (Logistic Regression) |
|---|---|---|
| Nitrate Classification Accuracy |
|
|
| Nitrite Classification Accuracy |
|
|
| Feature Learning |
|
|
| Generalization & Robustness |
|
|
The results unequivocally demonstrate that modern CNN architectures, particularly ResNet18 and GoogLeNet, offer substantial and consistent performance gains over classical machine learning baselines for accurate water quality assessment.
Real-World Validation: Field Sample Analysis
To assess practical applicability, the trained GoogLeNet model was tested on independent real water samples collected from field locations. These samples were concurrently analyzed by an AQ2 discrete analyzer at South Dakota State University (SDSU) to provide reference nitrate and nitrite concentrations.
The AI model's predicted concentration classes generally aligned well with the laboratory-measured values. Minor deviations were observed primarily near class boundaries, which is expected given the categorical nature of colorimetric test strip readings and inherent variability in low-concentration ranges.
This validation confirms the proposed system's capability to provide reliable categorical estimates on real water samples under standardized imaging conditions. This supports its immense potential for rapid, on-site screening applications in diverse environmental settings, paving the way for more accessible and efficient water quality monitoring.
The successful validation with field samples underscores the readiness of this AI-powered approach for practical deployment, particularly in resource-constrained environments where rapid results are critical.
Calculate Your Potential ROI
Estimate the efficiency gains and cost savings your organization could realize by automating water quality monitoring with AI.
Your AI Implementation Roadmap
A typical phased approach to integrate advanced AI solutions for water quality monitoring within your enterprise.
Phase 1: Data Acquisition & Preparation (Weeks 1-4)
Establish a controlled imaging environment, collect and label diverse test strip images, and perform initial preprocessing and augmentation to create a robust dataset.
Phase 2: Model Prototyping & Baseline Evaluation (Weeks 5-8)
Implement classical machine learning baselines and set up various deep learning architectures (e.g., ResNet18, GoogLeNet). Establish initial training and validation pipelines to benchmark performance.
Phase 3: Advanced Training & Optimization (Weeks 9-12)
Conduct hyperparameter tuning, apply regularization techniques, and perform cross-validation for robust performance assessment. Refine models to accurately capture subtle nitrate/nitrite patterns.
Phase 4: Real-World Validation & Deployment Planning (Weeks 13-16)
Test models with independent field samples to validate real-world applicability. Evaluate computational efficiency for deployment on low-power edge devices and strategize for robustness against environmental variations.
Phase 5: System Integration & Scaling (Weeks 17-20)
Integrate optimized models into edge computing systems (e.g., NVIDIA Jetson, Raspberry Pi). Develop user-friendly interfaces and establish infrastructure for continuous, scalable water quality monitoring.
Ready to Transform Your Water Quality Monitoring?
Unlock unparalleled accuracy and efficiency with advanced AI. Our experts are ready to guide you through a tailored implementation plan.