Target detection method and device, computer device and storage medium

By fusing background information during image recognition and detection and utilizing a well-trained image detection algorithm, the problem of the inability to detect all targets in existing technologies is solved, achieving complete detection of all targets in road images and improving detection accuracy and efficiency.

CN116434158BActive Publication Date: 2026-01-06TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310380354.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-11
Publication Date
2026-01-06
Estimated Expiration
2043-04-11

AI Technical Summary

Technical Problem

Existing object detection methods cannot exhaustively cover all object categories, resulting in incomplete road image detection and an inability to detect all objects on the road.

Method used

By acquiring the image to be detected, the location information of the first target is identified using a preset image recognition algorithm. The background image information is then fused into the image to be detected to form an initial detection image. Finally, the second target is detected using an image detection algorithm based on the training set of the first target, resulting in a complete image detection result.

Benefits of technology

It achieves complete detection of all targets in road images, improves image detection, and enhances detection accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116434158B_ABST
    Figure CN116434158B_ABST
Patent Text Reader

Abstract

The application relates to a target detection method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring a to-be-detected image; performing image recognition on the to-be-detected image according to a preset image recognition algorithm to obtain an image recognition result; judging whether the image recognition result contains position information of a first target; in the case where the image recognition result contains the position information of the first target, fusing background image information into the to-be-detected image according to the position information of the first target to obtain an initial detection image; inputting the initial detection image into a preset image detection algorithm to perform image detection on a second target and obtain an image detection result; and the image detection algorithm is obtained by training an initial image detection algorithm based on a training set labeled with the first target. The method can obtain all the second targets in the to-be-detected image, and improves the image detection of a road.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image detection technology, and in particular to a target detection method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] When road obstructions appear in roads (especially tunnels), they can easily cause traffic accidents. Therefore, it is necessary to detect road images and determine whether there are targets such as gravel, glass, and tires on the road based on the detection results, so as to help managers remove the targets and maintain road traffic safety.

[0003] Current object detection methods typically involve determining the category of the object to be identified, such as gravel, then labeling the location and category of the object (i.e., gravel) in the training set, inputting it into a pre-defined deep learning model for learning, obtaining a trained deep learning model of the object, and then using the target deep learning model to detect road images and obtain the detection results.

[0004] However, current object detection methods cannot exhaustively train deep learning models to cover all object categories. Therefore, the resulting deep learning models cannot detect all objects on the road, resulting in incomplete image detection of roads. Summary of the Invention

[0005] Therefore, it is necessary to provide a target detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product to address the aforementioned technical problems.

[0006] Firstly, this application provides a target detection method. The method includes:

[0007] Acquire the image to be detected; the image to be detected consists of a first target, a second target, and background image information;

[0008] The image to be detected is subjected to image recognition of the first target according to a preset image recognition algorithm to obtain the image recognition result;

[0009] Determine whether the image recognition result contains the location information of the first target;

[0010] If the image recognition result contains the location information of the first target, the background image information is fused into the image to be detected based on the location information of the first target to obtain an initial detection image;

[0011] The initial detection image is input into a preset image detection algorithm to detect the second target, and an image detection result is obtained. The image detection algorithm is trained by the initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the image to be detected.

[0012] In one embodiment, acquiring the image to be detected includes:

[0013] Obtain the initial image to be detected;

[0014] Based on a preset image classification algorithm, the initial image to be detected is classified to obtain the image classification result;

[0015] Determine whether the image classification result meets the preset image classification conditions, and determine the initial image to be detected that meets the image classification conditions as the image to be detected.

[0016] In one embodiment, after determining whether the image recognition result contains the location information of the first target, the method further includes:

[0017] If the image recognition result does not contain the location information of the first target, the image to be detected is used as the initial detection image, and the step of inputting the initial detection image into a preset image detection algorithm to perform image detection of the second target is executed to obtain the image detection result.

[0018] In one embodiment, when the image recognition result contains the location information of the first target, fusing the background image information into the image to be detected based on the location information of the first target to obtain an initial detection image includes:

[0019] If the image recognition result contains the location information of the first target, then background image information is obtained; the background image information includes the image background information of the image to be detected.

[0020] For each location information of the first target contained in the image recognition result, an image corresponding to the location information of the first target is extracted from the background image information to obtain the extracted image information;

[0021] Based on the location information of the first target, the captured image information is fused into the image to be detected to obtain an initial detection image.

[0022] In one embodiment, before inputting the initial detection image into a preset image detection algorithm to perform image detection of the second target and obtaining the image detection result, the method further includes:

[0023] Obtain a first training set corresponding to the image to be detected; the first training set contains multiple training images labeled with the location information of the first target; the training images are composed of the first target and the background image information.

