Automating the final stages of walnut processing, including kernel grading and shell separation, remains a significant challenge due to subtle visual differences between kernel grades. In this work, we propose a novel real-time deep learning approach for multi-class separation of walnut components into shells, membranes, and two kernel quality classes. A key obstacle lies in the ambiguous visual distinction between first and second-class kernels, with the former typically being lighter in color and the latter darker, which hampers detection accuracy. To address this, we propose an annotation method based on thresholding the first derivative of sorted average blue channel (visible blue light) values, enabling clearer class separation and yielding a 2.02% mAP@0.5 improvement. Building on this, we train a detector using only the blue channel and apply targeted data augmentation and balancing strategies, achieving a further 1.42% mAP@0.5 gain. Finally, we introduce a new lightweight YOLOv4-tiny variant that incorporates convolutional attention blocks while reducing parameter count, resulting in a 56.52% faster inference with only a 1.35% drop in mAP@0.5. This combined approach significantly enhances the reliability of automated walnut kernel grading in real-time settings.
Mihajlov et al. (Thu,) studied this question.