Target area detection method based on YOLO

Through the target area detection method based on YOLO, we build a target and area detection network, generate and correct detection frames, solve the problem of inaccurate target position judgment under changing viewing angles, improve detection accuracy, and are suitable for unconventional proportions of multi-scale targets. detection.

CN118736200APending Publication Date: 2024-10-01BEIJING POLYTECHNIC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410854286.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing target detection methods cannot accurately determine the target location when the viewing angle changes. Especially in pedestrian detection in dangerous areas, fixed viewing angles and range calibration are not enough to ensure the accuracy of the target location.

Method used

Using the target area detection method based on YOLO, by constructing a target detection network and a region detection network, the target detection frame and the region detection frame are generated respectively, and corrected to determine whether the target is located in the detection area, considering the detection results at multiple scales to improve accuracy.

Benefits of technology

It achieves an improvement in the accuracy of target position judgment when the viewing angle changes, solves the problem of low detection accuracy of unconventional scale targets in the existing YOLO model, and improves the correction accuracy of the detection frame.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736200A_ABST
    Figure CN118736200A_ABST
Patent Text Reader

Abstract

The invention discloses a target area detection method based on YOLO, and is applied to the technical field of computer vision. Comprising the following steps: collecting a video data set for target area detection, decomposing the video data set into frame images and performing manual annotation to obtain a target image data set and an area image data set; constructing and respectively training a YOLO target detection network and a YOLO region detection network; obtaining a to-be-detected video, preprocessing the to-be-detected video, and inputting the to-be-detected video into the trained YOLO target detection network and YOLO region detection network; outputting a target detection frame and a region detection frame; and correcting the target detection frame and the area detection frame, and judging whether the target is located in the detection area or not. The target detection frame and the area detection frame are obtained by detecting the target and the area respectively and used for judging whether the target is located in the detection area or not, and the accuracy of target detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and more specifically to a target area detection method based on YOLO. Background Art

[0002] In recent years, the field of computer vision has developed rapidly, and target detection is one of the important research directions. It has been applied in many fields such as intelligent video surveillance, behavior analysis, and autonomous driving, and has achieved remarkable development. Target area detection is to accurately mark the area where the target exists in the image or video through the technology in computer vision. In the fields of security monitoring, autonomous driving, and pedestrian detection, the accuracy of the target frame may directly affect the safety issues in its application field. When detecting pedestrians, it is often necessary to determine whether the pedestrian is in the dangerous area. For example, when the pedestrian is in the position of crossing the road when the red light is red, it is also necessary to detect pedestrians in some dangerous areas to identify whether there is an illegal intrusion. However, the existing detection methods are often based on a fixed perspective. In a fixed perspective, the dangerous area is calibrated with a fixed range. It is only necessary to detect pedestrians to determine whether there is a dangerous situation. However, in some cases where the monitoring angle changes, it is necessary to detect the dangerous area at the same time to ensure the accuracy of the target position judgment. Therefore, how to provide a target area detection method based on YOLO is a problem that technicians in this field need to solve urgently. Summary of the invention

[0003] In view of this, the present invention provides a target region detection method based on YOLO, which constructs detection networks of the target and the detection region respectively to obtain the target detection frame and the region detection frame, so as to realize the target position determination when the detection region changes.

[0004] In order to achieve the above object, the present invention provides the following technical solutions:

[0005] A target area detection method based on YOLO, comprising the following steps:

[0006] S1. Collecting a video data set for target area detection through a camera, and dividing the video data set into a target data set including the target and a region data set excluding the target;

[0007] S2, decomposing the video dataset into frame images, manually marking the targets in the frame images of the target dataset and the detection regions in the frame images of the regional dataset, to obtain a target image dataset and a regional image dataset;

[0008] S3. Build and train the YOLO target detection network based on the target image dataset;

[0009] S4. Build and train the YOLO region detection network based on the regional image dataset;

[0010] S5, obtaining the video to be detected, pre-processing the video to be detected and inputting it into the trained YOLO target detection network and YOLO region detection network;

[0011] S6, the YOLO target detection network identifies the target in the video to be detected and outputs the target detection frame, and the YOLO region detection network identifies the detection region in the video to be detected and outputs the region detection frame;