[0024] The first training set is input into a preset initial image detection algorithm. The initial image detection algorithm is used to perform target recognition processing on the training images in the first training set until the trained initial image detection algorithm meets the preset training stopping condition. The trained initial image detection algorithm that meets the training stopping condition is used as the image detection algorithm.

[0025] In one embodiment, after inputting the initial detection image into a preset image detection algorithm to perform image detection of the second target and obtaining the image detection result, the method further includes:

[0026] Obtain the background mask information corresponding to the background image information;

[0027] Based on the background mask information, the image detection result is subjected to image filtering processing to obtain the target detection result; the target detection result includes the target location information in the image detection result.

[0028] In one embodiment, the image detection result includes location information of multiple second targets, and the step of performing image filtering processing on the image detection result based on the background mask information to obtain the target detection result includes:

[0029] For each location information of the second target, determine the overlapping image information where the location information of the second target and the background mask information overlap;

[0030] If the overlapping image information is equal to the position information of the second target, the position information of the second target is determined as the target position information;

[0031] The target detection result is constructed based on the target location information and the background mask information.

[0032] Secondly, this application also provides a target detection device. The device includes:

[0033] An acquisition module is used to acquire an image to be detected; the image to be detected consists of a first target, a second target, and background image information.

[0034] The recognition module is used to perform image recognition of the first target on the image to be detected according to a preset image recognition algorithm, and obtain the image recognition result;

[0035] The judgment module is used to determine whether the image recognition result contains the location information of the first target;

[0036] The fusion module is used to fuse the background image information into the image to be detected based on the location information of the first target when the image recognition result contains the location information of the first target, so as to obtain an initial detection image;

[0037] The detection module is used to input the initial detection image into a preset image detection algorithm to perform image detection of the second target and obtain an image detection result; the image detection algorithm is trained by the initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the image to be detected.

[0038] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0039] Acquire the image to be detected; the image to be detected consists of a first target, a second target, and background image information;

[0040] The image to be detected is subjected to image recognition of the first target according to a preset image recognition algorithm to obtain the image recognition result;

[0041] Determine whether the image recognition result contains the location information of the first target;

[0042] If the image recognition result contains the location information of the first target, the background image information is fused into the image to be detected based on the location information of the first target to obtain an initial detection image;

[0043] The initial detection image is input into a preset image detection algorithm to detect the second target, and an image detection result is obtained. The image detection algorithm is trained by the initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the image to be detected.

[0044] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0045] Acquire the image to be detected; the image to be detected consists of a first target, a second target, and background image information;

[0046] The image to be detected is subjected to image recognition of the first target according to a preset image recognition algorithm to obtain the image recognition result;

[0047] Determine whether the image recognition result contains the location information of the first target;

[0048] If the image recognition result contains the location information of the first target, the background image information is fused into the image to be detected based on the location information of the first target to obtain an initial detection image;

[0049] The initial detection image is input into a preset image detection algorithm to detect the second target, and an image detection result is obtained. The image detection algorithm is trained by the initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the image to be detected.

[0050] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0051] Acquire the image to be detected; the image to be detected consists of a first target, a second target, and background image information;

[0052] The image to be detected is subjected to image recognition of the first target according to a preset image recognition algorithm to obtain the image recognition result;

[0053] Determine whether the image recognition result contains the location information of the first target;

[0054] If the image recognition result contains the location information of the first target, the background image information is fused into the image to be detected based on the location information of the first target to obtain an initial detection image;

[0055] The initial detection image is input into a preset image detection algorithm to detect the second target, and an image detection result is obtained. The image detection algorithm is trained by the initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the image to be detected.

[0056] The aforementioned target detection method, apparatus, computer equipment, storage medium, and computer program product acquire an image to be detected. The image to be detected consists of a first target, a second target, and background image information. The first target is identified in the image to be detected according to a preset image recognition algorithm to obtain an image recognition result. It is determined whether the image recognition result contains the location information of the first target. If the image recognition result contains the location information of the first target, the background image information is fused into the image to be detected based on the location information of the first target to obtain an initial detection image. The initial detection image is input into a preset image detection algorithm to detect the second target, obtaining an image detection result. The image detection algorithm is trained by the initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the image to be detected. Using this method, the image to be detected consists of a first target, a second target, and background image information. All first targets in the image to be detected are identified by an image recognition algorithm, and all first targets in the image to be detected are removed by image fusion, leaving only background image information and the second target in the resulting initial detection image. Then, the initial detection image is detected by a preset image detection algorithm. The resulting image detection results contain all the second targets in the image to be detected, thus improving the image detection of the road. Attached Figure Description

[0057] Figure 1 This is a flowchart illustrating a target detection method in one embodiment;

