Detection of Kernel-Level Spoilage Adulteration in Dried Goji Berries Using Zero-Shot Learning and Computer Vision
Ruobin Huang, Yuanning Zhai, Baiwei Sun, Osama Elsherbiny, Lei Zhou, Yiying ZhaoHidden adulteration of stale berries in dried goji berry batches is difficult to detect by manual inspection or batch-level quality assessment. This study developed a high-throughput method for kernel-level spoilage adulteration quantification in dried goji berries. It addressed three practical challenges in the image processing of densely arranged dried-fruits, including scalable label generation for deep learning segmentation without pixel-level manual annotation, separation of densely touching small berries, and full-size quality level distribution map reconstruction. SAM-assisted pseudo-label generation combined with multi-scale image cropping was used to overcome the limitation of manual pixel-level annotation, while YOLO-based instance segmentation was further employed for efficient berry localization in dense scenes. The freshness labels of segmented single berries were assigned by a statistical RGB-HSV grading rule. Specifically, adaptive multi-scale image cropping for segmentation was applied to improve local separability of berries under dense adhesion and occlusion conditions. The crop-level segmentation and grading outputs were subsequently reconstructed into the original image coordinate system to generate complete quality distribution maps. Results showed that YOLO models trained based on the pseudo-labels achieved a precision of 0.953, a recall of 0.951, an mAP50 of 0.960, and an mAP50-95 of 0.846. The full-size grading map reconstruction method produced a mean duplicate-suppression rate of 4.31%. In the full freshness-grading test dataset, 4850 berries were detected, including 449 stale berries. The mean absolute counting error was 1.61%. The proposed framework reduces manual annotation requirements while enabling berry-level freshness classification and quantitative stale-berry proportion estimation, providing objective information for dried fruit quality screening and adulteration control.