Addressing the issues of large model parameters and high computational complexity in apple target detection algorithms for complex orchard environments, which hinder application on devices with limited computational resources, an improved and lightweight apple target detection algorithm named YOLOv8n-Apple based on YOLOv8 was proposed. The backbone network, yaniaNet, was introduced to reduce model parameters and complexity. The original C2f module in the model was replaced with the C2fGhost module, which further decreased model parameters by obtaining similar feature maps through fewer convolutional operations. The lightweight upsampling operator CARAFE was utilized to address the issues of semantic loss and excessively small receptive fields associated with traditional upsampling operators. Given that traditional loss functions cannot fully capture the relative position and size differences between targets, the WIoU bounding box was adopted as the regression loss function. A dataset comprising 3 120 images of mature apples in various scenarios, including distant and close views under front-light and backlight conditions, was collected from diverse angles and backgrounds, to mitigate potential dataset uncertainties. The improved apple detection model for orchard environments demonstrated an average detection accuracy of 90%, which was 7.5, 4.8, 2.2, 3.8, and 3.4 percentage points higher than SSD, Faster R-CNN, YOLOv5, YOLOv7, and YOLOv8, respectively. The detection speed reached 286 frames per second, and the model size was reduced to 1.8 MB, representing an improvement of 41 frames per second compared to the original model, while occupying only 60.0% of size.
| 科 Family | 属数 Number of genus | 种数 Number of species | 占总种数比例 Percentage of total species (%) | 属 Genus | 种数 Number of species | 占总种数比例 Percentage of total species (%) |
|---|---|---|---|---|---|---|
| 鹅膏菌科Amanitaceae | 2 | 11 | 5.26 | 鹅膏菌属 Amanita | 10 | 4.78 |
| 小菇科 Mycenaceae | 2 | 12 | 5.74 | 丝盖伞属 Inocybe | 5 | 2.39 |
| 多孔菌科 Polyporaceae | 8 | 14 | 6.70 | 蜡蘑属 Laccaria | 5 | 2.39 |
| 红菇科 Russulaceae | 3 | 23 | 11.00 | 小皮伞属 Marasmius | 6 | 2.87 |
| 小菇属 Mycena | 11 | 5.26 | ||||
| 光柄菇属 Pluteus | 5 | 2.39 | ||||
| 红菇属 Russula | 17 | 8.13 | ||||
| 栓菌属 Trametes | 5 | 2.39 |