[0058] Figure 2 This is a flowchart illustrating the steps for determining the image to be detected in one embodiment;

[0059] Figure 3 This is a flowchart illustrating the image fusion steps in one embodiment;

[0060] Figure 4 This is a flowchart illustrating the steps of training an image detection algorithm in one embodiment;

[0061] Figure 5 This is a flowchart illustrating the steps for determining the target detection result in one embodiment;

[0062] Figure 6 This is a flowchart illustrating the image filtering steps in one embodiment;

[0063] Figure 7 This is a flowchart illustrating the target detection method in another embodiment;

[0064] Figure 8 This is a structural block diagram of a target detection device in one embodiment;

[0065] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0066] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0067] In one embodiment, such as Figure 1 As shown, a target detection method is provided. This application does not limit the execution device for the target detection method; the method is described using a computer device as an example, and includes the following steps:

[0068] Step 102: Obtain the image to be detected.

[0069] The image to be detected consists of a first target, a second target, and background image information.

[0070] In practice, in the field of road monitoring, objects on the road are divided into two types: primary targets and secondary targets. Primary targets are large targets on the road (larger than a preset size threshold), such as people and vehicles; hence, they are also called large targets. Secondary targets are small targets on the road (smaller than or equal to a preset size threshold), such as road obstacles, including glass and gravel; these are also called small targets. Faced with the need to detect all secondary targets on the road, the computer acquires an initial image to be detected. Then, the computer classifies this initial image according to a preset image classification algorithm, obtaining the image classification result. The computer then selects the initial images that meet the image classification criteria as the target images for further detection.

[0071] Step 104: Perform image recognition of the first target on the image to be detected according to the preset image recognition algorithm to obtain the image recognition result.

[0072] The second training set contains multiple second training images labeled with the first target.

[0073] In implementation, an initial image recognition algorithm is pre-set in the computer device. The computer device acquires a second training set. Then, the computer device trains the initial image recognition algorithm based on multiple second training images from the second training set, obtaining a trained image recognition algorithm. Finally, the computer device inputs the image to be detected into the image recognition algorithm to perform image recognition of the first target, obtaining the image recognition result.

[0074] In an optional embodiment, the computer device pre-configures an initial image recognition algorithm. Before performing image recognition of the first target in the image to be detected, the computer device needs to train the initial image recognition algorithm to obtain an image recognition algorithm. Specifically: the computer device acquires a second training set. The computer device trains the initial image recognition algorithm to perform image recognition of the first target based on each second training image in the second training set, obtaining a trained initial image recognition algorithm. When the trained initial image recognition algorithm meets preset image recognition training conditions, the computer device uses the trained initial image recognition algorithm that meets the image recognition conditions as the image recognition algorithm. Then, the computer device inputs the image to be detected into the image recognition algorithm. Based on the image recognition algorithm, the computer device performs image recognition of the first target in the image to be detected, obtaining the image recognition result.

[0075] Optionally, the image recognition algorithm can be the YOLO (You Only Look Once, an object detection algorithm) algorithm, which has many different versions, such as YOLO v7, or other image recognition algorithms. This application embodiment does not limit the image recognition algorithm or the specific application version of the image recognition algorithm.

[0076] Optionally, the second training set may contain 1000 or 1200 second training images. The number of second training images in the second training set is determined according to the training requirements of the image recognition algorithm. In this embodiment, the number of second training images in the second training set is not limited.

[0077] Optionally, the image recognition training condition is that the number of training rounds reaches a preset threshold. When the number of training rounds corresponding to the initial image recognition algorithm reaches the preset threshold, the computer device will use the initial image recognition algorithm that meets the image recognition condition as the image recognition algorithm. The threshold for the number of training rounds can be 400 rounds or 500 rounds. The threshold for the number of training rounds is determined according to the training requirements of the image recognition algorithm; this application does not limit the threshold for the number of training rounds.

[0078] Step 106: Determine whether the image recognition result contains the location information of the first target.

[0079] The location information of the first target is the location information of the detection box of the first target.

[0080] In practice, the computer device stores the recognition results of the image to be detected. The computer device then determines whether the image recognition results contain the location information of the detection box of the first target.

[0081] Step 108: If the image recognition result contains the location information of the first target, the background image information is fused into the image to be detected based on the location information of the first target to obtain the initial detection image.

[0082] In implementation, if the image recognition result contains the location information of the first target, the computer device identifies all first targets contained in the image to be detected. Then, for the location information of the detection box of each first target contained in the image recognition result, the computer device performs detection box enlargement processing to obtain the location information of the enlarged detection box of the first target. Then, based on the location information of the enlarged detection box of the first target, the computer device fuses the background image information into the image to be detected to obtain the initial detection image.

