YOLOv4-based optimization method for rapidly identifying and detecting obstacles of all-grass of Chinese Ixeris

By optimizing the prior box re-clustering, pooling method, and network structure of YOLOv4, more adaptive anchor boxes are generated, unnecessary detection targets are removed, and pooling is performed using an exponentially weighted average filtering method. This solves the problem of slow detection speed of bitter lettuce obstacles in orchards by YOLOv4, and realizes real-time application and resource-efficient target recognition.

CN120877238APending Publication Date: 2025-10-31EAST CHINA AGRI-TECH CENTER OF CHINESE ACADEMY OF AGRICULTURAL SCIENCES +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510858629.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

The existing YOLOv4 is slow in detecting bitter lettuce obstacles in orchards, which makes it difficult to meet the needs of real-time applications and resource-constrained embedded systems, and the detection accuracy is also affected.

Method used

By optimizing YOLOv4's prior box re-clustering, pooling methods, and network structure, anchor boxes with stronger scale adaptability are generated, unnecessary detection targets are pruned, and pooling is performed using an exponentially weighted average filtering method to reduce the use of computational and memory resources.

Benefits of technology

It accelerates the target detection process, reduces the use of computing and memory resources, maintains high-quality target recognition results, and is suitable for embedded systems and resource-constrained devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120877238A_ABST
    Figure CN120877238A_ABST
Patent Text Reader

Abstract

The invention relates to a YOLOv4-based optimization method for rapid identification and detection of a sowthistle obstacle, and the method comprises the steps: initializing an anchor frame through employing a K-means algorithm, generating an anchor frame with higher scale adaptability, and enabling a model to be more suitable for the detection of slender sowthistle; aiming at network structure optimization of network scene particularity, cutting far all-grass of Chinese ixeris and near small all-grass of Chinese ixeris, and only stably detecting a close shot existing in each frame of image; in the optimization of a pooling mode, pooling is carried out by adopting an exponential weighted average filtering mode so as to reserve all useful information as much as possible. According to the method, the YOLOv4 is adopted to accurately detect the all-grass of Chinese Ixeris, optimization is carried out in three aspects of priori frame reclustering, a pooling mode and a network structure, and the optimized YOLOv4 can accelerate a target detection process, so that the method is suitable for real-time application, the use of calculation and memory resources is reduced, the method is suitable for an embedded system or equipment with resource limitation, and the detection efficiency of the all-grass of Chinese Ixeris is improved. The accuracy of target detection is not damaged as much as possible, and high-quality recognition of the target is kept.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural robot technology, specifically to an optimized method for rapid obstacle recognition and detection in bitter lettuce based on YOLOv4. Background Technology

[0002] To achieve autonomous driving for agricultural robots, they first need to be able to autonomously avoid obstacles and drive safely. In orchards, sow thistle is the most common obstacle. Due to the inconsistent clustering and growth patterns of sow thistle, it exhibits both rigid and flexible growth characteristics. Furthermore, from an image perspective, sow thistle cannot be consistently and accurately detected due to environmental influences. While YOLOv4 is suitable for both head-type and backbone networks, making it applicable to detecting sow thistle with its diverse growth forms in complex orchard scenarios, its detection speed is relatively slow, which may limit its performance, especially in resource-constrained embedded systems or real-time applications. Therefore, it is necessary to develop an optimized method for fast recognition and detection based on YOLOv4 to meet the requirements of real-time performance and resource efficiency. Summary of the Invention

[0003] The purpose of this invention is to overcome the problems existing in the prior art and provide an optimized method for fast recognition and detection of obstacles in *Hedysarum heterotropoides* based on YOLOv4. Optimizations have been made in three aspects: prior box re-clustering, pooling method, and network structure to accelerate the target detection process, making it suitable for real-time applications, reducing the use of computing and memory resources to adapt to embedded systems or devices with limited resources, minimizing the loss of target detection accuracy, and maintaining high-quality recognition of *Hedysarum heterotropoides*.

[0004] To achieve the above-mentioned technical objectives and effects, the present invention is implemented through the following technical solution:

[0005] An optimized method for fast obstacle recognition and detection in *Sonchus oleraceus* based on YOLOv4, the method comprising the following steps:

[0006] Step S1: Initialize anchor boxes using the K-means algorithm to generate anchor boxes with stronger scale adaptability, making the model more suitable for detecting slender bitter lettuce.