[0012] S7. Calibrate the target detection frame and the region detection frame to determine whether the target is within the detection region.

[0013] Optionally, after manual annotation by S2, the forward image dataset and the reverse image dataset are expanded by means of rotation, flipping, segmentation and brightness adjustment.

[0014] Optionally, the preprocessing in S5 decomposes the video to be detected into frame images.

[0015] Optionally, the YOLO target detection network and the YOLO region detection network have the same structure, including an input module, a backbone module, a NECK module and an output module. The input module performs data enhancement, anchor box calculation and scaling on the input image. The scaled image is input into the backbone module and the NECK module to extract feature maps of three scales. The output module outputs prediction results based on the feature maps of the three scales.

[0016] Optionally, the output module includes three detection units of different scales and one result prediction unit, the detection units are a small-scale detection unit, a medium-scale detection unit and a large-scale detection unit, the three-scale feature maps output by NECK are input into the three detection units of different scales, the detection units use non-maximum suppression to perform preliminary screening on the prediction results generated based on the feature map of one scale, and obtain preliminary screening results corresponding to the feature maps of the three scales, and then use non-maximum suppression to screen again to obtain scale prediction results, each detection unit outputs one scale prediction result, and the scale prediction results output by the three detection units of different scales are input into the result prediction unit, the result prediction unit performs detection frame calculation, and outputs the final detection frame.

[0017] Optionally, the detection box calculation is as follows:

[0018] Calculate the scale prediction results of the detection unit outputs of 3 different scales respectively:

[0019] b xi =2σ(t xi )-0.5+c xi

[0020] b yi =2σ(t yi )-0.5+c yi

[0021] b wi =p wi (2σ(t wi )) 2

[0022] b hi =p hi (2σ(t hi )) 2

[0023] Where b xi , b yi is the coordinate value of the center point of the scale prediction result, b wi , b hi are the width and height of the scale prediction results, i=1,2,3, t xi ,t yi is the offset of the center point coordinates, t wi ,t hi are the width and height offsets, respectively, c xi 、c yi is the center point coordinate before adjustment, p wi 、p hi are the width and height of the anchor box respectively, and σ represents the sigmoid function;

[0024] The smallest center point coordinate value, width and height are selected from the scale prediction results output by the detection units of three different scales as the detection box calculation result.

[0025] Optionally, the correction in S7 is specifically as follows: dividing the image into multiple cells, determining the confidence of all cells containing detection frames, setting cells with confidence lower than a preset threshold as non-detection frames, and using the remaining cells as corrected detection frames.

[0026] It can be seen from the above technical solution that, compared with the prior art, the present invention discloses a target region detection method based on YOLO, which obtains a target detection frame and a region detection frame by respectively detecting the target and the region for judging whether the target is located in the detection region, thereby avoiding the problem of being unable to accurately judge the target position when the viewing angle changes; the detection results of multiple scales are considered when calculating the detection frame, thereby solving the problem that the existing YOLO model has low detection accuracy for targets of unconventional scales; and the detection frame is corrected to improve the accuracy of position judgment. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0028] Figure 1 This is a flow chart of the target area detection method of the present invention. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] The embodiment of the present invention discloses a target area detection method based on YOLO, such as Figure 1 As shown, the following steps are included:

[0031] S1. Collecting a video data set for target area detection through a camera, and dividing the video data set into a target data set including the target and a region data set excluding the target;

[0032] S2, decomposing the video dataset into frame images, manually marking the targets in the frame images of the target dataset and the detection regions in the frame images of the regional dataset, to obtain a target image dataset and a regional image dataset;

[0033] S3. Build and train the YOLO target detection network based on the target image dataset;

[0034] S4. Build and train the YOLO region detection network based on the regional image dataset;

[0035] S5, obtaining the video to be detected, pre-processing the video to be detected and inputting it into the trained YOLO target detection network and YOLO region detection network;

[0036] S6, the YOLO target detection network identifies the target in the video to be detected and outputs the target detection frame, and the YOLO region detection network identifies the detection region in the video to be detected and outputs the region detection frame;