[0083] Step 110: Input the initial detection image into the preset image detection algorithm to perform image detection of the second target and obtain the image detection result.

[0084] The image detection algorithm is trained from the initial image detection algorithm on a training set labeled with the first target. The image detection result contains all the second targets in the image to be detected.

[0085] In implementation, the computer device has a pre-set initial image detection algorithm. The computer device acquires a first training set, which contains multiple training images labeled with a first target. Based on these training images, the computer device trains the initial image detection algorithm for target recognition until the trained algorithm meets a preset training stopping condition. The computer device uses the trained initial image detection algorithm that meets the stopping condition as the image detection algorithm. Then, the computer device inputs the initial detection image into the image detection algorithm. The computer device performs image detection on the initial detection image using the image detection algorithm to obtain the image detection result.

[0086] In the above target detection method, the image to be detected consists of a first target, a second target, and background image information. All first targets in the image to be detected are identified using an image recognition algorithm, and then all first targets are removed through image fusion. The resulting initial detection image contains only background image information and the second target. Then, the initial detection image is detected using a preset image detection algorithm, and the resulting image detection result contains all the second targets in the image to be detected, thus improving the image detection of roads.

[0087] In one embodiment, such as Figure 2 As shown, step 102 includes:

[0088] Step 202: Obtain the initial image to be detected.

[0089] In practice, the initial image to be detected is the initial road image, which is acquired by computer equipment from an imaging device located above the road.

[0090] In one optional embodiment, the imaging device is located above the long tunnel. A camera located above the long tunnel acquires road images in real time before the computer device acquires an initial image to be detected. The camera then uploads the real-time road images to the cloud via a communication connection. The computer device retrieves the real-time road images from the cloud and uses these images as the initial image to be detected.

[0091] Optionally, the imaging device can be a camera or a webcam; this application does not limit the imaging device.

[0092] Step 204: Based on the preset image classification algorithm, perform image classification on the initial image to be detected to obtain the image classification result.

[0093] The image classification result characterizes the blur level of the initial image to be detected. The image classification result includes both sharp and blurry images. The third training set contains multiple third training images labeled with their sharpness levels.

[0094] In implementation, the computer device is pre-configured with an initial image classification algorithm. The computer device acquires a third training set. Multiple training images from the third training set are input into the initial image classification algorithm for image classification processing until the trained initial image classification algorithm meets a preset classification training stopping condition. The computer device uses the trained initial image classification algorithm that meets the classification training stopping condition as the final image classification algorithm. Then, the computer device inputs the initial image to be detected into the image classification algorithm for image classification, obtaining the image classification result.

[0095] In an optional embodiment, if the label of the third training image is blurred, it indicates that the third training image is blurred due to road congestion, large-scale road occlusion, or other conditions. If the label of the third training image is clear, it indicates that the third training image is not blurred. The classification training stops when the number of classification training rounds of the trained initial image classification algorithm reaches a preset threshold. An initial image classification algorithm is pre-set in the computer device. The computer device acquires a third training set. The computer device inputs multiple third training images from the third training set into the initial image classification algorithm for image classification processing until the number of classification training rounds of the trained initial image classification algorithm reaches the preset threshold. The computer device uses the trained initial image classification algorithm that has reached the threshold as the image classification algorithm. Then, the computer device inputs the initial image to be detected into the image classification algorithm for image classification to obtain the image classification result.

[0096] Optionally, the image classification algorithm can be ResNet18 (Residual Network 18, a type of residual network) or ResNet50. This application does not limit the image classification algorithm.

[0097] Optionally, the threshold for the number of classification training rounds can be 100 rounds or 200 rounds. This application embodiment does not limit the threshold for the number of classification training rounds.

[0098] Step 206: Determine whether the image classification result meets the preset image classification conditions, and determine the initial image to be detected that meets the image classification conditions as the image to be detected.

[0099] In implementation, the computer device has preset image classification conditions, which stipulate that the image classification result is clear. The computer device determines whether the image classification result is clear. Then, the computer device determines the initial image to be detected that has a clear image result as the initial image to be detected that meets the image classification conditions, and further determines the initial image to be detected that meets the image classification conditions as the image to be detected.

[0100] Optionally, if the image classification result is blurry, the computer device terminates the execution of the target detection method.

[0101] In this embodiment, an initial image to be detected is acquired. By performing image classification on the initial image to be detected, the image classification result is obtained, clarifying the degree of blurriness of the initial image to be detected. Then, the initial image to be detected that meets the image classification criteria is determined as the image to be detected, excluding blurry images, which facilitates subsequent image detection.

