Apples are susceptible to postharvest bruises, leading to a shortened shelf life and significant waste. Therefore, accurate detection of apple bruises is crucial to mitigate food waste. This study proposed an improved lightweight network based on MobileViT for detecting early-stage bruises in apples, utilizing hyperspectral imaging technology from 397.66 to 1003.81nm. After acquiring hyperspectral images, the Otsu threshold algorithm was employed for mask extraction, and principal component analysis was used for feature image extraction. Subsequently, the improved MobileViT network (iM-ViT) was implemented and compared with traditional algorithms, utilizing depthwise separable convolutions for parameter reduction and integrating local and global features to enhance bruise detection capability. The results demonstrated the superior performance of iM-ViT in accurately detecting apple bruises, showing significant improvements. The F1 score and test accuracy for detecting apple bruises using iM-ViT reached 0.99 and 99.07%, respectively. The fivefold cross-validation strategy was used to assess the stability and robustness of iM-ViT, and ablation experiments were performed to explore the effects of depthwise separable convolutions and local features on parameter reduction and classification accuracy improvement for early-stage bruise detection in apples. The results demonstrated that iM-ViT effectively reduced parameters and improved the ability to detect early bruises in apples. PRACTICAL APPLICATION: This study proposed an improved lightweight network to detect early bruises in apples, providing a reference for quick detection of bruises caused in the production process. Potential insights into the nondestructive detection of apple bruises using lightweight networks have been presented, which might be applied to mobile or online devices.
Read full abstract