A Multi-Class Deep Learning Architecture for Quality Classification and Formalin Contamination Detection in Horticultural Fruits
Abstract
The adulteration of fresh horticultural produce with formaldehyde (formalin) and the rapid physiological decay of fruit remain persistent food-safety and economic problems within agricultural supply chains. Deep learning offers a non-destructive route to automated fruit-quality screening; however, the literature has largely pursued peak accuracy using progressively heavier network backbones, leaving the computational cost of that accuracy and therefore the feasibility of on-site, embedded deployment insufficiently examined. This study benchmarks three representative visual-recognition paradigms of markedly different scale, namely MobileNetV2 (a depthwise-separable lightweight convolutional neural network), ResNet-50 (a deep residual network), and ViT-B/16 (a patch-based Vision Transformer), on the identical three-class task of distinguishing fresh, rotten, and formalin-mixed fruit. A total of 10,154 images from the public FruitVision dataset were processed under a single fixed preprocessing and training protocol, so that architecture was the only experimental variable. Rather than accuracy alone, performance was assessed through an efficiency lens that normalises accuracy by parameter count and by inference cost (GFLOPs). The lightweight MobileNetV2 attained the highest test accuracy (99.69%) while using approximately one-seventh of the parameters and one-thirteenth of the floating-point operations of ResNet-50, and about one twenty-fifth of the parameters of ViT-B/16; the Transformer recorded the lowest accuracy (99.28%) at the highest cost. These results indicate that, for this medium-scale task, additional architectural capacity yields a negligible accuracy return, and that a compact model can support reliable, safety-critical formalin screening on resource-constrained devices. Per-class reliability and deployment implications, including one residual false negative, are reported without overstatement.