[0102] In one embodiment, if the image recognition result does not contain the location information of the first target, the image to be detected is determined as the initial detection image, and the image detection of the second target is performed on the initial detection image based on the image detection algorithm. After step 106 is executed, the target detection method further includes:

[0103] If the image recognition result does not contain the location information of the first target, the image to be detected is used as the initial detection image, and the process of inputting the initial detection image into a preset image detection algorithm to perform image detection of the second target is executed to obtain the image detection result.

[0104] In implementation, if the image recognition result does not contain the location information of the first target, the computer device determines that the image to be detected does not contain the first target. Then, the computer device determines the image to be detected as the initial detection image. Next, the computer device executes the step of inputting the initial detection image into a preset image detection algorithm to perform image detection of the second target, thereby obtaining the image detection result. Specifically, the specific processing procedure of inputting the initial detection image into the preset image detection algorithm to perform image detection of the second target and obtain the image detection result has been described in detail in step 110 of the above embodiments, and will not be repeated here.

[0105] In this embodiment, if the image recognition result does not contain the location information of the first target, the image detection of the second target is performed directly without the need for an image fusion step, thereby improving the target detection efficiency.

[0106] In one embodiment, such as Figure 3 As shown, the specific processing steps of step 208 include:

[0107] Step 302: If the image recognition result contains the location information of the first target, obtain the background image information.

[0108] The background image information includes the background information of the image to be detected.

[0109] In practice, if the image recognition result contains the location information of the first target, the computer device determines that the image to be detected contains the first target. Then, the computer device acquires the background image information corresponding to the image to be detected.

[0110] Step 304: For each first target's location information contained in the image recognition result, extract the image corresponding to the first target's location information from the background image information to obtain the extracted image information.

[0111] The location information of the first target refers to the location information of the detection bounding box of the first target. The image recognition result includes the location information of at least one first target.

[0112] In implementation, the computer device enlarges the detection bounding box of each first target contained in the image recognition result to obtain the position information of the enlarged detection bounding box of the first target. Then, based on the position information of the enlarged detection bounding box of the first target, the computer device extracts the image corresponding to the position information of the enlarged detection bounding box of the first target from the background image information to obtain the extracted image information.

[0113] Specifically, for each first target's location information contained in the image recognition result, the computer device enlarges the detection box of that first target to obtain the location information of the enlarged detection box. Then, the computer device determines whether the location information of the enlarged detection box of the first target overlaps with the location information of other first target detection boxes. If the location information of the enlarged detection box of the first target does not overlap with the location information of other first target detection boxes, the computer device extracts the image corresponding to the location information of the enlarged detection box of the first target from the background image information to obtain the extracted image information. If the location information of the enlarged detection box of the first target overlaps with the location information of other first target detection boxes, the computer device determines the location information of the overlapping first target detection boxes. Then, based on the location information of the enlarged detection box of the first target and the location information of the overlapping first target detection boxes, the computer device updates the location information of the enlarged detection box of the first target and the location information of the overlapping first target detection boxes to obtain the updated detection box location information of the first target. The updated detection box of the first target includes both the enlarged detection box of the first target and the overlapping first target detection boxes. Then, based on the position information of the updated detection box of the first target, the computer device extracts the image corresponding to the position information of the updated detection box of the first target from the background image information to obtain the extracted image information.

[0114] Optionally, the detection bounding box of the first target is enlarged to 1.2 times its original size to obtain the position information of the enlarged detection bounding box. The enlargement factor of the detection bounding box of the first target is determined according to the detection requirements; however, this application does not limit the enlargement factor of the detection bounding box of the first target.

[0115] Step 306: Based on the location information of the first target, the captured image information is fused into the image to be detected to obtain the initial detection image.

[0116] In practice, the computer equipment is pre-installed with an image fusion algorithm. Based on the location information of the first target, the computer equipment fuses the captured image information into the image to be detected using the image fusion algorithm, thus obtaining an initial detection image.

[0117] In an optional embodiment, the image fusion algorithm is a Poisson image fusion algorithm. The computer device, based on the position information of the expanded detection box of the first target and the Poisson formula of the Poisson image fusion algorithm, fuses the cropped image information into the image to be detected to obtain an initial detection image.

[0118] Optionally, the image fusion algorithm can be either a Poisson image fusion algorithm or a direct fusion algorithm. The initial detection image obtained using the direct fusion algorithm has noticeable edge transitions but higher processing efficiency. The initial detection image obtained using the Poisson image fusion algorithm achieves seamless fusion but has lower processing efficiency. The image fusion algorithm is determined based on the target detection requirements; therefore, this application does not limit the specific image fusion algorithm used.

[0119] In this embodiment, based on the location information of the first target, an image is extracted from the background image information to obtain the extracted image information. This extracted image information is then fused into the image to be detected, removing the first target from the image to be detected and eliminating its interference, thus facilitating subsequent image detection.

