Automated Vegetable Classification Using Hybrid CNN and Vision Transformer Models for Food Quality Assessment

The food industry increasingly relies on automated vision systems to ensure product quality, consistency, and safety. However, the visual classification of vegetables remains challenging due to high intra-class variability, illumination differences, and subtle morphological similarities between categories. This study evaluates the effectiveness of combining CNNs with four advanced Vision Transformer (ViT) architectures: DeiT (Data-efficient Image Transformer), CoaT (Co-Scale Conv-Attentional Transformer), CvT (Convolutional Vision Transformer), CrossViT (Cross-Attention Vision Transformer) for the automatic classification of 15 vegetable types. All models were implemented within a unified CNN–ViT hybrid framework to enhance both local feature extraction and global contextual reasoning. We processed all images under identical conditions to ensure a fair comparison and reproducibility. Results demonstrate that the hybrid architectures significantly outperform the standalone CNN baseline, with CvT achieving an approximate global accuracy in the range of 96.6–98.88% and consistently strong performance across visually complex classes such as cabbage, brinjal, and pumpkin. These findings confirm that hybrid CNN–ViT models are highly effective for visual food analysis, offering a robust and scalable solution for quality control, automated inspection, and classification of agricultural products. The methodology presented here may also be extended to other food items, including gels and processed products, highlighting its versatility and industrial relevance.

Authors

Institutions

Publication Details

Journal
Electronics
Published
2026-03-09
DOI
https://doi.org/10.3390/electronics15051123
Primary Topic
Smart Agriculture and AI
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Automated Vegetable Classification Using Hybrid CNN and Vision Transformer Models for Food Quality Assessment

Azeddine Mjahad, Alfredo Rosado-Muñoz
Electronics
Smart Agriculture and AI
article

Automated Vegetable Classification Using Hybrid CNN and Vision Transformer Models for Food Quality Assessment

Azeddine Mjahad, Alfredo Rosado-Muñoz
article en

Abstract

The food industry increasingly relies on automated vision systems to ensure product quality, consistency, and safety. However, the visual classification of vegetables remains challenging due to high intra-class variability, illumination differences, and subtle morphological similarities between categories. This study evaluates the effectiveness of combining CNNs with four advanced Vision Transformer (ViT) architectures: DeiT (Data-efficient Image Transformer), CoaT (Co-Scale Conv-Attentional Transformer), CvT (Convolutional Vision Transformer), CrossViT (Cross-Attention Vision Transformer) for the automatic classification of 15 vegetable types. All models were implemented within a unified CNN–ViT hybrid framework to enhance both local feature extraction and global contextual reasoning. We processed all images under identical conditions to ensure a fair comparison and reproducibility. Results demonstrate that the hybrid architectures significantly outperform the standalone CNN baseline, with CvT achieving an approximate global accuracy in the range of 96.6–98.88% and consistently strong performance across visually complex classes such as cabbage, brinjal, and pumpkin. These findings confirm that hybrid CNN–ViT models are highly effective for visual food analysis, offering a robust and scalable solution for quality control, automated inspection, and classification of agricultural products. The methodology presented here may also be extended to other food items, including gels and processed products, highlighting its versatility and industrial relevance.

ElectronicsVol. 15(5)
Universitat de València (ES)
Zero hunger
Openalex Percentile: Top 30%
Smart Agriculture and AI
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.