[0007] Step S2: Optimize the network structure to suit the specific characteristics of the network scene, remove distant sow thistle and nearby small sow thistle targets, and only perform near-field stability detection in each frame image;

[0008] Step S3: Optimize the pooling method by using an exponentially weighted average filtering method to retain as much useful information as possible.

[0009] Furthermore, the specific steps for initializing the anchor frame in step S1 are as follows:

[0010] Step S1.1: Randomly select 9 boxes as initial anchor boxes;

[0011] Step S1.2: Using the IOU metric, assign each box to the anchor box that is closest to it, where the IOU metric formula is as follows:

[0012]

[0013] In the formula, box represents the actual bounding box, centre represents the anchor box, and IOU represents the intersection-union ratio;

[0014] Step S1.3: Calculate the mean of the width and height of all boxes in each cluster, and update the anchor boxes;

[0015] Step S1.4: Repeat steps S1.2 and S1.3 until the selected anchor box no longer changes, or the maximum number of iterations is reached.

[0016] Furthermore, in step S2, the anchor boxes corresponding to the large-size feature maps are responsible for detecting small targets. Since small targets do not need to be detected, the largest feature map is deleted to reduce the number of prior boxes placed, thereby increasing the speed of inference.

[0017] The beneficial effects of this invention are:

[0018] This invention employs YOLOv4 for accurate detection of bitter lettuce and optimizes it in three aspects: prior box re-clustering, pooling method, and network structure. The optimized YOLOv4 can accelerate the target detection process, making it suitable for real-time applications, reducing the use of computing and memory resources to adapt to embedded systems or resource-constrained devices, minimizing the loss of target detection accuracy, and maintaining high-quality target recognition. Attached Figure Description

[0019] Figure 1 This is a flowchart of the optimization method of the present invention;

[0020] Figure 2 This is a diagram of the optimized YOLOv4 network structure according to the method of this invention.

[0021] Figure 3 This is a comparison chart of YOLOv4 after re-clustering optimization using the method of this invention and the standard YOLOv4;

[0022] Figure 4 This is a schematic diagram of the optimized anchor frame according to the method of the present invention;

[0023] Figure 5 The image shows the detection results of the method of the present invention, using bitter lettuce as an example. Detailed Implementation

[0024] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0025] An optimized method for fast obstacle recognition and detection in *Sonchus oleraceus* based on YOLOv4, such as... Figure 1 As shown, the method includes the following steps:

[0026] Step S1: Initialize anchor boxes using the K-means algorithm to generate anchor boxes with stronger scale adaptability, making the model more suitable for detecting slender bitter lettuce.

[0027] Step S2: Optimize the network structure for the specific network scene. Distant sow thistle and nearby small sow thistle targets will not interfere with the obstacle avoidance decision of the transport vehicle. By cropping the network output and deleting large feature maps, the network will not recognize such targets. That is, crop the distant sow thistle and nearby small sow thistle targets and only detect the near-field stability in each frame.

[0028] Step S3: Optimization of pooling method. To address the issue that maximum pooling can lead to the loss of important features, an exponentially weighted average filtering method is adopted for pooling to retain as much useful information as possible.

[0029] In step S1, the YOLOv4 preset prior box is obtained by K-means clustering on the COCO dataset. The COCO dataset contains objects of different sizes, and K-means re-clustering is performed on specific objects.

[0030] The specific steps involved in initializing the anchor frame are as follows:

[0031] Step S1.1: Randomly select 9 boxes as initial anchor boxes;

[0032] Step S1.2: Using the IOU metric, assign each box to the anchor box that is closest to it, where the IOU metric formula is as follows:

[0033]

[0034] In the formula, box represents the actual bounding box, centre represents the anchor box, and IOU represents the intersection-union ratio;

[0035] Step S1.3: Calculate the mean of the width and height of all boxes in each cluster, and update the anchor boxes;

[0036] Step S1.4: Repeat steps S1.2 and S1.3 until the selected anchor box no longer changes, or the maximum number of iterations is reached;

[0037] Taking the detection of bitter lettuce as an example, the anchor boxes after K-means clustering are shown in the table below: The training results obtained from re-clustering are as follows Figure 3 As shown, after re-clustering, the anchor boxes are more practical, thus increasing the F1 value of the optimized YOLOv4 by 5%.