[0120] In one embodiment, before performing image detection on the initial detection image, the initial image detection algorithm needs to be trained to obtain the image detection algorithm. For example... Figure 4 As shown, before step 110 is executed, the target detection method further includes:

[0121] Step 402: Obtain the first training set corresponding to the image to be detected.

[0122] The first training set contains multiple training images labeled with the location information of the first target. Each training image consists of information about the first target and the background image.

[0123] In practice, the computer device acquires multiple training images. Then, the computer device constructs a first training set based on the multiple training images.

[0124] Optionally, the number of training images included in the first training set can be 1000 or 2000. This application embodiment does not limit the number of training images included in the first training set.

[0125] Step 404: Input the first training set into the preset initial image detection algorithm. Use the initial image detection algorithm to perform target recognition processing on the training images in the first training set until the trained initial image detection algorithm meets the preset training stopping condition. Use the trained initial image detection algorithm that meets the training stopping condition as the image detection algorithm.

[0126] In implementation, the computer equipment is pre-set with training stopping conditions and an initial image detection algorithm. The training stopping condition is that the number of training rounds reaches a preset threshold for the number of training rounds for image detection. The computer equipment inputs a first training set into the preset initial image detection algorithm. Then, the computer equipment performs target recognition processing on each training image in the first training set using the initial image detection algorithm until the number of training rounds of the trained initial image detection algorithm reaches the image detection training round threshold. The computer equipment uses the initial image detection algorithm that has reached the image detection training round threshold as the final image detection algorithm.

[0127] Optionally, the initial image detection algorithm may be, but is not limited to, DeepLab v3+ (a semantic segmentation model). This application embodiment does not limit the initial image detection algorithm.

[0128] Optionally, the threshold for the number of training rounds for image detection can be set to 400 rounds or 500 rounds. The threshold for the number of training rounds for image detection is determined according to the image detection training requirements. This application embodiment does not limit the threshold for the number of training rounds for image detection.

[0129] In this embodiment, the initial image detection algorithm is trained using the first training set to obtain the image detection algorithm, which enables the image detection algorithm to detect all the first and second targets in the initial detection image, thereby improving the accuracy of the image detection algorithm.

[0130] In one embodiment, after obtaining the image detection results, the results need to be optimized. For example... Figure 5 As shown, after step 110 is executed, the target detection method further includes:

[0131] Step 502: Obtain the background mask information corresponding to the background image information.

[0132] In practice, the computer equipment acquires the background mask information corresponding to the background image information.

[0133] Step 504: Based on the background mask information, perform image filtering on the image detection results to obtain the target detection results.

[0134] The target detection result includes the target location information from the image detection result.

[0135] In implementation, the computer device performs image filtering on the location information of each second target contained in the image detection result, based on the background mask information, to obtain the target location information. Then, the computer device constructs the target detection result based on the multiple target location information and the background mask information.

[0136] In this embodiment, the location information of the second target in the image detection result is processed by image filtering based on the background mask information to obtain the target location information. The target detection result constructed based on the target location information optimizes the image detection result.

[0137] In one embodiment, such as Figure 6 As shown, the specific processing steps of step 504 include:

[0138] Step 602: For each second target's location information, determine the overlapping image information where the second target's location information and background mask information overlap.

[0139] In practice, the computer equipment determines the overlapping image information of the position information of the second target and the background mask information for each second target position information contained in the image detection result.

[0140] Step 604: If the overlapping image information is equal to the position information of the second target, determine the position information of the second target as the target position information.

[0141] In practice, when the overlapping image information is equal to the location information of the second target, the computer device determines the location information of the second target as the target location information.

[0142] Step 606: Construct target detection results based on multiple target location information and background mask information.

[0143] In practice, computer equipment constructs target detection results based on multiple target location information and background mask information.

[0144] In this embodiment, by determining the overlapping image information corresponding to each second target location information, and determining the location information of the second target that is equal to the overlapping image information as the target location information, the image detection results are optimized.

[0145] In an optional embodiment, such as Figure 7As shown, the computer device acquires the background corresponding to the initial image to be detected, obtaining background image information. Then, the computer device inputs the initial image to be detected into an image classification algorithm to obtain an image classification result. If the image classification result is blurry, indicating that the road represented by the image to be detected is congested or blurred, the computer device outputs the detection image and stops executing the target detection method. If the image classification result is clear, the computer device confirms that the initial image to be detected is the target image. Then, the computer device performs target detection on the image to be detected, obtaining an image recognition result. If the image recognition result indicates that a target exists in the image to be detected, the computer device performs background reconstruction on the image to be detected, obtaining an initial detection image. Then, the computer device performs semantic segmentation on the initial detection image, obtaining an image detection result. The computer device performs image filtering on the image detection result based on a background mask to obtain a target detection result. If the image recognition result indicates that no target exists in the image to be detected, the computer device uses the image to be detected as the initial detection image for semantic segmentation, obtaining an image detection result. The computer device performs image filtering on the image detection result based on a background mask to obtain a target detection result.

