Image target detection method and system based on YOLOv8y
By using YOLOV8Y -based image target detection methods among Apple picking robots, the problem of insufficient accuracy of apple fruit detection in the environmental orchard environment is solved, and higher detection accuracy and stability are achieved. Essence
Patent Information
- Application Number
- CN202411545331.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-11-01
AI Technical Summary
Existing apple picking robots cannot accurately detect apple fruits in complex weather orchard environments.
Adopting the image target detection method based on YOLOV8Y, by adjusting the zoom factor of the model, the introduction of a two -way characteristic pyramid structure, and the PIOUV2 loss function, the model structure is optimized and pruning adjustment is performed to improve the detection accuracy.
In the environmental orchard environment, the accuracy and stability of apple fruit detection is significantly improved, the size of the model and the complexity of the calculation are reduced, and the high detection accuracy is maintained.
Smart Images

Figure CN119048746B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image detection, and in particular to an image target detection method and a system thereof based on YOLOv8y. Background Art
[0002] Apple is one of the most important cultivated fruits in the world and is widely grown in temperate regions. In the past decade, China has become the leading country in apple production, accounting for nearly half of global production. However, a major challenge facing orchard management during the apple season is to ensure timely and efficient harvesting.
[0003] In existing technologies, orchard managers need to hire a large number of temporary workers to complete this task. However, as labor resources become increasingly scarce, automated harvesting based on robotics has become an inevitable trend in agricultural development. The development of computer vision technology has promoted target recognition in fruit and vegetable detection. Machine vision based on deep learning is gradually being applied to agricultural production due to its high efficiency and non-destructive characteristics. In modern agriculture, apple picking robots face challenges such as complex growth environments, unstable lighting, and weather changes, which lead to a decrease in target detection accuracy.
[0004] In summary, in complex weather orchard environments, existing apple picking robots are unable to accurately inspect apple fruits. Summary of the invention
[0005] The present invention solves the problem that the existing apple picking robots are unable to accurately detect apple fruits in complex weather orchard environments.
[0006] The image target detection method based on YOLOv8y described in the present invention is specifically as follows:
[0007] Determine the scale factor of YOLOv8y;
[0008] The image is sequentially input into the YOLOv8y backbone network, the YOLOv8y neck-bidirectional feature pyramid structure network and the YOLOv8y head network to detect the target;
[0009] In the YOLOv8y backbone network, the image is sequentially subjected to V7 Downsampling and multiple cascaded V7Downsampling and C2f for feature extraction, and feature images of multiple scales are output respectively;
[0010] The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs fused feature images of multiple scales;
[0011] The PIoUv2 loss function in the YOLOv8y head network detects the target based on the fused feature images of multiple scales;
[0012] Prune and adjust YOLOv8y in sequence.
[0013] Further, in one embodiment of the present invention, the scaling factor of YOLOv8y is determined as follows:
[0014] The scaling factors of YOLOv8y include widen factor, deepen factor, ratio, parameters and FLOPs;
[0015] Among them, the widen factor is 0.16, the deepen factor is 0.33, the ratio is 2.0, the parameters are 1.53, and the FLOPs is 4.4.
[0016] Furthermore, in one embodiment of the present invention, the V7 Downsampling is specifically:
[0017] The image is divided into a first image and a second image. The feature image after the number of channels output by the first image is adjusted is concatentated with the feature image output by the second image to output a feature image with multiple feature information.
[0018] Further, in one embodiment of the present invention, the feature image after the number of channels of the first image output is adjusted is concat with the feature image output of the second image, specifically:
[0019] The first image is pooled by MaxPool, and the pooled feature image is output. The number of channels of the pooled feature image is adjusted by Conv, and the feature image with adjusted channel number is output. The second image is subjected to feature extraction by multiple Convs, and the feature image is output. The feature image with adjusted channel number output by the first image is concat with the feature image output by the second image.
[0020] Further, in one embodiment of the present invention, the bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network is specifically:
[0021] The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network includes multiple Upsamples and multiple Downsamples.
[0022] Further, in one embodiment of the present invention, the bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs the fused feature images of multiple scales, specifically:
[0023] The feature images of the multiple scales are respectively a feature image of a first scale, a feature image of a second scale, a feature image of a third scale and a feature image of a fourth scale;
[0024] In the YOLOv8y neck-feature pyramid structure network, the feature image of the first scale is sequentially Downsampled, C2f, multiple Upsamples, C2f, multiple Downsamples, and C2f to be fused with the feature image of the second scale, the feature image of the third scale, and the feature image of the fourth scale, and the fused feature images of multiple scales are output.
[0025] Furthermore, in one embodiment of the present invention, the PIoUv2 loss function is specifically:
[0026] ;
[0027] in, is the PIoUv2 loss function, is the PIoUv1 loss function, is a non-monotonic attention function, is a hyperparameter, is the mass of the anchor box.
[0028] The image target detection system based on YOLOv8y described in the present invention is specifically:
[0029] Determine the scale factor of YOLOv8y;
[0030] The image is sequentially input into the YOLOv8y backbone network, the YOLOv8y neck-bidirectional feature pyramid structure network and the YOLOv8y head network to detect the target;
[0031] In the YOLOv8y backbone network, the image is sequentially subjected to V7 Downsampling and multiple cascaded V7Downsampling and C2f for feature extraction, and feature images of multiple scales are output respectively;
[0032] The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs fused feature images of multiple scales;
[0033] The PIoUv2 loss function in the YOLOv8y head network detects the target based on the fused feature images of multiple scales;
[0034] Prune and adjust YOLOv8y in sequence.
[0035] The apple fruit detection method in a complex weather orchard environment described in the present invention realizes the detection of apple fruits based on the image target detection method based on YOLOv8y described in the above method.
[0036] The present invention solves the problem that the existing apple picking robots cannot accurately detect apple fruits in complex weather orchard environments. Specific beneficial effects include:
[0037] The method for detecting apple fruit in a complex weather orchard environment described in the present invention is that in modern agriculture, apple picking robots face challenges such as complex growth environments, unstable lighting and weather changes, which lead to a decrease in target detection accuracy. In order to solve the above technical problems, the present invention successfully reduces the size of the model by adjusting the scaling factor of the model and introducing two lightweight structures, and adopts the PIoUv2 loss function with better convergence and lower loss. After pruning and adjustment optimization, YOLOv8y is obtained to reduce the size of the model structure. Based on YOLOv8y, apple fruit in a complex weather orchard environment is detected. Experimental results show that the detection effect of using YOLOv8y to detect apple fruit in a complex weather orchard environment is more accurate;
[0038] The image target detection method based on YOLOv8y described in the present invention can detect image targets in various environments with high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0040] Figure 1 1 is a structural diagram of YOLOv8y described in Implementation Mode 1;
[0041] Figure 2 It is a scale factor diagram of various network structures described in the first embodiment;
[0042] Figure 3 is a structural diagram of V7 Downsampling described in Implementation Mode 1;
[0043] Figure 4 is a structural diagram of the bidirectional feature pyramid structure network described in Implementation Mode 1;
[0044] Figure 5is a comparison diagram of ablation experiments of various network structures described in the first embodiment;
[0045] Figure 6 is a comparison diagram of different loss functions described in Implementation Mode 1;
[0046] Figure 7 is a comparison diagram of bounding box losses of different loss functions described in Implementation Method 1;
[0047] Figure 8 is a pruning situation diagram described in the first embodiment;
[0048] Fig. 9 is a pruning situation diagram described in the first embodiment;
[0049] Fig.10 is a comparison diagram of different lightweight backbones described in the first embodiment;
[0050] Fig.11 This is a comparative test diagram described in Embodiment 3;
[0051] Fig.12 This is the apple detection image using EfficientDet in normal weather as described in Implementation Method 3;
[0052] Fig.13 This is the apple detection image using YOLOv3-Tiny in normal weather as described in Implementation Method 3;
[0053] Fig.14 This is the apple detection image using YOLOv5n in normal weather as described in Implementation Method 3;
[0054] Fig.15 This is the apple detection image using YOLOv7-Tiny in normal weather as described in Implementation Method 3;
[0055] Fig.16 It is the apple detection image using YOLOv8n in normal weather as described in Implementation Method 3;
[0056] Fig.17 This is the apple detection image using YOLOv10n in normal weather as described in Implementation Method 3;
[0057] Fig.18 It is the apple detection image using YOLOv8y in normal weather as described in Implementation Method 3;
[0058] Fig.19 The original normal weather apple detection image described in Implementation Method 3;
[0059] Fig. 20 This is the apple detection image using EfficientDet in the weak light at dusk described in Implementation Mode 3;
[0060] Fig.21 This is the apple detection image using YOLOv3-Tiny in the weak light of the evening as described in the third implementation mode;
[0061] Fig. 22 This is the apple detection image using YOLOv5n in the weak light of the evening as described in the third implementation mode;
[0062] Fig.23 This is the apple detection image using YOLOv7-Tiny in the weak light of the evening as described in the third implementation mode;
[0063] Fig.24 The apple detection image using YOLOv8n in the weak light of the evening described in the third implementation mode;
[0064] Fig.25 This is the apple detection image using YOLOv10n in the weak light of the evening as described in the third implementation mode;
[0065] Fig.26 The apple detection image using YOLOv8y in the weak light of the evening described in the third implementation mode;
[0066] Fig. 27 This is the original evening weak light apple detection image described in Implementation Method 3;
[0067] Fig.28 This is the apple detection image using EfficientDet in the simulated strong light in the early morning as described in the third implementation mode;
[0068] Fig.29 The third embodiment is a detection image of apples using YOLOv3-Tiny under simulated strong light in the early morning;
[0069] Fig.30 The third embodiment simulates the strong light in the early morning by using YOLOv5n to detect apples;
[0070] Fig.31 The third embodiment is a detection image of apples using YOLOv7-Tiny under simulated strong light in the early morning;
[0071] Fig.32 The third embodiment simulates the strong light in the early morning by using YOLOv8n to detect apples;
[0072] Fig.33 The third embodiment simulates the strong light in the early morning by using YOLOv10n to detect apples;
[0073] Fig.34The third embodiment simulates the strong light in the early morning by using YOLOv8y to detect apples;
[0074] Fig.35 It is the original simulated early morning strong light apple detection image described in Implementation Mode 3;
[0075] Fig.36 This is the apple detection image using EfficientDet in the light mist described in the third implementation mode;
[0076] Fig.37 This is the light fog detection image of apples using YOLOv3-Tiny as described in Implementation Method 3;
[0077] Fig.38 This is the light fog detection image of apples using YOLOv5n described in Implementation Method 3;
[0078] Fig.39 This is the light fog detection image of apples using YOLOv7-Tiny as described in Implementation Method 3;
[0079] Fig.40 This is the light fog detection image of apples using YOLOv8n described in Implementation Method 3;
[0080] Fig.41 This is the light fog detection image of apples using YOLOv10n described in Implementation Method 3;
[0081] Fig.42 It is the light fog detection image of apple using YOLOv8y described in Implementation Method 3;
[0082] Fig.43 It is the original light mist apple detection image described in Implementation Method 3;
[0083] Fig.44 This is the apple detection image using EfficientDet in rainy weather as described in Implementation Method 3;
[0084] Fig.45 This is the apple detection image using YOLOv3-Tiny in rainy weather as described in Implementation Method 3;
[0085] Fig.46 This is the apple detection image using YOLOv5n in rainy weather as described in Implementation Method 3;
[0086] Fig.47 This is the apple detection image using YOLOv7-Tiny in rainy weather as described in Implementation Method 3;
[0087] Fig.48 This is the apple detection image using YOLOv8n in rainy weather as described in Implementation Method 3;
[0088] Fig.49 This is the apple detection image using YOLOv10n in rainy weather as described in Implementation Method 3;
[0089] Fig.50 This is the apple detection image using YOLOv8y in rainy weather as described in Implementation Method 3;
[0090] Fig.51 This is the original rainy apple detection image described in Implementation Method 3. DETAILED DESCRIPTION
[0091] The following will clearly and completely describe various embodiments of the present invention in conjunction with the accompanying drawings. The embodiments described with reference to the accompanying drawings are exemplary and intended to be used to explain the present invention, but should not be understood as limiting the present invention.
[0092] Implementation method 1: The method for detecting an image target based on YOLOv8y described in this implementation method is specifically as follows:
[0093] Determine the scale factor of YOLOv8y;
[0094] The image is sequentially input into the YOLOv8y backbone network, the YOLOv8y neck-bidirectional feature pyramid structure network and the YOLOv8y head network to detect the target;
[0095] In the YOLOv8y backbone network, the image is sequentially subjected to V7 Downsampling and multiple cascaded V7Downsampling and C2f for feature extraction, and feature images of multiple scales are output respectively;
[0096] The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs fused feature images of multiple scales;
[0097] The PIoUv2 loss function in the YOLOv8y head network detects the target based on the fused feature images of multiple scales;
[0098] Prune and adjust YOLOv8y in sequence.
[0099] In this implementation, the scaling factor for determining YOLOv8y is specifically:
[0100] The scaling factors of YOLOv8y include widen factor, deepen factor, ratio, parameters and FLOPs;
[0101] Among them, the widen factor is 0.16, the deepen factor is 0.33, the ratio is 2.0, the parameters are 1.53, and the FLOPs is 4.4.
[0102] In this implementation manner, the V7 Downsampling is specifically:
[0103] The image is divided into a first image and a second image. The feature image after the number of channels output by the first image is adjusted is concatentated with the feature image output by the second image to output a feature image with multiple feature information.
[0104] In this implementation manner, the feature image after the number of channels of the first image output is adjusted is concat with the feature image of the second image output, specifically:
[0105] The first image is pooled by MaxPool, and the pooled feature image is output. The number of channels of the pooled feature image is adjusted by Conv, and the feature image with adjusted channel number is output. The second image is subjected to feature extraction by multiple Convs, and the feature image is output. The feature image with adjusted channel number output by the first image is concat with the feature image output by the second image.
[0106] In this embodiment, the bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network is specifically:
[0107] The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network includes multiple Upsamples and multiple Downsamples.
[0108] In this embodiment, the bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs the fused feature images of multiple scales, specifically:
[0109] The feature images of the multiple scales are respectively a feature image of a first scale, a feature image of a second scale, a feature image of a third scale and a feature image of a fourth scale;
[0110] In the YOLOv8y neck-feature pyramid structure network, the feature image of the first scale is sequentially Downsampled, C2f, multiple Upsamples, C2f, multiple Downsamples, and C2f to be fused with the feature image of the second scale, the feature image of the third scale, and the feature image of the fourth scale, and the fused feature images of multiple scales are output.
[0111] In this implementation, the PIoUv2 loss function is specifically:
[0112] ;
[0113] in, is the PIoUv2 loss function, is the PIoUv1 loss function, is a non-monotonic attention function, is a hyperparameter, is the mass of the anchor box.
[0114] In the existing technology, the accuracy of image target detection will decrease when facing challenges such as complex growth environment, unstable lighting and weather changes.
[0115] To solve the above technical problems, Figure 1 As shown, this embodiment designs a YOLOv8y (the 8yth version of YOLO), and detects image targets based on YOLOv8y, specifically:
[0116] The YOLOv8y is a smaller network than YOLOv8n (the 8nth version of YOLO), YOLOv8s (the 8sth version of YOLO), YOLOv8m (the 8mth version of YOLO), and YOLOv8l (the 8lth version of YOLO), such as Figure 2 As shown in the figure, the detailed information of the scaling factors of YOLOv8y, YOLOv8n, YOLOv8s, YOLOv8m and YOLOv8l are listed respectively. Specifically, YOLOv8y adjusts the widen factor, deepen factor, ratio, Parameters (M) and FLOPs (G) respectively. The widen factor changes the width of the network by adjusting the number of channels per layer, the deepen factor affects the depth of the network by setting the number of repetitions of certain modules, and the ratio is used to adjust the number of channels in the high-level feature map at the end of the network. Parameters (M) refers to the total number of parameters of the model, in millions (M), and FLOPs (G) indicates the number of floating-point operations that the model needs to perform per second, in billions (G). Among them, the widen factor of YOLOv8y is 0.16, the deepen factor is 0.33, the ratio is 2.0, the Parameters (M) is 1.53 M, and the FLOPs (G) is 4.4G. For YOLOv8n, YOLOv8s, YOLOv8m, and YOLOv8l, the scaling factor details are as follows: Figure 2As shown, it will not be described in detail here. Therefore, this embodiment reduces the computational requirements while maintaining sufficient accuracy by further adjusting the scaling factor of YOLOv8y.
[0117] like Figure 1 As shown in the figure, in the YOLOv8y backbone network, first, the image is input to V7 Downsampling (V7 downsampling) to gradually extract the feature image, and each time the image passes through V7 Downsampling, a smaller feature image will be generated. The special image passes through four cascaded levels of V7 Downsampling and C2f, and the feature image passes through the first three cascaded levels of V7Downsampling and C2f to output the first scale feature image, the second scale feature image and the third scale feature image respectively. After the third scale feature image passes through the last cascaded level of V7 Downsampling and C2f, it is feature fused through SPP (spatial pyramid pooling) to aggregate context information from different scales and output the fourth scale feature image.
[0118] In the existing technology, the downsampling of YOLOv8 is 3×3 convolution kernel, stride 2, batch normalization and SiLU activation function (activation function of Sigmoid linear unit). However, in practical applications, since the computing power of the device is usually limited, this may lead to the performance degradation of YOLOv8. Especially in complex scenes, the number of image objects is huge and redundant information is scarce. Therefore, the loss of fine-grained information will significantly affect the detection performance of the model.
[0119] To solve the above technical problems, this implementation method designs V7 Downsampling, such as Figure 3 As shown in the figure, the image is divided into the first image and the second image. The first image is subjected to the 2×2 kernel and the MaxPool (maximum pooling) operation with a stride of 2 to reduce the spatial size of the feature map while retaining important features. Subsequently, the number of channels of the feature image after pooling is adjusted through the 1×1 Conv (convolution layer) to enhance the feature representation. The second image is subjected to the 1×1 Conv, and further to the 3×3 Conv with a stride of 2 to achieve a deeper level of Downsampling and extract richer spatial information. Finally, the feature image after the number of channels of the first image output is adjusted, and the feature image output by the second image is concat (splicing) in the channel dimension to form a feature image that integrates multiple feature information. Therefore, V7 Downsampling effectively combines the MaxPool and Conv operations, improves the feature extraction capability and optimizes the computational complexity.
[0120] By using V7 Downsampling, this implementation effectively overcomes the problem of fine-grained information loss in YOLOv8 when processing complex scenes, and significantly improves the performance of YOLOv8y described in this implementation for image target detection in complex environments.
[0121] In order to verify the performance of the backbone network of YOLOv8y reduced by using V7 Downsampling, this implementation uses different lightweight networks to reconstruct the backbone. The experimental results are shown in Fig.10 As shown. These models include a variety of lightweight backbone networks of YOLOv8n, such as Shufflenetv2 (backbone network of YOLOv8n), Vanillant (backbone network of YOLOv8n), Gost (backbone network of YOLOv8n) and EfficientNetv2 (backbone network of YOLOv8n), all of which integrate lightweight backbone networks into YOLOv8n to reduce computational complexity and parameter quantity. However, in comparison, the YOLOv8y described in this embodiment exhibits the most outstanding performance among these models. The YOLOv8y achieves 89.0% and 66.26% on mAP50 and mAP50-95, respectively, significantly surpassing other models that integrate lightweight backbone networks. Its Parameters (M) is 0.61M, which is significantly lower than other models, reducing storage requirements and computational complexity. Although YOLOv8y's FLOPs (G) is 3.2G, slightly higher than some other models, its Parameters (M) and Weight (M) effectively control the actual computational overhead and optimize computational efficiency. In addition, YOLOv8y's Weight (M) is only 1.5M, which makes it perform particularly well in resource-constrained environments (such as edge computing devices or mobile devices).
[0122] In the YOLOv8y neck-bidirectional feature pyramid structure network, such as Figure 1 As shown in the figure, the feature image of the fourth scale is upsampled, and each time the low-resolution feature image is upsampled to a higher resolution to restore part of the spatial information, it is input into Upsampling together with the feature image of the third scale after Conv again, and then input into C2f for feature fusion to output the feature image. After the feature image is upsampling, it is input into Fusion together with the feature image of the second scale after Conv, and then it is input into C2f together with the feature image of the first scale after Downsampling and the feature image of the second scale after Conv, so as to combine the high-resolution detail information with the low-resolution global information and output the fused feature image.
[0123] Afterwards, the fused feature image is subjected to Fusion and C2f to output the fused feature image of the first scale. The fused feature image of the first scale continues the Downsampling operation to further reduce the size of the feature image to obtain more global context information. It is then input into Fusion together with the feature image and the feature image of the third scale after Conv, and then output through C2f to output the fused feature image of the second scale. The fused feature image of the second scale continues the Downsampling operation, and is input into Fusion together with the feature image of the fourth scale after Conv, and then through C2f to output the fused feature image of the third scale.
[0124] In short, after each Upsampling and Downsampling operation, the feature image will be merged through Fusion. After multiple Upsampling, multiple Downsampling and Fusion, the feature image output by the YOLOv8y neck-bidirectional feature pyramid structure network contains information from different scales.
[0125] In the existing technology, during the downsampling process of YOLOv8n's FPN (Feature Pyramid Network), the detailed information of the deep feature map may be lost, thereby affecting the detection accuracy of small objects.
[0126] To solve the above technical problems, this implementation method designs a bidirectional feature pyramid structure network, such as Figure 4 As shown in the figure, B1, B2, B3, B4, B5, P3, P4, N4 and N5 are all feature layers, U is Upsampling, D is Downsampling, and C is Conat. The bidirectional feature pyramid structure network is mainly reflected in the bidirectional connection between different feature layers, especially in the P4 and P3 feature layers. The arrows indicate the connection in the up and down directions, indicating that the feature image is both Upsampling and Downsampling. This bidirectional flow structure is the core of the bidirectional feature pyramid structure network. It can more effectively integrate features of different scales, improve the detection accuracy and the robustness of the model, and solve the problem of information loss in small object detection.
[0127] The bidirectional feature pyramid structure network is fused with the YOLOv8y neck network, and has the following advantages in the processing of feature images: 1) Optimized feature transfer: In the process of feature image transfer, the bidirectional feature pyramid structure network designs a top-down and bottom-up bidirectional transfer path, so that low-level features can be more effectively fused with high-level features, ensuring that the detailed information in the image is preserved; 2) Learnable weight adjustment: Each fusion stage uses learnable weights, so that the network can dynamically adjust the importance of features at different levels according to the difference in input data during feature fusion. These weights are specific learnable parameters in the network, and the initial values are set to be equally distributed, but as the training process progresses, the network continuously updates them through back propagation, so that the contribution of low-level detail information and high-level semantic information in different tasks or scenarios is optimally balanced. Through this dynamic weighting method, the network can optimize the flow of information, strengthen useful information, and suppress irrelevant features, thereby improving the fusion effect and ultimately improving the overall performance of the model; 3) Multi-scale feature image integration: The bidirectional feature pyramid structure network effectively integrates feature images of different scales, enhances the detection ability of targets of different sizes, and especially improves the detection accuracy of small objects in complex scenes; 4) Modular design of processing methods: Each processing module is optimized to ensure that important information is retained to the greatest extent during the feature transmission process. This design improves the overall detection accuracy of the model while reducing the computational complexity.
[0128] In the YOLOv8y head network, such as Figure 1 As shown in the figure, the fused feature image of the first scale, the fused feature image of the second scale, and the fused feature image of the third scale are respectively input into three detection branches of different scales, which are used to detect large objects and small objects respectively. The detection branch is composed of convolution-batch normalization-activation and two-dimensional convolution layers. Through multi-scale detection, the model can identify multiple types of objects in the image and mark their locations.
[0129] In existing head networks, image object detection is usually based on the IoU loss function (intersection over union loss function) to quantify the overlap between the predicted box and the true value box. However, this method has several major shortcomings in practical applications: when the predicted box and the target box have no overlap at all, the gradient of the IoU loss function will become zero, making it difficult for the model to obtain effective learning signals. In the early stages of regression, the IoU loss function usually causes the anchor box to expand unnecessarily, increasing the complexity of the regression process and possibly slowing down the convergence of the model. In addition, the existing IoU loss function is difficult to effectively distinguish between high-quality and low-quality anchor boxes, resulting in the model being unable to fully utilize high-quality anchor boxes during training, thereby affecting the detection accuracy. In order to solve the above technical problems, the PIoUv1 loss function (intersection over union v1 loss function) proposes a penalty factor that is adjusted according to the relative size of the anchor box and the target box. This penalty factor minimizes the unnecessary expansion of the anchor box by guiding the anchor box to regress directly to the target box, thereby improving the efficiency of the regression process. At the same time, the PIoUv1 loss function introduces a gradient adjustment function to optimize the regression path, ensuring that the anchor box can be aligned with the target box along a path that is close to a straight line, reducing the training cycle required for the model to converge.
[0130] Based on the successful solution of the detection problem by the PIoUv1 loss function, the PIoUv2 loss function further combines the advantages of the EIoU loss function (enhanced intersection-over-union loss function), the SIoU loss function (sparse intersection-over-union loss function) and the WIoU loss function (bounding box regression loss function) to meet the challenges of image target detection in complex environments. Specifically, the EIoU loss function enhances the sensitivity to target boundaries by introducing geometric information, enabling it to more accurately identify the shape of image targets. The SIoU loss function focuses on the distance between the target box and the true box, especially in the detection of small objects. This is particularly critical for detection when the image target is occluded or the illumination changes. The WIoU loss function improves the model's adaptability to complex scenes by weighting different targets. In addition, one of the key improvements of the PIoUv2 loss function is the introduction of a single hyperparameter The non-monotonic attention mechanism controlled by this single hyperparameter It is used to adjust the behavior of the attention function to achieve more effective focus on medium-quality anchor boxes, improve the detection performance of the model, enable the model to better distinguish between high-quality and low-quality anchor boxes, optimize the ability to distinguish between different image targets, and thus improve the accuracy of detection.
[0131] The PIoUv2 loss function comprehensively considers the geometric shape, sparsity and relative position relationship of the image target in the loss calculation, which significantly improves the detection accuracy and robustness, especially in complex environments. The non-monotonic attention mechanism enhances the model's attention to medium-quality anchor boxes during bounding box regression, further improving the performance of image target detection in complex environments.
[0132] The expression of PIoUv2 loss function is:
[0133] ;
[0134] in, ;
[0135] ;
[0136] ;
[0137] in, is the PIoUv2 loss function, is the PIoUv1 loss function, is a non-monotonic attention function that controls the focus adjustment mechanism in the loss function. The function is to increase the attention to medium-quality anchor boxes, thereby improving the regression performance of the model. It is a The nonlinear function of , enhances the ability to focus on medium-quality anchor boxes. is a hyperparameter used to control the attention function By adjusting λ, the degree of attention paid by the PIoUv2 loss function to anchor frames of different qualities can be adjusted, thereby optimizing the performance of the loss function. is the quality of the anchor box, its value range is (0,1], when = 1, which means that the anchor box and the target box completely overlap. When the quality of the anchor box decreases, The value also decreases accordingly. This parameter is used to measure the matching degree between the anchor box and the target box. is the intersection-over-union loss, which measures the overlap between the anchor box and the target box. is the penalty term in the loss, considering the shape difference between the anchor box and the target box, is an enhanced IoU loss function, is the variable in the attention function, indicating the value of the anchor box quality after hyperparameter adjustment. It is a penalty factor used to measure the size and shape difference between the anchor box and the target box to ensure that the anchor box will not be unreasonably enlarged during regression.
[0138] Therefore, the PIoUv2 loss function not only reduces the number of hyperparameters by introducing a non-monotonic attention mechanism, but also effectively solves the anchor box expansion problem, significantly improving the performance and robustness of the model.
[0139] Before pruning, Figure 6 As shown, this embodiment introduces different IoU loss functions, namely DIoU loss function (distance intersection loss function), EIoU loss function, GIoU loss function (generalized intersection loss function), SIoU loss function, CIoU loss function (comprehensive intersection loss function), SHAPEIoU loss function (shape intersection loss function) and PIoUv2 loss function, to further verify the reliability of the model. Although in the comparative experiment, various IoU loss functions showed similarities in the trend of loss decrease, the performance of PIoUv2 loss function was particularly outstanding. The scores of PIoUv2 loss function on mAP50 and mAP50-95 indicators were 88.67% and 65.59%, respectively, which were significantly higher than other IoU variants, indicating that it has higher accuracy in bounding box prediction. In particular, in the image target detection described in this embodiment, the PIoUv2 loss function better handles the complex situation of image targets and improves the detection accuracy and stability of the model in the actual environment.
[0140] like Figure 7 The bounding box loss shown in the figure, where the horizontal axis is epochs (the number of iterations of training) and the vertical axis is the loss value, shows that different IoU loss functions perform differently during training. All loss function values dropped significantly, indicating that the model is continuously learning and optimizing. In the middle of training, the loss curves of various IoU loss functions tend to overlap, indicating that they perform similarly in optimizing bounding box prediction. For example, the loss values of DIoU loss function, EIoU loss function, GIoU loss function, CIoU loss function, SIoU loss function, and SHAPEIoU loss function are almost the same in some training stages, showing that these loss functions have similar effects when the model tends to stabilize. However, the PIoUv2 loss function performs particularly well in image target detection. Its loss value drops rapidly at the beginning of training and remains at the lowest level throughout the training process, which not only accelerates the convergence of the model, but also significantly improves the prediction accuracy of the image target bounding box. The PIoUv2 loss function can better handle the problem of objects in complex environments, so that the model can still work stably in complex real environments. In contrast, although other IoU loss functions, such as DIOU loss function, EIOU loss function, and GIOU loss function, also decline rapidly in the early stage, their loss values are slightly higher than those of PIoUv2 loss function in the later stage, which further proves that PIoUv2 loss function has unique advantages in improving the accuracy and stability of image target detection.
[0141] In order to verify the impact of the channel pruning algorithm on YOLOv8y, this implementation method compares and analyzes the performance of YOLOv8y before and after pruning. Fig. 9 As shown in the figure, the yellow part represents the number of channels of the unpruned YOLOv8y, denoted as Model-3, and the red part represents the number of channels of the pruned YOLOv8y. The number of channels in each layer of Model-3 ranges from as many as 80 channels to as few as 10 channels. After pruning, the number of channels in these layers is significantly reduced. Figure 8 As shown in the figure, compared with Model-3, the Parameters (M) of the pruned YOLOv8y is reduced from 0.98M to 0.611M, a reduction of about 37.65%. At the same time, FLOPs (G) is reduced from 4.4G to 3.3G, and the Weight (M) size is reduced from 2.1M to 1.5M, indicating that the pruned YOLOv8y significantly reduces the complexity and storage requirements.
[0142] like Figure 8 As shown in the figure, although the mAP50 value of the pruned YOLOv8y dropped from 88.68 to 75.33%, the mAP50-95 remained at 49.81%, indicating that the pruned YOLOv8y still has good detection performance at a lower complexity. In order to further optimize the pruned YOLOv8y, the pruned YOLOv8y is fine-tuned to restore or improve the performance of the model. The fine-tuning is to train the pruned YOLOv8y from scratch, that is, to perform a complete training cycle on the model again. The mAP50 value of the YOLOv8y is restored to 89.0%, and the mAP50-95 is increased to 66.26%, indicating that YOLOv8y not only restores the detection accuracy, but even surpasses Model-3 in mAP50-95. Therefore, while greatly reducing Parameters (M) and FLOPs (G), the channel pruning technology can maintain or even improve the detection accuracy through subsequent optimization steps, making the generated simplified model more computationally efficient and occupying less storage space.
[0143] In summary, this implementation adjusts the scale factor of YOLOv8, uses V7 Downsampling in the backbone network, introduces a bidirectional feature pyramid network structure in the neck network, and uses the PIOUv2 loss function to optimize the model. Finally, the redundant complexity of the model is reduced by pruning to obtain YOLOv8y, and image targets in complex environments are detected based on YOLOv8y, which effectively improves the detection effect.
[0144] In order to better illustrate the performance of YOLOv8y, the following Figure 5Verification shown. Only the scaling factor YOLOv8y is introduced as Model-0. The Parameters (M) of Model-0 is 1.53M, which is 49.2% less than that of YOLOv8n. The FLOPs (G) of YOLOv8y is 4.4 G, which is 46.3% less than that of YOLOv8n. However, the performance is slightly reduced. The mAP50 (mean average precision 50) of Model-0 is 87.89%, which is 0.78% less than that of YOLOv8n, and the mAP50-95 is 64.78%, which is 1.23% less than that of YOLOv8n.
[0145] After adding the bidirectional feature pyramid structure network, YOLOv8y is denoted as Model-1. Its Parameters (M) are further reduced to 1.06M, and FLOPs (G) remains at 4.4G. At the same time, mAP50 and mAP50-95 are improved by 0.2% and 0.18% respectively compared with YOLOv8y without adding the bidirectional feature pyramid structure network.
[0146] The YOLOv8y with V7 Downsampling was introduced, denoted as Model-2, which improved the feature extraction efficiency, making mAP50 and mAP50-95 increase by 0.15% and 0.2% respectively compared with Model-1, Parameters (M) was reduced to 0.98M, and FLOPs (G) remained at 4.4G.
[0147] Model-3 integrates YOLOv8y with adjusted scale factor, bidirectional feature pyramid structure network, V7 Downsampling and PIoUv2. With Parameters (M) and FLOPs (G) of 0.98M and 4.4G respectively, mAP50 is improved to 88.67% and mAP50-95 is improved to 65.59%.
[0148] After pruning, YOLOv8y, denoted as Model-4, increased mAP50 to 89.0%, while mAP50-95 increased to 66.26%, Parameters (M) reduced to 0.61M, and FLOPs (G) reduced to 3.2G.
[0149] These results show that despite the significant reduction in the model’s Weight (M), Model-4 still achieves improved detection performance, fully demonstrating the superiority of the lightweight design.
[0150] Implementation method 2: The image target detection system based on YOLOv8y described in this implementation method is specifically as follows:
[0151] Determine the scale factor of YOLOv8y;
[0152] The image is sequentially input into the YOLOv8y backbone network, the YOLOv8y neck-bidirectional feature pyramid structure network and the YOLOv8y head network to detect the target;
[0153] In the YOLOv8y backbone network, the image is sequentially subjected to V7 Downsampling and multiple cascaded V7Downsampling and C2f for feature extraction, and feature images of multiple scales are output respectively;
[0154] The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs fused feature images of multiple scales;
[0155] The PIoUv2 loss function in the YOLOv8y head network detects the target based on the fused feature images of multiple scales;
[0156] Prune and adjust YOLOv8y in sequence.
[0157] Implementation method three: The apple fruit detection method in a complex weather orchard environment described in this implementation method, the detection method is based on the image target detection method based on YOLOv8y described in implementation method one to realize the detection of apple fruits.
[0158] This implementation is based on the YOLOv8y described in the first implementation to detect apple fruits in a complex weather orchard environment. In order to effectively cope with the apple detection task in a complex environment, the apple image described in this implementation is processed through data enhancement to create an apple dataset suitable for complex weather conditions.
[0159] like Fig.11As shown, this embodiment evaluates the performance of seven mainstream target detection models in apple target detection and counting tasks, including YOLOv3-tiny (YOLOv3-micro version), YOLOv5n (YOLO's 5nth version), YOLOv7-tiny (YOLOv7-micro version), YOLOv8, YOLOv10n (YOLO's 10nth version), YOLOv8y described in Implementation 1, and EfficientDet (efficient detection model). The evaluation indicators include mAP50, mAP50-95, Parameters (M), FLOPs (G), and Weigh (M). The results show that VBP-YOLO-prune performs best among all the evaluated models, with mAP50 reaching 89%, mAP50-95 being 66.26%, and only requiring 0.61M Parameters (M) and 3.2G FLOPs (G), showing extremely high computational efficiency and accuracy. This shows that the model has significant application advantages in resource-constrained environments, such as embedded systems or mobile devices. YOLOv5n showed good performance in the apple target detection task, with its mAP50 reaching 88.08% and mAP50-95 being 62.1%. YOLOv5n only requires 1.76M Parameters (M) and 4.2G FLOPs (G). However, compared with YOLOv8y, YOLOv5n's performance still lags behind. In contrast, EfficientDet performed less well in the apple detection task. Its mAP50 is only 43.33%, and its mAP50-95 is only 29.76%, which may be related to the fact that its network structure is not adapted to the specific needs of apple target detection, such as the diversity and density of target scales. In addition, EfficientDet's Parameters (M) and FLOPs (G) are both relatively high, at 15.0M and 5.23G respectively, further limiting its application in real-time detection tasks. It is worth noting that YOLOv8 and YOLOv10n also performed very well on mAP50 and mAP50-95, reaching 88.68% and 66.01%, and 87.96% and 65.11% respectively. Although its Parameters (M) and FLOPs (G) are slightly larger than those of YOLOv8y, they are still within an acceptable range and are suitable for use in scenarios requiring high-precision detection. In general, YOLOv8y, with its lightweight and high-precision characteristics, is the most suitable model for Apple's target detection tasks, especially in application scenarios that are sensitive to computing resources.
[0160] Based on the above experimental results, it is obvious that the YOLOv8y used in this experiment shows high accuracy. In order to evaluate the robustness of the model in detecting apples in complex environments, a comparative visual analysis was performed. The analysis distinguishes between correctly detected boxes and missed detection cases, represented by oval white boxes. It is worth noting that since this experiment simulates the counting and picking of apples in an orchard, there will inevitably be apples in the distance for fallen apples and photo collection, so these two situations are not included in the evaluation to ensure that this implementation can evaluate the effectiveness of fruit detection in four different scenarios.
[0161] This implementation constructs a dataset containing 1,550 apple images and simulates complex environments such as rainy days, weak light, and strong light through data augmentation technology to enhance the generalization ability of the model.
[0162] 1) Apple detection in normal weather:
[0163] like Figure 12-Figure 19 As shown in Figure 1, the detection effect of different object detection models on apples under normal weather conditions is shown, for example, EfficientDet, YOLOv3-Tiny, YOLOv5n, YOLOv7-Tiny, YOLOv8n, YOLOv10n, and YOLOv8y. A graph without annotations is also provided. Fig.19 The original image is shown for reference. Fig.12 As shown in Figure 2, EfficientDet has poor detection performance, only detecting a few apples correctly, and has problems with missing and repeated detections. Fig.13 As shown in , although YOLOv3-Tiny can capture more apples, it generates multiple overlapping and redundant bounding boxes, resulting in a high false positive rate. Figure 14-17 As shown in Figure 1, YOLOv5n, YOLOv7-Tiny, YOLOv8n, and YOLOv10n also missed detections during the detection process. In particular, the color of some apples is very similar to the color of leaves, making it difficult for the model to accurately distinguish them, resulting in missed detections. This color similarity has a negative impact on the detection accuracy of the model. In contrast, Fig.18 As shown, YOLOv8y demonstrates higher detection efficiency and accuracy after optimization and pruning, showing significant improvements.
[0164] 2) Apple detection in low light at dusk:
[0165] like Figure 20-Figure 27 As shown, Fig. 27 The original image is shown for reference. Comparison of the fruit detection results under dim or backlit conditions shows that Fig. 20As shown in Figure 1, the EfficientDet model shows low detection accuracy in low-light environments, especially when the background color is similar to that of the apple. Since low contrast exacerbates the situation of similar colors, the detection effect of EfficientDet is significantly limited, resulting in a decrease in detection accuracy. Fig.21 As shown in Figure 1, YOLOv3-Tiny detects more apples in low light conditions, but its high false positive rate is significant, especially in the overlapping and redundant bounding box issues, which affects the accuracy of apple detection. Figure 23-Figure 25 As shown in the figure, YOLOv7-Tiny, YOLOv8n, and YOLOv10n showed good detection capabilities in low-light conditions and were able to identify more apples, but there were still a small number of missed detections and false detections. In particular, YOLOv7-Tiny made two false detections and misidentified the tree trunk as an apple. This is because in a low-light environment, the color of the tree trunk is very close to that of the apple, which makes it impossible for the model to accurately distinguish them. YOLOv8n had one re-detection and two false detections, and YOLOv10n had one re-detection and one missed detection. In contrast, Fig.24 and Fig.26 As shown in the figure, YOLOv8y and YOLOv5n have the best detection effect in low-light environments. In particular, YOLOv8y is lighter than YOLOv5n while maintaining high detection accuracy, which enables it to provide superior performance under limited computing resources. Although YOLOv5n performs well, YOLOv8y's lightweight advantage gives it a clear advantage in processing speed and resource consumption, especially for application scenarios with efficient detection.
[0166] 3) Apple detection simulating strong light in the early morning:
[0167] like Figure 28-Figure 35 As shown, Fig.35 The original image is shown for reference. Under strong light conditions, all models showed some misdetection in the detection of plants with similar colors. The blurred outline of small fruits in the distance further increased the difficulty of detection. Fig.28 As shown in Figure 1, EfficientDet only detects four apples, which is far from meeting the actual deployment requirements. Fig.29 As shown in the figure, YOLOv3-Tiny has two re-tests and the detection effect is not good when facing a bunch of apples. Fig.30 As shown, YOLOv5n has a false detection, such as Figure 31-Figure 32 As shown in the figure, YOLOv7-Tiny and YOLOv8n detect the iron rod in the picture as an apple, and misjudge an obscured apple as two apples. Fig.33As shown in Figure 2, YOLOv10n made two obvious mistakes. One was misjudging one apple as two apples, and the other was missing apples due to overlapping apples. In contrast, Fig.34 As shown in the figure, YOLOv8y performs best under simulated early morning strong light conditions and can effectively identify most apples, demonstrating superior detection capabilities and adaptability.
[0168] 4) Apple detection in complex weather conditions such as light fog and rainy days:
[0169] like Figure 36-Figure 43 As shown, Fig.43 The original image is shown for reference. In light fog conditions, such as Fig.36 As shown in Figure 2, EfficientDet performs the worst, as low contrast and blurred background make fruit recognition difficult. Fig.40 As shown in Figure 2, YOLOv8n also performed poorly, with two re-tests and one missed test. Figure 37-Figure 38 As shown in Figure 1, YOLOv3-Tiny and YOLOv5n each have one missed detection and one re-detection under light fog conditions. Fig.39 and Fig.41 As shown in Figure 2, YOLOv7-Tiny and YOLOv10n each made one error in counting, which affected their reliability in practical applications. Fig.42 As shown, YOLOv8y performs best in light fog conditions and can accurately detect all fruits, showing superior feature extraction capabilities and positioning accuracy.
[0170] like Figure 44-Figure 51 As shown, Fig.51 The original image is shown for reference. This experiment chooses to simulate a light rain situation for testing, because the orchard work cannot be carried out in heavy rain. In this environment, the detection performance of each model is as follows: Fig.49 As shown in the figure, although YOLOv10n performs well and successfully detects apples that other models missed, its overall performance is still insufficient. YOLOv10n missed three detections, mainly because the apples were blocked by leaves and could not be accurately detected. Fig.50 As shown in the figure, YOLOv8y performs well. Although there is one missed detection, it still has a significant advantage over other models. The number of apples detected by this model is closest to the actual situation, showing strong feature extraction and target positioning capabilities. This shows that YOLOv8y is more robust than other models in complex environments. Fig.44 As shown in Figure 2, EfficientDet performs worst under rainy conditions, detecting only four apples and missing a large number of targets. Low contrast and rain interference have a significant impact on its detection ability. Fig.45As shown in Figure 1, YOLOv3-Tiny has obvious re-detection phenomenon in rainy environment, and multiple overlapping bounding boxes show its shortcomings in complex background. Figure 46-Figure 48 As shown in the figure, YOLOv5n, YOLOv7-Tiny, and YOLOv8n all show a certain degree of false detection and counting errors in rainy environments. Although they can detect some apples, their accuracy and stability are not as good as YOLOv8y and YOLOv10n.
[0171] In summary, this embodiment is based on a lightweight detection algorithm YOLOv8y, which has made several key improvements based on YOLOv8n. First, although YOLOv8n is the smallest network in the YOLOv8 series, it still shows a certain redundancy in the apple detection task. This is because YOLOv8n is designed to meet the needs of general target detection tasks, and there may be problems of over-computation for single-category detection tasks. Therefore, the network size is further reduced. Secondly, by introducing V7Downsampling and a bidirectional feature pyramid structure network, the bidirectional feature pyramid structure network not only supports top-down feature transfer, but also allows features to be transferred from low layers to high layers in reverse. This bidirectional information flow design, combined with a learnable weight optimization feature fusion process, overcomes the limitations of the unidirectional information flow and fixed weight feature fusion methods in YOLOv8n, enhances the adaptability of the network in different task scenarios, and thus optimizes the feature extraction and multi-scale feature fusion process. In addition, the PIoUv2 loss function is used to improve positioning accuracy. Finally, the model is streamlined in combination with the pruning algorithm to form YOLOv8y. Experimental results show that YOLOv8y significantly reduces the model complexity while maintaining high detection accuracy.
[0172] The image target detection method and system based on YOLOv8y proposed in the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. The image target detection method based on YOLOv8y is characterized by: Specifically: Determine the scale factor of YOLOv8y; The image is sequentially input into the YOLOv8y backbone network, the YOLOv8y neck-bidirectional feature pyramid structure network and the YOLOv8y head network to detect the target; In the YOLOv8y backbone network, the image is sequentially subjected to V7 Downsampling and multiple cascaded V7Downsampling and C2f for feature extraction, and feature images of multiple scales are output respectively; The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs fused feature images of multiple scales; The PIoUv2 loss function in the YOLOv8y head network detects the target based on the fused feature images of multiple scales; Prune and adjust YOLOv8y in sequence; The scaling factor for determining YOLOv8y is specifically: The scaling factors of YOLOv8y include widen factor, deepen factor, ratio, parameters and FLOPs; Among them, the widen factor is 0.16, the deepen factor is 0.33, the ratio is 2.0, the parameters are 1.53, and the FLOPs is 4.
4.
2. The method for detecting an image target based on YOLOv8y according to claim 1, characterized in that: The V7Downsampling is specifically: The image is divided into a first image and a second image. The feature image after the number of channels output by the first image is adjusted is concatentated with the feature image output by the second image to output a feature image with multiple feature information.
3. The image target detection method based on YOLOv8y according to claim 2, characterized in that: The feature image after the number of channels of the first image output is adjusted is concat with the feature image output by the second image, specifically: The first image is pooled by MaxPool, and the pooled feature image is output. The number of channels of the pooled feature image is adjusted by Conv, and the feature image with adjusted channel number is output. The second image is subjected to feature extraction by multiple Convs, and the feature image is output. The feature image with adjusted channel number output by the first image is concat with the feature image output by the second image.
4. The image target detection method based on YOLOv8y according to claim 1, characterized in that: The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network is specifically: The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network includes multiple Upsamples and multiple Downsamples.
5. The image target detection method based on YOLOv8y according to claim 1, characterized in that: The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs fused feature images of multiple scales, specifically: The feature images of the multiple scales are respectively a feature image of a first scale, a feature image of a second scale, a feature image of a third scale and a feature image of a fourth scale; In the YOLOv8y neck-feature pyramid structure network, the feature image of the first scale is sequentially Downsampled, C2f, multiple Upsamples, C2f, multiple Downsamples, and C2f to be fused with the feature image of the second scale, the feature image of the third scale, and the feature image of the fourth scale, and the fused feature images of multiple scales are output.
6. The method for detecting an image target based on YOLOv8y according to claim 1, characterized in that: The PIoUv2 loss function is specifically: in, is the PIoUv2 loss function, is the PIoUv1 loss function, u is the non-monotonic attention function, λ is the hyperparameter, and q is the quality of the anchor box.
7. Image target detection system based on YOLOv8y, characterized by: Specifically: Determine the scale factor of YOLOv8y; The image is sequentially input into the YOLOv8y backbone network, the YOLOv8y neck-bidirectional feature pyramid structure network and the YOLOv8y head network to detect the target; In the YOLOv8y backbone network, the image is sequentially subjected to V7 Downsampling and multiple cascaded V7Downsampling and C2f for feature extraction, and feature images of multiple scales are output respectively; The bidirectional flow structure in the YOLOv8y neck-bidirectional feature pyramid structure network fuses feature images of multiple scales and outputs fused feature images of multiple scales; The PIoUv2 loss function in the YOLOv8y head network detects the target based on the fused feature images of multiple scales; Prune and adjust YOLOv8y in sequence; The scaling factor for determining YOLOv8y is specifically: The scaling factors of YOLOv8y include widen factor, deepen factor, ratio, parameters and FLOPs; Among them, the widen factor is 0.16, the deepen factor is 0.33, the ratio is 2.0, the parameters are 1.53, and the FLOPs is 4.
4.
8. An apple fruit detection method under complex weather orchard environment, characterized in that: The detection method is based on the image target detection method based on YOLOv8y described in any one of claims 1-6 to realize the detection of apple fruits.
Citation Information
Patent Citations
Apple maturity detection method based on Swin Transform
CN117893823A
Target detection method, device and system and electronic equipment
CN118015413A