智能化农业装备学报(中英文)2025,Vol.6Issue(4):17-23,7.DOI:10.12398/j.issn.2096-7217.2025.04.002
基于改进YOLOv7的核桃仁分级研究与试验
Research and experiment on walnut kernel grading based on improved YOLOv7
摘要
Abstract
In China,walnut kernel grading predominantly relies on mechanical and manual methods,which suffer from high economic costs,low efficiency,and poor accuracy,severely limiting the standardization and economic value of walnut kernel products.To achieve automated and intelligent walnut kernel grading,this study proposes a deep learning-based intelligent grading method.An image acquisition device was utilized to capture walnut kernel images across six grades under three distinct background colors:pure white,light green,and conveyor belt.The Python OpenCV library was employed for data augmentation to expand the dataset,resulting in a VOC format dataset of 12 246 images,with training,testing,and validation sets allocated in an 8:1:1 ratio.To select the most suitable model for walnut kernel grading,two models were constructed based on the YOLOv5 and YOLOv7 object detection networks,respectively.Both models were trained using pre-trained weights,achieving average grading accuracies of 87.83%and 91.16%for YOLOv5 and YOLOv7,respectively.During validation,YOLOv7 exhibited mispredictions,prompting the integration of two attention mechanisms,ECANet and CBAM,to refine the model.The improved models demonstrated enhanced performance,with the YOLOv7+CBAM model achieving the highest average accuracy(94.5%)and F1-score(90.2%).Compared to the original YOLOv7,the upgraded model increased average accuracy and F1-score by 3.34%and 5.9%,respectively,while adding only 2ms to inference time.To validate practical feasibility,a recognition system platform was developed for walnut kernel classification testing.Four experimental groups were designed,each containing 120 walnut kernels(20 per grade).The YOLOv7+CBAM model achieved an average recognition accuracy of 91.63%,demonstrating robust grading capabilities for walnut kernel appearance quality.This study provides a reference for intelligent walnut kernel grading systems.关键词
核桃仁分级/YOLOv7/目标检测/注意力机制/机器视觉/深度学习Key words
walnut kernel grading/YOLOv7/object detection/attention mechanisms/machine vision/deep learning分类
农业科技引用本文复制引用
于英杰,吴坤澍,冉朋鑫,李加念..基于改进YOLOv7的核桃仁分级研究与试验[J].智能化农业装备学报(中英文),2025,6(4):17-23,7.基金项目
云南省"兴滇英才支持计划"青年人才项目(KKRD202223052)Yunnan Revitalization Talent Support Program(KKRD202223052) (KKRD202223052)