[0146] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0147] Based on the same inventive concept, this application also provides a target detection apparatus for implementing the target detection method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more target detection apparatus embodiments provided below can be found in the limitations of the target detection method described above, and will not be repeated here.

[0148] In one embodiment, such as Figure 8 As shown, a target detection device 800 is provided, including: an acquisition module 801, an identification module 802, a judgment module 803, a fusion module 804, and a detection module 805, wherein:

[0149] The acquisition module 801 is used to acquire the image to be detected; the image to be detected consists of a first target, a second target, and background image information.

[0150] The recognition module 802 is used to perform image recognition of the first target on the image to be detected according to a preset image recognition algorithm, and obtain the image recognition result.

[0151] The judgment module 803 is used to determine whether the image recognition result contains the location information of the first target.

[0152] The fusion module 804 is used to fuse the background image information into the image to be detected based on the location information of the first target when the image recognition result contains the location information of the first target, so as to obtain an initial detection image.

[0153] The detection module 805 inputs the initial detection image into a preset image detection algorithm to perform image detection of the second target and obtains an image detection result; the image detection algorithm is trained by the initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the image to be detected.

[0154] In one exemplary embodiment, the acquisition module 801 includes:

[0155] The first acquisition submodule is used to acquire the initial image to be detected.

[0156] The classification submodule is used to classify the initial image to be detected based on a preset image classification algorithm to obtain the image classification result.

[0157] The first judgment submodule is used to determine whether the image classification result meets the preset image classification conditions, and to determine the initial image to be detected that meets the image classification conditions as the image to be detected.

[0158] In one exemplary embodiment, after the determination module 803 is executed, the target detection device 800 further includes:

[0159] The execution submodule is used to, when the image recognition result does not contain the location information of the first target, take the image to be detected as the initial detection image and execute the step of inputting the initial detection image into a preset image detection algorithm to perform image detection of the second target and obtain the image detection result.

[0160] In one exemplary embodiment, the fusion module 804 includes:

[0161] The second acquisition submodule is used to acquire background image information when the image recognition result contains the location information of the first target; the background image information includes the image background information of the image to be detected.

[0162] The cropping submodule is used to crop the image corresponding to the location information of the first target in the background image information for each first target location information contained in the image recognition result, so as to obtain cropped image information.

[0163] The fusion submodule is used to fuse the captured image information into the image to be detected based on the location information of the first target, so as to obtain an initial detection image.

[0164] In one exemplary embodiment, before the detection module 805 executes, the target detection device 800 further includes:

[0165] The third acquisition submodule is used to acquire the first training set corresponding to the image to be detected; the first training set contains multiple training images labeled with the location information of the first target; the training images are composed of the first target and the background image information.

[0166] The training submodule is used to input the first training set into a preset initial image detection algorithm, and to perform target recognition processing on the training images in the first training set through the initial image detection algorithm until the trained initial image detection algorithm meets the preset training stopping condition. The trained initial image detection algorithm that meets the training stopping condition is used as the image detection algorithm.

[0167] In one exemplary embodiment, after the detection module 805 executes, the target detection device 800 further includes:

[0168] The fourth acquisition submodule is used to acquire the background mask information corresponding to the background image information.

[0169] The filtering submodule is used to perform image filtering processing on the image detection result based on the background mask information to obtain the target detection result; the target detection result includes the target location information in the image detection result.

[0170] In one exemplary embodiment, the filtering submodule includes:

[0171] The first determining submodule is used to determine, for each location information of the second target, overlapping image information where the location information of the second target and the background mask information overlap.

[0172] The second determining submodule is used to determine the position information of the second target as the target position information when the overlapping image information is equal to the position information of the second target.

[0173] A submodule is constructed to build target detection results based on multiple target location information and background mask information.

