Low-Cost, Nondestructive Cultivar Identification of Dried Goji Berries Using RGB Images and a Lightweight LSH-CoAtNet Model
Lei Shi, Zhaocong Lyu, Yansong Li, Jing Guo, Zhenyang Chen, Cheng Qian, Zhuo Bai, Helong YuAccurate cultivar identification of commercial dried goji berries is essential for raw material sorting, batch consistency assessment, and quality control during processing and distribution. Conventional approaches based on manual judgment or physicochemical analysis are often subjective, labor-intensive, time-consuming, and costly, making them unsuitable for rapid commercial sorting and quality inspection. To develop a rapid, low-cost, and nondestructive method for dried goji berry cultivar identification, this study proposes a visual recognition framework that integrates RGB imaging with lightweight deep learning. A dataset comprising 25,899 RGB images from five cultivars of commercial dried goji berry samples, namely Ningqi No. 7, Linqi No. 5, Ningqi No. 1, Keqi 6082, and Jingqi No. 1, was constructed. Given the pronounced surface shrinkage, complex texture, and subtle inter-cultivar appearance differences of dried goji berries, an image quality enhancement method was designed to strengthen the representation of color gradation, textural details, and edge information. For model development, CoAtNet was selected as the baseline network and redesigned for lightweight deployment. By integrating an improved feature extraction module and an information-preserving downsampling module, the proposed LSH-CoAtNet model enhances fine-grained feature representation while reducing computational cost. On the quality-enhanced image dataset, the proposed method achieved an accuracy of 98.80%, a precision of 98.81%, a recall of 98.80%, and an F1-score of 98.80%. The model contained only 6.41 M parameters and required 1.60 GFLOPs, outperforming the baseline model in both classification performance and computational efficiency. Ablation experiments and five-fold cross-validation further confirmed the effectiveness of the image quality enhancement strategy, the contribution of each improved module, and the stability of the model. Overall, the proposed method, which combines RGB image quality enhancement with LSH-CoAtNet, provides a low-cost, nondestructive, and efficient technical solution for rapid cultivar identification, raw material sorting, batch consistency assessment, and quality control of commercial dried goji berries during processing and distribution. It may also serve as a reference for intelligent classification and quality inspection of other specialty dried horticultural products.