Related Experiment Video
Updated: Jul 2, 2026

Deep Neural Networks for Image-Based Dietary Assessment
Published on: March 13, 2021
SpinachXAI-Rec: a multi-stage explainable AI framework for spinach freshness classification and consumer
Akella S Narasimha Raju1, G Sujatha2, Ranjit Kumar Gatla3
1Department of Computing Technologies, School of Computing, College of Engineering & Technology, SRM Institute of Science and Technology, Kattankulathur, Chennai, Tamil Nadu, 603203, India. akellar@srmist.edu.in.
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.
Related Concept Videos
Predicting Products: Substitution vs. Elimination
The following factors can influence the mechanisms competing against each other:
Machines: Problem Solving II
Classification of Systems-I
Homogeneity dictates that if an input x(t) is multiplied by a constant c, the output y(t) is multiplied by the same constant. Mathematically, this is expressed as:
Classification of Systems-II
Multi-input and Multi-variable systems
In the absence of...
Distribution Reliability and Automation