[0174] Each module in the aforementioned target detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0175] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a target detection method. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0176] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0177] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0178] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0179] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0180] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0181] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0182] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A target detection method characterized by, The method comprises: acquiring a to-be-detected image; the to-be-detected image is composed of a first target, a second target and background image information; performing image recognition on the first target in the to-be-detected image according to a preset image recognition algorithm to obtain an image recognition result; judging whether the image recognition result contains position information of the first target; in the case where the image recognition result contains the position information of the first target, acquiring background image information; the background image information contains image background information of the to-be-detected image; for each position information of the first target contained in the image recognition result, cutting an image corresponding to the position information of the first target in the background image information to obtain cut image information; fusing the cut image information into the to-be-detected image according to the position information of the first target to obtain an initial detection image; inputting the initial detection image into a preset image detection algorithm to perform image detection on the second target to obtain an image detection result; the image detection algorithm is obtained by training an initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the to-be-detected image; acquiring background mask information corresponding to the background image information; the image detection result contains position information of multiple second targets; for each position information of the second target, determining overlapping image information in which the position information of the second target and the background mask information overlap; in the case where the overlapping image information is equal to the position information of the second target, determining that the position information of the second target is target position information; constructing a target detection result according to multiple target position information and the background mask information; the target detection result contains target position information in the image detection result.

2. The method of claim 1, wherein, The method comprises: acquiring an initial to-be-detected image; performing image classification on the initial to-be-detected image based on a preset image classification algorithm to obtain an image classification result; judging whether the image classification result meets a preset image classification condition, and determining the initial to-be-detected image meeting the image classification condition as a to-be-detected image.

3. The method of claim 2, wherein, The image classification result represents a blur degree of the initial to-be-detected image; the image classification result includes clear and blurred.

4. The method of claim 2, wherein, The image classification condition is that the image classification result is clear, and the judgment of whether the image classification result meets the preset image classification condition and the determination of the initial to-be-detected image meeting the image classification condition as a to-be-detected image comprise: judging whether the image classification result is clear; determining the initial to-be-detected image with the clear image classification result as the initial to-be-detected image meeting the image classification condition, and determining the initial to-be-detected image meeting the image classification condition as a to-be-detected image.

5. The method of claim 1, wherein, After judging whether the image recognition result contains the position information of the first target, the method further comprises: In a case where the image recognition result does not contain the position information of the first target, the initial detection image is taken as the to-be-detected image, and the image detection of the second target is performed on the initial detection image by inputting the initial detection image into a preset image detection algorithm, to obtain an image detection result.

6. The method of claim 1, wherein, The step of fusing the cropped image information into the to-be-detected image according to the position information of the first target to obtain an initial detection image comprises: According to the position information of the first target, the cropped image information is fused into the to-be-detected image based on an image fusion algorithm to obtain an initial detection image, and the image fusion algorithm is a Poisson image fusion algorithm.

7. The method of claim 1, before the initial detection image is input into a preset image detection algorithm for image detection of the second target to obtain an image detection result, the method further comprises: obtaining a first training set corresponding to the to-be-detected image; the first training set contains a plurality of training images labeled with position information of the first target; the training image is composed of the first target and the background image information; the first training set is input into a preset initial image detection algorithm, and the initial image detection algorithm is used for target recognition processing on the training images in the first training set until the trained initial image detection algorithm meets a preset training stop condition, and the trained initial image detection algorithm meeting the training stop condition is taken as an image detection algorithm.

8. A target detection apparatus characterized by comprising: The device comprises: an acquisition module configured to acquire a to-be-detected image; the to-be-detected image is composed of a first target, a second target and background image information; an identification module configured to perform image recognition of the first target on the to-be-detected image according to a preset image recognition algorithm to obtain an image recognition result; a judgment module configured to judge whether the image recognition result contains position information of the first target; a second acquisition submodule configured to acquire background image information in a case where the image recognition result contains position information of the first target; the background image information contains image background information of the to-be-detected image; a cropping submodule configured to, for each position information of the first target contained in the image recognition result, crop an image corresponding to the position information of the first target from the background image information to obtain cropped image information; a fusion submodule configured to fuse the cropped image information into the to-be-detected image according to the position information of the first target to obtain an initial detection image; a detection module configured to input the initial detection image into a preset image detection algorithm for image detection of the second target to obtain an image detection result; the image detection algorithm is obtained by training an initial image detection algorithm based on a training set labeled with the first target, and the image detection result contains all the second targets in the to-be-detected image; a fourth acquisition submodule configured to acquire background mask information corresponding to the background image information; the image detection result contains position information of a plurality of second targets. a first determining sub-module, configured to determine, for position information of each of the second targets, overlapping image information of the position information of the second target and the background mask information; a second determining sub-module, configured to determine, in a case where the overlapping image information is equal to the position information of the second target, that the position information of the second target is target position information; a constructing sub-module, configured to construct a target detection result according to a plurality of the target position information and the background mask information; the target detection result containing target position information in the image detection result. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-8 when the computer program is executed by the processor. The processor executes the computer program to implement the steps of the method in any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image recognition method and device, electronic equipment and computer readable storage medium

    CN111598091A

  • Target identification method, electronic equipment and storage medium

    CN114220041A