Optimal Color Space Selection for Vermicompost Nitrogen Classification: A Comparative Study Using the KNN Model

This study presents a cost-effective and accurate method for assessing nitrogen concentration in vermicompost fertilizer using a low-cost TCS3200 color sensor and a K-Nearest Neighbors (KNN) machine learning model. The objective was to evaluate the performance of four different color spaces—RGB, Lab, LCh, and CMYK—identify the most effective feature representation for a multi-class classification task based on accuracy and theoretical robustness to ambient light variations. A total of 2400 data points were collected from a standard chemical test kit and processed. A rigorous 60-fold cross-validation approach was used to determine the optimal model hyperparameters and to ensure the robustness of the findings. The results demonstrate that the model trained on the LCh color space achieved the highest classification accuracy of 0.9708 with an optimal K-value of 6, significantly outperforming Lab (0.9688), RGB (0.9625), and CMYK (0.9583). A detailed analysis of the confusion matrix revealed that the model successfully classified the ‘High’ and ‘Medium’ nitrogen levels with near-perfect accuracy, while minor misclassifications occurred between the ‘Low’ and ‘Trace’ categories (5 Low ⟶ Trace, 6 Trace ⟶ Low). The proposed system offers a practical, robust, and accessible tool for precision agriculture, enabling farmers to make informed decisions regarding fertilization, and directly supporting sustainable agriculture and responsible resource management. The findings indicate that the LCh color space is highly effective for this application, providing a viable solution for the rapid and reliable assessment of vermicompost quality. Most importantly, this inexpensive, on-site system removes the need for costly, time-consuming laboratory analyses, giving farmers and compost users the instantaneous, accurate nitrogen data they need to maximize crop yield, optimize nutrient application, and significantly reduce input costs from overfertilization.

Authors

Institutions

Publication Details

Journal
Applied Sciences
Published
2025-10-29
DOI
https://doi.org/10.3390/app152111578
Primary Topic
Composting and Vermicomposting Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Optimal Color Space Selection for Vermicompost Nitrogen Classification: A Comparative Study Using the KNN Model

Suthisa Leasen, Panida Lorwongtragool
Applied Sciences
Composting and Vermicomposting Techniques
article

Optimal Color Space Selection for Vermicompost Nitrogen Classification: A Comparative Study Using the KNN Model

Suthisa Leasen, Panida Lorwongtragool
article en

Abstract

This study presents a cost-effective and accurate method for assessing nitrogen concentration in vermicompost fertilizer using a low-cost TCS3200 color sensor and a K-Nearest Neighbors (KNN) machine learning model. The objective was to evaluate the performance of four different color spaces—RGB, Lab, LCh, and CMYK—identify the most effective feature representation for a multi-class classification task based on accuracy and theoretical robustness to ambient light variations. A total of 2400 data points were collected from a standard chemical test kit and processed. A rigorous 60-fold cross-validation approach was used to determine the optimal model hyperparameters and to ensure the robustness of the findings. The results demonstrate that the model trained on the LCh color space achieved the highest classification accuracy of 0.9708 with an optimal K-value of 6, significantly outperforming Lab (0.9688), RGB (0.9625), and CMYK (0.9583). A detailed analysis of the confusion matrix revealed that the model successfully classified the ‘High’ and ‘Medium’ nitrogen levels with near-perfect accuracy, while minor misclassifications occurred between the ‘Low’ and ‘Trace’ categories (5 Low ⟶ Trace, 6 Trace ⟶ Low). The proposed system offers a practical, robust, and accessible tool for precision agriculture, enabling farmers to make informed decisions regarding fertilization, and directly supporting sustainable agriculture and responsible resource management. The findings indicate that the LCh color space is highly effective for this application, providing a viable solution for the rapid and reliable assessment of vermicompost quality. Most importantly, this inexpensive, on-site system removes the need for costly, time-consuming laboratory analyses, giving farmers and compost users the instantaneous, accurate nitrogen data they need to maximize crop yield, optimize nutrient application, and significantly reduce input costs from overfertilization.

Applied SciencesVol. 15(21)
Rajamangala University of Technology Isan (TH), Rajamangala University of Technology Suvarnabhumi (TH)
Openalex Percentile: Top 61%
Composting and Vermicomposting Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.