[0037] S7. Calibrate the target detection frame and the region detection frame to determine whether the target is within the detection region.

[0038] Furthermore, after manual annotation, S2 expands the forward image dataset and the reverse image dataset by means of rotation, flipping, segmentation and brightness adjustment.

[0039] Furthermore, the preprocessing in S5 decomposes the video to be detected into frame images.

[0040] Furthermore, the YOLO target detection network and the YOLO region detection network have the same structure, including an input module, a backbone module, a NECK module and an output module. The input module performs data enhancement, anchor box calculation and scaling on the input image. The scaled image is input into the backbone module and the NECK module to extract feature maps of three scales. The output module outputs the prediction results based on the feature maps of three scales.

[0041] Furthermore, in an embodiment of the present invention,

[0042] Furthermore, the output module includes three detection units of different scales and one result prediction unit. The detection units are small-scale detection units, medium-scale detection units and large-scale detection units respectively. The feature maps of three scales output by NECK are input into the three detection units of different scales. The detection units use non-maximum suppression to perform preliminary screening on the prediction results generated based on the feature map of one scale, and obtain the preliminary screening results corresponding to the feature maps of three scales. Then, non-maximum suppression is used for screening again to obtain the scale prediction results. Each detection unit outputs one scale prediction result, and the scale prediction results output by the detection units of three different scales are input into the result prediction unit. The result prediction unit calculates the detection frame and outputs the final detection frame.

[0043] Furthermore, in the embodiment of the present invention, non-maximum suppression is specifically:

[0044] Sort all prediction boxes in descending order of confidence, select the prediction box with the highest confidence, calculate the IOU values ​​of the overlapping parts of other prediction boxes, delete the prediction boxes with IOU values ​​less than the preset threshold, re-sort and repeat the above process until there is only one prediction box left as the screening result of non-maximum suppression.

[0045] The small-scale detection unit, medium-scale detection unit and large-scale detection unit all predict the feature maps of three scales. After one non-maximum suppression screening, each detection unit obtains prediction boxes of three different scales. After the second non-maximum suppression screening, the prediction result of the scale corresponding to the detection unit is obtained.

[0046] Furthermore, the detection box calculation is specifically as follows:

[0047] Calculate the scale prediction results of the detection unit outputs of 3 different scales respectively:

[0048] b xi =2σ(t xi )-0.5+c xi

[0049] b yi =2σ(t yi )-0.5+c yi

[0050] b wi =p wi (2σ(t wi )) 2

[0051] b hi =p hi (2σ(t yi )) 2

[0052] Where b xi , b yi is the coordinate value of the center point of the scale prediction result, b wi , b hi are the width and height of the scale prediction results, i=1,2,3, t xi ,t yi is the offset of the center point coordinates, t wi ,t hi are the width and height offsets, respectively, c xi 、c yi is the center point coordinate before adjustment, p wi 、p hi are the width and height of the anchor box respectively, and σ represents the sigmoid function;

[0053] The smallest center point coordinate value, width and height are selected from the scale prediction results output by the detection units of three different scales as the detection box calculation result.

[0054] Furthermore, in an embodiment of the present invention, the feature map is divided into three scales: small, medium, and large. In a conventional YOLO model, during training, multiple pre-selected anchor frames are obtained by clustering the targets to be detected, and their ratios are fixed values. Different anchor frames need to be selected for targets of different sizes. When facing targets of unconventional ratios, the pre-selected anchor frames cannot accurately identify the targets. For example, the ratios of pedestrian detection frames are mostly fixed values ​​(1:1, 2:3, 1:2, 1:3, etc.), but when encountering occlusion or perspective deformation, the real target ratio may be an unconventional ratio of 1:4 or 4:1. For conventional ratios, different feature maps and detection units are applicable to targets of different sizes, and the scales required for the length and width of unconventional ratios are likely to be different.

[0055] Therefore, in an embodiment of the present invention, compared with conventional YOLO, the present invention uses three detection units of different scales to detect feature maps of three different scales, outputs three scale prediction results, and the result prediction unit then integrates the prediction box center point coordinates and height and width values ​​in the three scale prediction results to obtain the final detection box. The final detection box can be suitable for unconventional proportion targets that require multi-scale detection, thereby improving the detection accuracy.