[0038] In step S2, the method of the present invention does not require stable detection of distant obstacles when detecting *Hymenochloa crus-galli* obstacles; stable detection of near-field obstacles in each frame of the image is sufficient. Based on the principle of near objects appearing larger and far objects appearing smaller, small nearby targets do not pose a threat to the vehicle and are therefore not detected. Since the largest scale (76×76) has the smallest receptive field, the larger scale will detect small *Hymenochloa crus-galli* targets. The anchor frame obtained at the larger scale has already been obtained in step S1, and the anchor frame in the image is as follows: Figure 4 As shown, the anchor boxes corresponding to the large feature maps are responsible for detecting small targets, but small targets do not pose a threat to the car, so they do not need to be detected. Therefore, in the pruning optimization of YOLOv4, the large-scale output is pruned. By deleting the largest feature map, the number of prior boxes placed can be greatly reduced, which greatly increases the speed of inference.

[0039] Taking the detection of bitter lettuce as an example, the speed before and after deletion was compared, and the detection speed increased by 24.3%, as shown in the table below:

[0040] YOLOv4 increases the receptive field of the network through SPP (Max Pooling). However, max pooling, which selects the maximum value within a filter instead of the corresponding region within the filter, may result in the loss of useful information. In step S3, an exponentially weighted average filtering method is used for pooling, which can retain as much useful information as possible. The principle is shown in the table below: Compared to max pooling, exponentially weighted average pooling retains more information when downsampling activation mapping, and higher activations dominate, significantly reducing the risk of losing most of the information and thus improving accuracy.

[0041] The YOLOv4 network structure after the above three optimization steps is as follows: Figure 2 As shown, taking bitter lettuce as an example, the detection results based on the optimized YOLOv4 are as follows: Figure 5 As shown, because the network removes large-scale prior boxes, small targets in the foreground and small targets in the image view are no longer detected (red dashed box). After improvement, the network can achieve accurate detection of bitter lettuce, whether it is near, far or in the case of alternating occlusion and illumination shadows.

[0042] A comparison of the optimized YOLOv4 model using the method of this invention with the unoptimized YOLOv4 model is shown in the table below, taking the detection of bitter lettuce as an example:

[0043]

[0044] To further verify the differences between the proposed optimized method of this invention in YOLOv4 and other detection models, Fast R-CNN, SSD300, and YOLOv3 were compared, and P, R, F1, inference speed, and model size were compared. The results are shown in the table below: The real-time performance of the optimized YOLOv4 obtained by the method of this invention has a significant advantage over Fast R-CNN and SSD, and its accuracy has a significant advantage over the single-stage network YOLOv3 and the standard YOLOv4.

[0045] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An optimized method for rapid obstacle recognition and detection in *Sonchus oleraceus* based on YOLOv4, characterized in that, The method includes the following steps: Step S1: Initialize anchor boxes using the K-means algorithm to generate anchor boxes with stronger scale adaptability, making the model more suitable for detecting slender bitter lettuce. Step S2: Optimize the network structure to suit the specific characteristics of the network scene, remove distant sow thistle and nearby small sow thistle targets, and only perform near-field stability detection in each frame image; Step S3: Optimize the pooling method by using an exponentially weighted average filtering method to retain as much useful information as possible.

2. The optimized method for rapid obstacle recognition and detection in *Sonchus oleraceus* based on YOLOv4 according to claim 1, characterized in that, In step S1, the specific steps for initializing the anchor frame are as follows: Step S1.1: Randomly select 9 boxes as initial anchor boxes; Step S1.2: Using the IOU metric, assign each box to the anchor box that is closest to it, where the IOU metric formula is as follows: In the formula, box represents the actual bounding box, centre represents the anchor box, and IOU represents the intersection-union ratio; Step S1.3: Calculate the mean of the width and height of all boxes in each cluster, and update the anchor boxes; Step S1.4: Repeat steps S1.2 and S1.3 until the selected anchor box no longer changes, or the maximum number of iterations is reached.

3. The optimized method for rapid obstacle recognition and detection in *Sonchus oleraceus* based on YOLOv4 according to claim 2, characterized in that, In step S2, the anchor boxes corresponding to the large feature maps are responsible for detecting small targets. Small targets do not need to be detected. The largest feature map is deleted to reduce the number of prior boxes placed, thereby increasing the speed of inference.

Citation Information

Cited By

  • Yolov4-based optimization method for rapid identification and detection of field sowthistle obstacles

    WO2026124112A1