Source-linked AI summary

Comparing YOLOv8 and Mask R-CNN for instance segmentation in complex orchard environments

Ranjan Sapkota, Dawood Ahmed, Manoj Karkee

arXiv:2312.07935v4cs.CV

TL;DR

Agricultural automation needs precise, adaptable segmentation of orchard objects, but traditional methods require manual tuning and deep-learning models face data and computational challenges. This study compares YOLOv8 and Mask R-CNN across single-class fruitlet and multi-class trunk-and-branch tasks under different orchard conditions. YOLOv8 achieved higher reported accuracy and faster inference, while Mask R-CNN retained an advantage where finer segmentation granularity is more important.

  • Problem

    Traditional agricultural segmentation requires manual refinement, while model performance depends on variable orchard data and computational resources, motivating comparative evidence for automation.

  • Method

    The study systematically compares YOLOv8 and Mask R-CNN on single-class fruitlet and multi-class trunk-and-branch instance segmentation across differing orchard conditions using precision, recall, mAP@ 0.5 IOU, AUC, and inference speed.

  • Results

    YOLOv8 outperformed Mask R-CNN in the reported single-class and multi-class segmentation results, with higher precision and recall and lower inference times.

  • Takeaways & Limitations

    YOLOv8 is supported as an efficient option for precision agricultural automation across varied orchard conditions, while Mask R-CNN remains useful when detailed object delineation is essential.

  • Takeaways & Limitations

    Mask R-CNN requires substantial computational resources, which can limit real-time agricultural applications with constrained farm infrastructure.

Abstract

from arXiv · show

Instance segmentation is an important image processing operation for agricultural automation, providing precise delineation of individual objects within images and enabling tasks such as selective harvesting and precision pruning. This study compares the one stage YOLOv8 model with the two stage Mask R CNN model for instance segmentation under varying orchard conditions across two datasets. Dataset 1, collected in the dormant season, contains images of apple trees without foliage and was used to train multi object segmentation models delineating branches and trunks. Dataset 2, collected in the early growing season, includes canopy images with green foliage and immature apples and was used to train single object segmentation models delineating fruitlets. Results showed YOLOv8 outperformed Mask R CNN with higher precision and near perfect recall at a confidence threshold of 0.5. For Dataset 1, YOLOv8 achieved precision 0.90 and recall 0.95 compared to 0.81 and 0.81 for Mask R CNN. For Dataset 2, YOLOv8 reached precision 0.93 and recall 0.97 compared to 0.85 and 0.88. Inference times were also lower for YOLOv8, at 10.9 ms and 7.8 ms, versus 15.6 ms and 12.8 ms for Mask R CNN. These findings demonstrate superior accuracy and efficiency of YOLOv8 for real time orchard automation tasks such as robotic harvesting and fruit thinning.

1. Introduction

Instance segmentation supports precise agricultural object delineation, while deep learning offers more adaptable alternatives to manually tuned classical methods. This study compares YOLOv8 and Mask R-CNN for single-class fruitlet and multi-class trunk-and-branch segmentation in commercial apple orchards.

  • Motivation: Instance segmentation combines object detection and semantic segmentation to delineate individual agricultural objects precisely.Applications include quantifying plant structures and supporting crop monitoring and automation.
  • Motivation: Traditional agricultural segmentation methods require extensive manual setup and refinement, limiting their reliability and adaptability to new data.These methods include watershed, graph-based, active contour, level-set, region-growing, morphological, and clustering approaches.
  • Deep learning transition: Deep learning models learn image features automatically and map raw images directly to segmentation results, improving consistency and reducing training-data requirements through transfer learning.CNN-based methods are described as more robust to varied agricultural imagery than manually specified features.
  • Automation relevance: Instance segmentation enables agricultural robots to detect, delineate, and track fruits, branches, flowers, and other objects for harvesting and canopy-management operations.The paper connects these capabilities to robotic harvesting, pruning, and crop-load management.
  • Study objective: The study systematically compares YOLOv8 and Mask R-CNN for instance segmentation in modern commercial apple orchards.The comparison evaluates model suitability, efficiency, and implementation challenges for agricultural automation.
  • Study scope: Experiments address single-class immature fruitlet segmentation in early-season variable environments and multi-class primary-branch and trunk segmentation during the dormant season.These tasks represent distinct orchard conditions and object-segmentation requirements.

2. Deep learning models

The paper contrasts two-stage Mask R-CNN with one-stage YOLOv8 architectures for agricultural instance segmentation. Mask R-CNN emphasizes region refinement and detailed masks, whereas YOLOv8 streamlines prediction for speed and computational efficiency.

  • Model architectures: Two-stage detectors first generate regions of interest and then classify and refine them, whereas one-stage detectors predict outputs directly.Mask R-CNN uses a Region Proposal Network in its initial stage.
  • Mask R-CNN: Mask R-CNN combines a backbone network, Region Proposal Network, bounding-box branch, and mask-prediction branch for object detection and instance segmentation.The backbone extracts shared image features, while the RPN proposes likely object regions.
  • Deployment considerations: Mask R-CNN performance depends heavily on training-data quality and diversity, while its computational requirements can limit real-time agricultural deployment.Agricultural variation in lighting, weather, and plant growth stages can affect model accuracy.
  • YOLOv8: YOLOv8 directly predicts bounding boxes and class probabilities without a separate region proposal network, streamlining detection and segmentation.Its anchor-free, center-based approach is presented as a key architectural innovation.
  • YOLOv8: YOLOv8 replaces the C3 module with C2F, uses a 3 × 3 convolution instead of a 6 × 6 layer, and employs a decoupled head to improve compactness, accuracy, and processing speed.These changes reduce parameters and separate object-presence prediction from object classification.
  • Deployment considerations: YOLOv8 configurations range from Tiny for fast, resource-limited processing to Large for applications prioritizing detection accuracy and detail.The available configurations trade computational speed against accuracy and detection detail.

