Hao Ma, Yulong Ding, Tianhang Ding, Shijie Jiang, Hongwei Cui, C S Yang, Jiapeng Li
• Agaricus bisporus are categorized into three types based on growth characteristics. • Segmentation of Agaricus bisporus clusters using the YOLOv8n-USD model. • Circular detection on colour images and KD-tree segmentation of Agaricus bisporus point clouds. • Planning the picking-sequence of Agaricus bisporus using global and local strategies. Aiming at the issue of densely clustered and mutually overlapping growth of A. bisporus where mechanical picking tends to damage adjacent targets, this study proposes a segmentation and harvesting sequence planning method based on YOLOv8n-USD and KD-tree nearest-neighbour search, achieving optimised harvesting sequence planning for densely overlapping mushrooms. First, the YOLOv8n-USD model was constructed by improving the modules in the backbone and neck networks of YOLOv8n. This model classifies double-spore A. bisporus clusters into three categories (one, sparse and dense) and generates mask images, which are then registered with depth images to create point clouds. Second, circular detection is applied to extract the centre and radius of each A. bisporus , which are then mapped to the point cloud. The KD-tree nearest-neighbour search algorithm is used to segment each A. bisporus point cloud. Finally, using A. bisporus point cloud data, this method integrates global and local path planning to optimise harvesting sequences, adapting to variable crop density distributions. Experimental results show indicate that the YOLOv8-USD model achieved 2.3%, 1.9% and 4.4% improvements in average precision across three A. bisporus cluster categories compared with the original model. The YOLOv8-USD model attained precision, recall, and average precision of 88.1%, 91.3% and 94.7%, respectively, outperforming other models. The average absolute errors for the 3D coordinates and diameter measurements of A. bisporus were (1.75, 1.47and 1.38 mm) and 1.97 mm, respectively. Point cloud segmentation experiments for A. bisporus reveal that segmentation accuracy reached 96.54%. The accuracy rate of harvest timing planning reached 95.61%. The harvest timing planning algorithm proposed in this study determines the picking order for A. bisporus at varying densities, providing operational sequence information to support harvesting robots.