高级检索+

基于改进YOLOv8n-seg的樱桃叠果与瑕疵实时分割

Real-time segmentation of overlapped cherry fruits and defects using improved YOLOv8n-seg model

  • 摘要: 针对分选线上樱桃叠果和表面瑕疵难以准确实时分割的问题,该研究提出了一种基于改进YOLOv8n-seg的多分支实时分割模型,命名SemIns-YOLOv8。该模型在YOLOv8n-seg的PAN-FPN(path aggregation network for feature pyramid network)模块后引入基于上下文集成的语义分割模块,并采用交叉熵损失与Dice Loss联合的损失函数,替代原始实例分割模块对果梗和瑕疵进行识别,既提升了尺寸较小及特征不明显瑕疵的识别精度,又缩短了图像的识别时间。同时,通过提高特征图分辨率并引入豪斯多夫距离损失(Hausdorff distance loss, HD Loss)构建边界特征增强的实例分割模块,实现了樱桃重叠果体的精准分离。试验结果表明,SemIns-YOLOv8在樱桃分割任务中果体mAP50-95(mean average precision at intersection over union thresholds from 0.50 to 0.95)、果梗IoU和瑕疵mIoU(mean intersection over union)分别为98.20%、92.15%和65.97%,与YOLOv8n-seg相比,提升了2.10、2.33和14.35个百分点,并且在模型输入尺寸为1024×384像素时,单帧推理时间为23 ms,可为线上水果外观品质实时分选提供参考。

     

    Abstract: Cherry grading is often required for the accurate segmentation of the fruit bodies, stems and defects. However, these cherries have limited to overlap and densely distribute. Most cherries on the sorting line share the dark-colored surfaces (dark red, or black). Different cherry varieties (Hongdeng, Yellow honey, and Tieton) also exhibit the distinct colors. The low contrast and blurred boundaries have posed the great challenge on the fruit body segmentation of the acquired images. A wide variety of surface defects can also include the bruises, cracks, russets, and rots. Some surface defects are significantly imbalanced in the quantity or size. Accurate segmentation of defects can also confine to the blur and unclear boundaries of the features. In this study, a multi-branch real-time segmentation model (SemIns-YOLOv8) was proposed for the complex segmentation of cherries using an improved YOLOv8n-seg. A context-integrated semantic segmentation module was also introduced after the path aggregation network. The feature pyramid network (PAN-FPN) module of YOLOv8n-seg was used to combine the loss function of cross-entropy and Dice loss. The original instance segmentation module was replaced to identify the stems and defects. The recognition accuracy of smaller and less distinct defects was improved to reduce the recognition time. The resolution of feature map was enhanced to introduce the hausdorff distance loss (HD Loss). A boundary feature-enhanced instance segmentation module was constructed to precise separate the overlapping fruit bodies. More boundary information was focused after optimization. A series of experiments were conducted on a cherry-annotated sample set with 2 094 images in the training set, 524 images in the validation set, and 300 images in the test set. Experimental results showed that the improved model was achieved in a mean average precision at intersection over union thresholds from 0.50 to 0.95 (mAP50-95) of 98.2% for fruit bodies, an intersection over union (IoU) of 92.15% for stems, and a mean intersection over union (mIoU) of 65.97% for defects. The inference time per frame was 23 ms on an NVIDIA GeForce GTX 1650 GPU, with the input size set to 1024×384 pixels. The improved model was achieved the better time and accuracy, compared with the mainstream segmentation models (such as YOLACT, Mask R-CNN, DeepLabv3, YOLOv7-seg, and YOLOv8n-seg). Specifically, the segmentation tasks were performed better. Among them, the mAP50-95 of fruit bodies, IoU of stems, and mIoU of defects were improved by 1.80, 2.21, and 4.70 percentage points, respectively, compared with the YOLOv7-seg. At the same time, the inference time per frame decreased by 47ms. Compared with the YOLOv8n-seg, the mAP50-95 of fruit bodies and IoU of stems were improved by 2.10 and 2.33 percentage points, respectively. While the mIoU of defects shared a significant improvement of 14.35 percentage points, and the inference time per frame was reduced by 1ms. The improvements were also applicable to the YOLOv11. In conclusion, the SemIns-YOLOv8 can be expected to accurately segment the cherry fruit bodies, stems, and various types of defects over the various varieties and varying brightness contrasts. The better recognition of smaller and less distinct defects was promoted to reduce the contour segmentation that caused by overlapping or densely distributed fruit bodies on the sorting line. This improved model can also provide the higher accuracy and speeds for the cherry sorting, fully meeting the practical requirements. The finding can offer a strong reference to evaluate the fruit appearance quality on the real-time sorting line.

     

/

返回文章
返回