SpinachXAI-Rec: a multi-stage explainable AI framework for spinach freshness classification and consumer recommendation

Leafy vegetables such as spinach are among the most important components in a nutritious diet but are highly perishable and susceptible to premature spoilage. Traditional practices in determining freshness have been qualitative and time-consuming and have consistently led to defective consumption decisions with unintended consequences on human health. To this issue, we introduce SpinachXAI-Rec, a multistage framework that is enabled by AI and is capable of automating the classification of spinach freshness and providing consumer recommendations. This framework is based on understandable deep learning. To guarantee class balance and feature diversity, a dataset consisting of 4005 original images of three spinach varieties (Malabar, Red, and Water) was expanded to 12,000 images (2000 per class across six categories: fresh and non-fresh). We trained three CNN architectures, DenseNet121, ResNet50, and EfficientNetB0, on the Stage 1 augmented dataset. In performance, we saw DenseNet121 significantly outperform with 96% classification accuracy compared to ResNet50 (53%) and EfficientNetB0 (17%). Stage 2 improved representation of features by incorporating DenseNet121 embeddings and ViT-B/16 and Swin Transformer attention mechanisms. DenseNet121 + ViT-B/16 obtained an F1-score of 0.95, which was further optimised to 0.97 in Stage 3 using a multiclass SVM classifier. GradCAM++ and LIME were employed to incorporate interpretability during Stage 4. LIME provided transparent explanations of the significance of class-specific features, while GradCAM++ effectively highlighted disease-affected or spoilt regions. The most effective model (DenseNet121 + ViT + SVM) also obtained a Dice coefficient of 0.89 and an IoU of 0.82, which confirms the precision of localisation and segmentation. Finally, Stage 5 introduces a clinical recommender system that is based on rules and relates prediction confidence to real-world categories: Eatable, Eatable with Caution, or Not Eatable. This AI-driven recommendation assists food purveyors and consumers in making health-conscious, well-informed decisions. SpinachXAI-Rec is a significant advancement in the development of safer food systems, as it provides interpretable AI for the purpose of freshness validation and actionable consumption recommendations, thereby empowering both consumers and industry stakeholders.

Authors

Institutions

Publication Details

Journal
Scientific Reports
Published
2025-10-14
DOI
https://doi.org/10.1038/s41598-025-19804-y
Citations
1
Primary Topic
Smart Agriculture and AI
Type
article
Field-Weighted Citation Impact
1.75
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

SpinachXAI-Rec: a multi-stage explainable AI framework for spinach freshness classification and consumer recommendation

Shilpa Ankalaki, Ranjith Kumar Gatla, G. Sujatha, Akella S. Narasimha Raju
1 citations
Scientific Reports
Smart Agriculture and AI
1.75
article

SpinachXAI-Rec: a multi-stage explainable AI framework for spinach freshness classification and consumer recommendation

Shilpa Ankalaki, Ranjith Kumar Gatla, G. Sujatha, Akella S. Narasimha Raju
article en
1 citations

Abstract

Leafy vegetables such as spinach are among the most important components in a nutritious diet but are highly perishable and susceptible to premature spoilage. Traditional practices in determining freshness have been qualitative and time-consuming and have consistently led to defective consumption decisions with unintended consequences on human health. To this issue, we introduce SpinachXAI-Rec, a multistage framework that is enabled by AI and is capable of automating the classification of spinach freshness and providing consumer recommendations. This framework is based on understandable deep learning. To guarantee class balance and feature diversity, a dataset consisting of 4005 original images of three spinach varieties (Malabar, Red, and Water) was expanded to 12,000 images (2000 per class across six categories: fresh and non-fresh). We trained three CNN architectures, DenseNet121, ResNet50, and EfficientNetB0, on the Stage 1 augmented dataset. In performance, we saw DenseNet121 significantly outperform with 96% classification accuracy compared to ResNet50 (53%) and EfficientNetB0 (17%). Stage 2 improved representation of features by incorporating DenseNet121 embeddings and ViT-B/16 and Swin Transformer attention mechanisms. DenseNet121 + ViT-B/16 obtained an F1-score of 0.95, which was further optimised to 0.97 in Stage 3 using a multiclass SVM classifier. GradCAM++ and LIME were employed to incorporate interpretability during Stage 4. LIME provided transparent explanations of the significance of class-specific features, while GradCAM++ effectively highlighted disease-affected or spoilt regions. The most effective model (DenseNet121 + ViT + SVM) also obtained a Dice coefficient of 0.89 and an IoU of 0.82, which confirms the precision of localisation and segmentation. Finally, Stage 5 introduces a clinical recommender system that is based on rules and relates prediction confidence to real-world categories: Eatable, Eatable with Caution, or Not Eatable. This AI-driven recommendation assists food purveyors and consumers in making health-conscious, well-informed decisions. SpinachXAI-Rec is a significant advancement in the development of safer food systems, as it provides interpretable AI for the purpose of freshness validation and actionable consumption recommendations, thereby empowering both consumers and industry stakeholders.

Scientific ReportsVol. 15(1)
SRM Institute of Science and Technology (IN), Manipal Academy of Higher Education (IN), International Institute of Information Technology, Hyderabad (IN)
Openalex Percentile: Top 12%
Smart Agriculture and AI
1.75
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.