3. Materials and methods

The study acquired and annotated RGB orchard images from dormant and early growing seasons, then trained and evaluated YOLOv8 and Mask R-CNN instance-segmentation models using standardized datasets and metrics.

  • Data acquisition: Images were acquired from commercial orchards across dormant and early growing seasons under varying environmental conditions, then manually annotated for model development.The workflow used RGB images captured on bright and cloudy days before training and testing the two models.
  • Dataset construction: Dataset 1 contained 474 dormant-season images with manually annotated trunks and primary branches as multi-class objects.The annotations included 1,141 tree trunks and 2,369 tree branches.
  • Dataset construction: Dataset 2 contained 1,079 growing-season images with 5,921 manually annotated immature green apples.Annotations were formatted according to the COCO dataset specification for both models.
  • Dataset preparation: Both datasets were resized to 640 × 640 pixels and randomly divided into training, validation, and test subsets using an 8:1:1 ratio.The split was applied for each object class.
  • Model implementation: YOLOv8 and Mask R-CNN were trained on the same workstation and implemented with PyTorch using regularization, augmentation, and validation-based stopping procedures.Training used dropout, image augmentations, and stopping when validation performance failed to improve over consecutive epochs.
  • Performance evaluation: Performance was evaluated using precision, recall, mAP@0.5 IoU, AUC, and inference speed.Inference speed was assessed through time per single-image prediction, while mAP@0.5 IoU measured precision at 50% overlap.

4. Results and discussion

YOLOv8 generally outperformed Mask R-CNN in fruitlet and dormant-tree segmentation, combining stronger segmentation performance with faster inference. The comparison also indicates a trade-off: Mask R-CNN may retain advantages when detailed delineation matters more than speed.

  • Single-class segmentation: 0.97 recall at minimum confidence and 0.939 mAP@0.5 showed YOLOv8’s strong fruitlet-segmentation performance.YOLOv8 also reached maximum precision of 1.00 at confidence threshold 0.929.
  • Single-class segmentation: YOLOv8 excluded canopy regions that resembled fruit, whereas Mask R-CNN incorrectly segmented some problematic regions as green fruit.The comparison is illustrated using immature green fruit in orchard canopy images.
  • Multi-class segmentation: 0.95 recall and 1.00 precision at confidence threshold 0.906 demonstrated YOLOv8’s strong performance on dormant trunks and branches.Mask R-CNN reached precision 1.00 at confidence threshold 0.813 and recall 0.837 at the lowest confidence threshold.
  • Multi-class segmentation: YOLOv8 was more precise than Mask R-CNN under challenging lighting and complex backgrounds, including low-light trunk and branch scenes.Examples showed YOLOv8 detecting branches missed by Mask R-CNN and producing fewer false detections.
  • Computational efficiency: 7.8 ms for single-class and 10.9 ms for multi-class segmentation made YOLOv8 faster per test image than Mask R-CNN.The reported inference measurements were obtained on the stated Intel Xeon W-2155 and NVIDIA TITAN Xp infrastructure.
  • Computational efficiency: YOLOv8 achieved 128 FPS for single-class and 92 FPS for multi-class segmentation, while Mask R-CNN retained suitability where minute detail was more critical.The discussion frames speed and accuracy against possible sacrifices in segmentation granularity.

5. Conclusion

The study compares YOLOv8 and Mask R-CNN for instance segmentation in commercial orchards across dormant and early growing seasons. YOLOv8 achieved higher segmentation accuracy and faster inference, supporting automated canopy and crop-load management tasks.

  • Segmentation Performance in Diverse Conditions: YOLOv8 and Mask R-CNN both segmented apple-tree canopy images from dormant and early growing seasons.
  • Single-Class Segmentation (Immature Green Fruit): YOLOv8 achieved precision 0.92 and recall 0.97 for immature green fruit, compared with 0.84 and 0.88 for Mask R-CNN.
  • Multi-Class Segmentation (Trunk and Branch Detection): YOLOv8 achieved precision 0.90 and recall 0.95 for trunk and branch detection, compared with 0.81 and 0.83 for Mask R-CNN.
  • Inference Speed for Multi-Class Segmentation: YOLOv8 reached 91.74 FPS for multi-class segmentation, while Mask R-CNN reached 64.10 FPS.
  • Segmentation Performance in Diverse Conditions: YOLOv8 performed slightly better when object and background colours were similar and under varying light intensities.

6. Future work

Future work should evaluate newer YOLO models across agricultural datasets and environmental conditions. The proposed evaluations would examine accuracy, efficiency, and adaptability across crop-growth stages and occlusion levels.

  • Future research could study YOLOv9 and YOLOv10 for agricultural image processing.
  • Future evaluations should test these models across diverse agricultural datasets and crop-growth stages.
  • Future studies should assess model performance under different occlusion levels and environmental conditions.
Loading 2312.07935v4…