[0056] Furthermore, the correction in S7 is specifically as follows: dividing the image into a plurality of cells, determining the confidence of all cells containing detection frames, setting cells with confidence lower than a preset threshold as non-detection frames, and using the remaining cells as corrected detection frames.

[0057] Furthermore, in an embodiment of the present invention, whether the target is located in the detection area is determined based on whether the bottom of the target detection frame overlaps with the area detection frame.

[0058] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0059] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A target area detection method based on YOLO, characterized in that: The following steps are involved: S1. Collecting a video data set for target area detection through a camera, and dividing the video data set into a target data set including the target and a region data set excluding the target; S2, decomposing the video dataset into frame images, manually marking the targets in the frame images of the target dataset and the detection areas in the frame images of the regional dataset, to obtain a target image dataset and a regional image dataset; S3. Build and train the YOLO target detection network based on the target image dataset; S4. Build and train the YOLO region detection network based on the regional image dataset; S5, obtaining the video to be detected, pre-processing the video to be detected and inputting it into the trained YOLO target detection network and YOLO region detection network; S6, the YOLO target detection network identifies the target in the video to be detected and outputs the target detection frame, and the YOLO region detection network identifies the detection region in the video to be detected and outputs the region detection frame; S7. Calibrate the target detection frame and the region detection frame to determine whether the target is within the detection region.

2. A target area detection method based on YOLO according to claim 1, characterized in that: After manual annotation by S2, the forward image dataset and the reverse image dataset are expanded by rotation, flipping, segmentation and brightness adjustment.

3. A target area detection method based on YOLO according to claim 1, characterized in that: The preprocessing in S5 decomposes the video to be detected into frame images.

4. A target area detection method based on YOLO according to claim 1, characterized in that: The YOLO target detection network and the YOLO region detection network have the same structure, including an input module, a backbone module, a NECK module, and an output module. The input module performs data enhancement, anchor box calculation, and scaling on the input image. The scaled image is input into the backbone module and the NECK module to extract feature maps of three scales. The output module outputs the prediction results based on the feature maps of three scales.

5. A target area detection method based on YOLO according to claim 4, characterized in that: The output module includes three detection units of different scales and one result prediction unit. The detection units are small-scale detection unit, medium-scale detection unit and large-scale detection unit. The three-scale feature maps output by NECK are input into the three detection units of different scales. The detection unit uses non-maximum suppression to perform preliminary screening on the prediction results generated based on the feature map of one scale, and obtains the preliminary screening results corresponding to the feature maps of the three scales. Then, non-maximum suppression is used again to obtain the scale prediction results. Each detection unit outputs one scale prediction result, and the scale prediction results output by the three detection units of different scales are input into the result prediction unit. The result prediction unit calculates the detection frame and outputs the final detection frame.

6. A method for detecting a target area based on YOLO according to claim 5, characterized in that: The detection box calculation is specifically as follows: Calculate the scale prediction results of the detection unit outputs of 3 different scales respectively: b xi =2σ(t xi )-0.5+c xi b yi =2σ(t yi )-0.5+c yi b wi =p wi (2σ(t wi )) 2 b hi =p hi (2σ(t hi )) 2 Where b xi 、b yi is the coordinate value of the center point of the scale prediction result, b wi 、b hi are the width and height of the scale prediction results, i=1,2,3, t xi ,t yi is the offset of the center point coordinates, t wi ,t hi are the width and height offsets, respectively, c xi 、c yi is the center point coordinate before adjustment, p wi 、p hi are the width and height of the anchor box respectively, and σ represents the sigmoid function; The smallest center point coordinate value, width and height are selected from the scale prediction results output by the detection units of three different scales as the detection box calculation result.

7. The target area detection method based on YOLO according to claim 1, characterized in that: The correction in S7 is specifically as follows: dividing the image into a plurality of cells, determining the confidence of all cells containing detection frames, setting cells with confidence lower than a preset threshold as non-detection frames, and using the remaining cells as the corrected detection frames.