Target detection method and device, electronic equipment and storage medium
By processing the image to be detected and fusing its features, multiple feature maps are generated to determine the target detection frame, which solves the problem of insufficient target detection accuracy in the existing technology and realizes high-accuracy detection in the security industry.
Patent Information
- Application Number
- CN202111657577.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing target detection methods lack competitive relationships between different categories in the security industry, resulting in insufficient detection accuracy and prone to background false detection.
By processing the image to be detected, multiple scale features are generated, and after feature fusion, they are input into the prediction network model to generate width and height feature maps, category feature maps, center point deviation feature maps and target background feature maps. These feature maps are used to determine multiple target detection frames and finally determine the detection results.
It improves the accuracy of target detection, avoids background false detection, and enhances the competition mechanism between different target categories.
Smart Images

Figure CN114445657B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection technology, and in particular to a target detection method, device, electronic equipment and storage medium. Background Art
[0002] The scenes under video surveillance are ever-changing, and the objects under the lens are endless. There are hundreds of types of targets that need to be detected and identified, which brings considerable challenges to the security system.
[0003] In recent years, with the vigorous development of deep learning, target detection technology has made rapid progress, and various new target detection methods have sprung up like mushrooms after rain; however, in the case of many categories, there is no competitive relationship between different categories in the current target detection methods, and the accuracy of detection in the security industry is insufficient, which easily leads to background false detection. Summary of the Invention
[0004] In a first aspect, the main purpose of the present invention is to provide a target detection method, comprising:
[0005] Process the image to be detected to obtain multiple scale features;
[0006] Performing feature fusion on the multiple scale features to generate a fused feature map corresponding to the target scale feature;
[0007] Inputting the fused feature map into a prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map, and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch, and a fourth branch, the first branch is used to output the width and height feature map, the first branch is used to output the category feature map, the third branch is used to output the center point deviation feature map, and the fourth branch is used to output the target background feature map;
[0008] Determine a plurality of corresponding target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map;
[0009] Determine a detection result of the image to be detected based on the multiple target detection frames.
[0010] Optionally, the processing of the image to be detected to obtain multiple scale features includes:
[0011] Performing normalization and scaling processing on the image to be detected;
[0012] The processed image to be detected is input into a feature extraction network model for feature extraction to obtain the multiple scale features; the multiple scale features include 1 / 4 scale, 1 / 8 scale, 1 / 16 scale and 1 / 32 scale.
[0013] Optionally, the second branch and the fourth branch store a preset confidence level; the method further includes:
[0014] Performing peak point detection on the target background feature map;
[0015] Determine whether the target background feature map contains a peak point value greater than a preset confidence level;
[0016] When a peak point value greater than a preset confidence level is included, the coordinates corresponding to the peak point are determined as the reference center point.
[0017] Optionally, the determining the corresponding multiple target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map includes:
[0018] Obtaining a classification confidence corresponding to the reference center point using the second branch index;
[0019] Calculating a plurality of comprehensive confidence levels according to the classification confidence level and the preset confidence level;
[0020] Screening out multiple target center points according to the multiple comprehensive confidence levels;
[0021] The coordinate values corresponding to the multiple target center points are calculated respectively to determine multiple target detection frames.
[0022] Optionally, screening out a plurality of target center points according to the comprehensive confidence level includes:
[0023] Determining whether the multiple comprehensive confidence levels are lower than a preset threshold;
[0024] When the comprehensive confidence is lower than a preset threshold, the corresponding reference center point is deleted;
[0025] When the comprehensive confidence is greater than or equal to a preset threshold, the corresponding reference center point is determined as the target center point.
[0026] Optionally, respectively calculating the coordinate values corresponding to the multiple target center points to determine multiple target detection frames includes:
[0027] Obtaining width values, height values, first center point deviation values, and second center point deviation values corresponding to the plurality of target center points by indexing the first branch and the third branch respectively;
[0028] According to the coordinate values corresponding to each target center point, the coordinate values, width value, height value, first center point deviation value and second center point deviation value are calculated according to a predetermined algorithm to obtain the coordinate points of each target detection frame;
[0029] The coordinate points are connected to obtain the target detection frame.
[0030] Optionally, determining a detection result of the image to be detected according to the multiple target detection frames includes:
[0031] Scaling the multiple target detection frames according to the scale features of the image to be detected;
[0032] When the scale features of the multiple object detection frames correspond to the scale features of the image to be detected, terminating the scaling operation on the multiple object detection frames;
[0033] The scaled multiple target detection boxes are determined as detection results.
[0034] In a third aspect, an embodiment of the present invention provides a target detection device, including:
[0035] A processing module is used to process the image to be detected to obtain multiple scale features;
[0036] A feature fusion module, configured to fuse the multiple scale features to generate a fused feature map corresponding to the target scale feature;
[0037] A prediction module is configured to input the fused feature map into a prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map, and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch, and a fourth branch, wherein the first branch is configured to output the width and height feature map, the second branch is configured to output the category feature map, the third branch is configured to output the center point deviation feature map, and the fourth branch is configured to output the target background feature map;
[0038] A first determination module is configured to determine a plurality of corresponding target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map;
[0039] The second determination module is used to determine the detection result of the image to be detected according to the multiple target detection frames.
[0040] In a third aspect, an embodiment of the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the target detection method as described above when executing the computer program.
[0041] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the target detection method as described above are implemented.
[0042] The above solution of the present invention includes at least the following beneficial effects:
[0043] The target detection method provided by the present invention first processes the image to be detected to obtain multiple scale features; then fuses the multiple scale features to generate a fused feature map corresponding to the target scale features; then inputs the fused feature map into a prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map, and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch, and a fourth branch, wherein the first branch is configured to output the width and height feature map, the second branch is configured to output the category feature map, the third branch is configured to output the center point deviation feature map, and the fourth branch is configured to output the target background feature map; then, based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map, multiple corresponding target detection frames are determined; and then, based on the multiple target detection frames, a detection result of the image to be detected is determined. This creates a competition mechanism between different target categories, resulting in higher detection accuracy in the security industry and avoiding false background detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without any creative work.
[0045] Figure 1 A schematic diagram of the overall process of the target detection method provided by an embodiment of the present invention;
[0046] Figure 2 Another schematic diagram of a flow chart of a target detection method provided by an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of a specific flow chart of step S40 provided in an embodiment of the present invention;
[0048] Figure 4 A schematic diagram of a specific flow chart of step S43 provided in an embodiment of the present invention;
[0049] Figure 5A schematic diagram of a specific flow chart of step S44 provided in an embodiment of the present invention;
[0050] Figure 6 A schematic diagram of a specific flow chart of step S50 provided in an embodiment of the present invention;
[0051] Figure 7 A structural block diagram of a target detection device provided by an embodiment of the present invention;
[0052] Figure 8 This is a structural block diagram of an electronic device provided by an embodiment of the present invention.
[0053] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0054] The following will provide a clear and complete description of the technical solutions in the embodiments of the present invention, in conjunction with the accompanying drawings. It should be understood that the described embodiments are merely a portion of the embodiments of the present invention, and not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.
[0055] The terms "first," "second," and "third," etc., in the specification and claims of the present invention and the accompanying drawings are used to distinguish between different items, not to describe a specific order. Furthermore, the terms "comprise," "comprising," and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0056] First, the solution of the embodiment of the present application is introduced with examples in conjunction with the relevant drawings.
[0057] like Figure 1 As shown, a specific embodiment of the present invention provides a target detection method, including:
[0058] S10: Process the image to be detected to obtain multiple scale features.
[0059] In this embodiment, the image to be detected can be acquired by an image acquisition device, such as a photo taken by a security camera, a single frame image in a video stream, etc., and the image to be processed can be in jpg format, PNG format, TIF format, BMP format, etc.; of course, the image to be processed can also be a grayscale image, or an RGB image, a YUV image, or an HSV image, etc. The processing of the image to be detected can be scaling processing, normalization processing, image enhancement processing, color conversion processing, contrast processing, etc., and the image to be detected can also be subjected to multiple processing, such as scaling processing and normalization processing; the multiple scale features include deep features and shallow features. The deep features are robust to changes in posture, occlusion, and local deformation of objects (such as people, animals, and vehicles), but the reduction in their resolution will lead to the loss of geometric detail information; the shallow features have a small receptive field and rich geometric detail information, but their resolution is high and semantic information is relatively scarce; therefore, by determining multiple scale features, the accuracy of detection can be improved after fusion.
[0060] Optionally, the specific implementation of processing the image to be detected to obtain multiple scale features includes:
[0061] Step 1: normalize and scale the image to be detected;
[0062] In step 2, the processed image to be detected is input into a feature extraction network model for feature extraction to obtain multiple scale features; the multiple scale features include 1 / 4 scale, 1 / 8 scale, 1 / 16 scale and 1 / 32 scale.
[0063] Among them, normalization processing means converting the original image to be processed into a corresponding unique standard form through a series of transformations, which are specifically manifested as coordinate centering, x-shearing normalization, scaling normalization rotation, and rotation normalization; for example, if the original image is an 8-bit grayscale image, then the maximum value of the read-in pixel matrix is 256 and the minimum value is 1. The matrix is defined as I, J=I / 256, which is the normalized image matrix. Therefore, after normalization, all pixel values are in the range [0, 1]; scaling processing means reducing or enlarging, so that the pixel points corresponding to the image to be detected are reduced or enlarged accordingly; the feature extraction network model is used to extract features from the input image to be detected. The feature extraction network model can be a VGG19 network model. It is composed of neural network models such as ResNet network model and MobileNet network model. Feature extraction means extracting useful data or information from the image to obtain the "non-image" representation or description of the image, such as numerical values, vectors and symbols. The image to be detected is normalized and scaled, and can be adjusted according to the size corresponding to the feature extraction network. The processed image to be detected is then passed through the feature extraction network model for feature extraction to obtain multiple scale features of the image to be detected. For example, if the resolution of the image to be detected is 1080P, 1 / 4 scale features, 1 / 8 scale features, 1 / 16 scale features and 1 / 32 scale features of 1080P resolution can be extracted.
[0064] S20: Fusing multiple scale features to generate a fused feature map corresponding to the target scale feature.
[0065] In this embodiment, a feature pyramid network (FPN) can be used to fuse multiple scale features, and the target scale feature is a 1 / 4 scale feature. When fusing multiple scale features, the 1 / 32 scale feature can be first fused with the 1 / 16 scale feature through upsampling, and then the fused 1 / 16 scale feature can be fused with the 1 / 8 scale feature through upsampling. Finally, the fused 1 / 8 scale feature can be fused with the 1 / 4 scale feature through upsampling, thereby obtaining a fused feature map corresponding to the 1 / 4 scale feature. It can be understood that upsampling means doubling the scale feature and then fusing it with the corresponding scale feature. By fusing multiple scale features, the semantic information of the fused feature map can be richer and the resolution can be higher, thereby improving the accuracy of target detection.
[0066] For example, the resolution of the image to be detected is 160×160. After feature extraction, the resolution of the 1 / 4 scale feature is 40×40, the resolution of the 1 / 8 scale feature is 20×20, the resolution of the 1 / 16 scale feature is 10×10, and the resolution of the 1 / 32 scale feature is 5×5. During feature fusion, the resolution 5×5 corresponding to the 1 / 32 scale feature is increased to 10×10 through upsampling and fused with the 1 / 16 scale feature. After fusion, the resolution 10×10 corresponding to the 1 / 16 scale feature is increased to 20×20 through upsampling and fused with the 1 / 8 scale feature. After fusion, the resolution 20×20 corresponding to the 1 / 8 scale feature is increased to 40×40 through upsampling and fused with the 1 / 4 scale feature. Thus, the resolution of the obtained fused feature map is 40×40.
[0067] S30. Input the fused feature map into the prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map, and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch, and a fourth branch, the first branch is used to output the width and height feature map, the second branch is used to output the category feature map, the third branch is used to output the center point deviation feature map, and the fourth branch is used to output the target background feature map.
[0068] In this embodiment, the first branch is the width and height prediction branch, the second branch is the confidence prediction branch, the third branch is the center point deviation prediction branch, and the fourth branch is the target background prediction branch. By inputting the fused feature map into the first branch, a width and height feature map can be obtained, and by inputting the fused feature map into the second branch, a category feature map can be obtained. By inputting the fused feature map into the third branch, a center point deviation feature map can be obtained, and by inputting the fused feature map into the fourth branch, a target background feature map can be obtained.
[0069] Among them, the softmax activation function is used in the first branch. The softmax activation function is used for multi-category classification tasks, which can provide a competitive mechanism association for target detection of different categories. In the second branch, the second branch is used to predict the categories of all targets and the corresponding confidence levels. Therefore, the target predicted by the second branch is in one-hot form on the channel layer. That is, if the number of predicted categories is 5, in the channel dimension, if a certain position is the center point of an i-th target, then the value of the i-th channel layer at this position is 1, and the values of other channels at this position are 0. Moreover, the layer number and value of the maximum value on the channel dimension of the second branch are the category and confidence level of the corresponding target, thereby avoiding predicting different categories of targets at the same position at the same time. In the third branch, the number of channels in the output layer is 2, which can be used to compensate for the position deviation caused by the resolution of the scale feature of 1 / 4. At the same time, the center point of the target can be determined by the fourth branch, and the x corresponding to the center point of the target can be indexed on the third branch. The deviation value of the center point in the a- and y-directions can be used to correct the center point of the target, making the prediction result more accurate. The number of channels of the output feature layer in the fourth branch is 1. The fourth branch is used to distinguish the target from the background, which can improve the model's ability to detect background errors. The center points of all targets can be modeled into a heat map, and the output result is a heat map of all targets, thereby distinguishing the background from the foreground.
[0070] S40: Determine multiple corresponding target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map.
[0071] In this embodiment, the width-height feature map includes width information and height information corresponding to multiple target center points, such as the width information and height information corresponding to the target detection frames of adults and children; the category feature map includes categories corresponding to multiple targets, such as the categories corresponding to adults and children; the center point deviation feature map includes deviation values corresponding to multiple target center points, that is, the deviation values of the target center points in the x-direction and y-direction; the target background feature map includes heat maps corresponding to multiple target center points, for example, different heat maps are generated for adults and children respectively.
[0072] like Figure 2 As shown, the second branch and the fourth branch store a preset confidence level; the target detection method provided by the present invention further includes:
[0073] 101. Perform peak point detection on the target background feature map;
[0074] 102. Determine whether the target background feature map contains a peak value greater than a preset confidence level;
[0075] 103. When a peak point value greater than a preset confidence level is included, the coordinates corresponding to the peak point are determined as the reference center point.
[0076] In this embodiment, the target background feature map includes a foreground image and a background image. The foreground image can be a person, an animal, a vehicle, etc., and the background image can be a grassland, a road, a tree, a house, etc.; wherein the confidence level indicates the probability that an object exists at the target center point, and the preset confidence level can be preset by the user. Generally, the confidence level range value can be 0-1, and the preset confidence level can be set to 0.4; when judging the values of multiple peak points in the target background feature map, when the peak point value is greater than the preset confidence level, the coordinates of the peak point can be determined as the determined reference center point.
[0077] For example, when detecting people and animals, when the image to be detected contains grass, trees, animals and people, in the target background feature map generated, trees, people and animals all generate corresponding peak point values. In order to accurately distinguish grass and trees as background images and animals and people as foreground images, it can be determined that the target confidence corresponding to animals and people is greater than 0.4, so the coordinates of animals and people can be used as reference center points, and the thermal center point generated by trees is lower than 0.4, then the coordinates corresponding to trees are not used as reference center points.
[0078] like Figure 3 As shown, the specific implementation of the above step S40 includes:
[0079] S41. Obtain the classification confidence corresponding to the reference center point using the second branch index;
[0080] S42, calculating multiple comprehensive confidence levels based on the classification confidence levels and the preset confidence levels;
[0081] S43, screening out multiple target center points according to multiple comprehensive confidence levels;
[0082] S44. Calculate the coordinate values corresponding to the multiple target center points respectively to determine multiple target detection frames.
[0083] In this embodiment, the classification confidence can be pre-set by the user. The classification confidence represents the probabilities corresponding to different classification categories. For example, people and animals are different categories, and the corresponding classification confidence is also different. The comprehensive confidence of the reference center point is determined by the classification confidence and the preset confidence, that is, the total confidence of the reference center point, so that the target center point is determined by screening among multiple comprehensive confidences. In this way, the target detection frame can be determined by the target center point. It can be understood that the comprehensive confidence can be calculated by the formula G=d×k, where G represents the comprehensive confidence, d represents the classification confidence, and k represents the preset confidence.
[0084] like Figure 4 As shown, the specific implementation of the above step S43 includes:
[0085] S431, determining whether the multiple comprehensive confidence levels are lower than a preset threshold;
[0086] S432. When the comprehensive confidence is lower than a preset threshold, the corresponding reference center point is deleted;
[0087] S433: When the comprehensive confidence is greater than or equal to a preset threshold, the corresponding reference center point is determined as the target center point.
[0088] Among them, the preset threshold can be a confidence level set in advance by the user. By comparing the calculated multiple comprehensive confidence levels with the preset threshold, it can be determined whether the corresponding reference center point is retained. When the comprehensive confidence level is lower than the preset threshold, it means that the reference center point can be filtered out; when the comprehensive confidence level is greater than or equal to the preset threshold, it means that the reference center point can be used as the target center point in the target background feature map, so that different targets can be detected more accurately.
[0089] For example, when there are 10 comprehensive confidence results calculated, 7 of them are 0.7, 0.8, 0.75, 0.66, 0.84, 0.68, and 0.72, and the other 3 are 0.35, 0.42, and 0.51. Assuming that the preset threshold set by the user is 0.6, the reference center points corresponding to 7 of the comprehensive confidences can be determined as the target center points, and the reference center points corresponding to the other 3 comprehensive confidences can be deleted.
[0090] like Figure 5 As shown, the specific implementation of the above step S44 includes:
[0091] S441, respectively obtain width values, height values, first center point deviation values, and second center point deviation values corresponding to multiple target center points by indexing the first branch and the third branch;
[0092] S442. Calculate the coordinate values, width, height, first center point deviation, and second center point deviation according to a predetermined algorithm based on the coordinate values corresponding to each target center point to obtain the coordinate points of each target detection frame.
[0093] S443: Connect the coordinate points to obtain a target detection frame.
[0094] In this embodiment, the width information and height information of the target detection frame corresponding to the target center point can be indexed in the first branch, and the deviation values of the target center point in the x direction and the y direction can be indexed in the third branch, that is, the first center point deviation value is the center point deviation value in the x direction, and the second center point deviation value is the center point deviation value in the y direction; wherein, the coordinate value of the target center point can be set to (i, j), the width value of the target detection frame is W, the height value of the target detection frame is H, the first center point deviation value is set to x', the second center point deviation value is set to y', the coordinate points of the target detection frame can be the upper left and lower right coordinate points, and the two coordinate points can be set to (x min ,y min ) and (x max ,y max ), the predetermined algorithm can be expressed as Thus, the coordinate points of the target detection frame can be calculated, and then the target detection frame can be determined.
[0095] For example, the coordinate value of the target center point is (10, 15), the width value of the target detection frame is 2, the height value is 3, the deviation value of the first center point is 0.4, and the deviation value of the second center point is 0.6. After calculation, it can be determined that the two coordinate points of the target detection frame are (x min =9.4,y min =14.1), (x max =11.4,y max =17.1).
[0096] S50: Determine a detection result of the image to be detected according to the multiple target detection frames.
[0097] like Figure 6 As shown, after determining multiple target detection frames, determining the detection result of the image to be detected based on the multiple target detection frames specifically includes:
[0098] S51, scaling multiple target detection frames according to the scale characteristics of the image to be detected;
[0099] S52: When the scale features of the multiple target detection frames correspond to the scale features of the image to be detected, terminate the scaling operation on the multiple target detection frames;
[0100] S53: Determine the scaled multiple target detection frames as detection results.
[0101] In this embodiment, the resolution of the image to be detected is different from the resolution of the obtained target detection frame. Therefore, the resolution of the multiple target detection frames can be made consistent with the resolution of the image to be detected by scaling the multiple target detection frames. In this way, the scale sizes of the multiple target detection frames on the image to be detected can be determined, thereby determining them as the detection results.
[0102] The target detection method provided by the present invention first processes an image to be detected to obtain multiple scale features; then fuses the multiple scale features to generate a fused feature map corresponding to the target scale features; then inputs the fused feature map into a prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map, and a target background feature map. The prediction network model includes a first branch for outputting the width and height feature map, a second branch for outputting the category feature map, a third branch for outputting the center point deviation feature map, and a fourth branch for outputting the target background feature map; then, based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map, a plurality of corresponding target detection frames are determined; and then, based on the plurality of target detection frames, a detection result for the image to be detected is determined. This method creates a competition mechanism between different target categories, resulting in higher detection accuracy in the security industry and avoiding false background detection.
[0103] like Figure 7 As shown, an embodiment of the present invention provides a target detection device 10, comprising:
[0104] A processing module 11 is used to process the image to be detected to obtain multiple scale features;
[0105] A feature fusion module 12 is used to fuse multiple scale features to generate a fusion feature map corresponding to the target scale feature;
[0106] The prediction module 13 inputs the fused feature map into the prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map, and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch, and a fourth branch, wherein the first branch is used to output the width and height feature map, the second branch is used to output the category feature map, the third branch is used to output the center point deviation feature map, and the fourth branch is used to output the target background feature map;
[0107] A first determination module 14 is configured to determine a plurality of corresponding target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map;
[0108] The second determination module 15 is configured to determine a detection result of the image to be detected based on the multiple target detection frames.
[0109] The target detection device 10 provided by the present invention first processes an image to be detected to obtain multiple scale features; then fuses the multiple scale features to generate a fused feature map corresponding to the target scale features; then inputs the fused feature map into a prediction network model to obtain a width-height feature map, a category feature map, a center point deviation feature map, and a target background feature map. The prediction network model includes a first branch for outputting a width-height feature map, a second branch for outputting a category feature map, a third branch for outputting a center point deviation feature map, and a fourth branch for outputting a target background feature map. Multiple target detection frames are determined based on the width-height feature map, the category feature map, the center point deviation feature map, and the target background feature map; and a detection result for the image to be detected is determined based on the multiple target detection frames. This creates a competition mechanism between different target categories, resulting in higher detection accuracy in the security industry and avoiding false background detection.
[0110] It should be noted that the target detection device 10 provided in the specific embodiment of the present invention is a device corresponding to the above-mentioned target detection method. All embodiments of the above-mentioned target detection method are applicable to the target detection device 10. The above-mentioned target detection device 10 embodiments all have corresponding modules corresponding to the steps in the above-mentioned target detection method, which can achieve the same or similar beneficial effects. In order to avoid excessive repetition, each module in the target detection device 2 will not be described in detail here.
[0111] like Figure 8 As shown, a specific embodiment of the present invention further provides an electronic device 20, including a memory 202, a processor 201, and a computer program stored in the memory 202 and executable on the processor 201, wherein the processor 201 implements the steps of the above-mentioned target detection method when executing the computer program.
[0112] Specifically, the processor 201 is configured to call the computer program stored in the memory 202 and execute the following steps:
[0113] Process the image to be detected to obtain multiple scale features;
[0114] Fuse multiple scale features to generate a fused feature map corresponding to the target scale feature;
[0115] The fused feature map is input into the prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch and a fourth branch, the first branch is used to output the width and height feature map, the second branch is used to output the category feature map, the third branch is used to output the center point deviation feature map, and the fourth branch is used to output the target background feature map;
[0116] Determine multiple corresponding target detection frames based on the width and height feature maps, the category feature maps, the center point deviation feature maps, and the target background feature maps;
[0117] The detection result of the image to be detected is determined based on multiple target detection frames.
[0118] Optionally, the processor 201 processes the image to be detected to obtain multiple scale features including:
[0119] Normalize and scale the image to be detected;
[0120] The processed image to be detected is input into the feature extraction network model for feature extraction to obtain multiple scale features; the multiple scale features include 1 / 4 scale, 1 / 8 scale, 1 / 16 scale and 1 / 32 scale.
[0121] Optionally, the second branch and the fourth branch store a preset confidence level; the method executed by the processor 201 further includes:
[0122] Perform peak point detection on the target background feature map;
[0123] Determine whether the target background feature map contains a peak point value greater than a preset confidence level;
[0124] When a peak point value greater than a preset confidence level is included, the coordinates corresponding to the peak point are determined as the reference center point.
[0125] Optionally, the processor 201 determines the corresponding multiple target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map, and the target background feature map, including:
[0126] Use the second branch index to obtain the classification confidence corresponding to the reference center point;
[0127] Calculating multiple comprehensive confidence levels based on classification confidence levels and preset confidence levels;
[0128] Screening out multiple target center points based on multiple comprehensive confidence levels;
[0129] The coordinate values corresponding to multiple target center points are calculated respectively to determine multiple target detection frames.
[0130] Optionally, the processor 201 performs screening a plurality of target center points according to a plurality of comprehensive confidence degrees includes:
[0131] determining whether the plurality of comprehensive confidence degrees is lower than a preset threshold value;
[0132] when the comprehensive confidence degree is lower than the preset threshold value, deleting the corresponding reference center point;
[0133] when the comprehensive confidence degree is greater than or equal to the preset threshold value, determining the corresponding reference center point as the target center point.
[0134] Optionally, the processor 201 performs calculating a coordinate value corresponding to each target center point respectively to determine a plurality of target detection frames includes:
[0135] respectively obtaining a width value, a height value, a first center point deviation value and a second center point deviation value corresponding to the plurality of target center points from the first branch index and the third branch index;
[0136] according to the coordinate value corresponding to each target center point, calculating the coordinate value, the width value, the height value, the first center point deviation value and the second center point deviation value according to a predetermined algorithm to obtain a coordinate point of each target detection frame;
[0137] connecting the coordinate point to obtain the target detection frame.
[0138] Optionally, the processor 201 performs determining a detection result of the image to be detected according to the plurality of target detection frames includes:
[0139] scaling the plurality of target detection frames according to a scale feature of the image to be detected;
[0140] terminating the scaling operation of the plurality of target detection frames in a case where the scale feature of the plurality of target detection frames corresponds to the scale feature of the image to be detected;
[0141] determining the scaled plurality of target detection frames as the detection result.
[0142] That is, in the specific embodiments of the present application, the processor 201 of the electronic device 20 implements the steps of the above-mentioned target detection method when executing the computer program, so that there is a competition mechanism between different categories of targets, and the accuracy of detection in the security industry is higher, and background false detection is avoided.
[0143] It should be noted that, since the processor 201 of the electronic device 20 implements the steps of the above-mentioned target detection method when executing the computer program, all embodiments of the above-mentioned target detection method are applicable to the electronic device 20, and can achieve the same or similar beneficial effects.
[0144] The computer-readable storage medium provided in the embodiment of the present invention stores a computer program. When the computer program is executed by the processor, it implements the various processes of the target detection method or the application-end target detection method provided in the embodiment of the present invention, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0145] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0146] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0147] The above description is merely a preferred embodiment of the present invention and does not limit the scope of the present invention. Any equivalent structural transformation made based on the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, is included in the scope of the present invention.
Claims
1. A target detection method, characterized in that: include: Process the image to be detected to obtain multiple scale features; Performing feature fusion on the multiple scale features to generate a fused feature map corresponding to the target scale feature; The fused feature map is input into a prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch and a fourth branch, the first branch is used to output the width and height feature map, the second branch is used to output the category feature map, the third branch is used to output the center point deviation feature map, and the fourth branch is used to output the target background feature map; the second branch and the fourth branch store a preset confidence level; the method further includes: performing peak point detection on the target background feature map; determining whether the target background feature map contains a peak point value greater than a preset confidence level; when the target background feature map contains a peak point value greater than the preset confidence level, determining the coordinates corresponding to the peak point as the reference center point; Determine multiple corresponding target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map and the target background feature map; specifically include: using the second branch index to obtain the classification confidence corresponding to the reference center point; calculating multiple comprehensive confidences by the formula G=d×k, where G represents the comprehensive confidence, d represents the classification confidence, and k represents the preset confidence; filter out multiple target center points according to the multiple comprehensive confidences; calculate the coordinate values corresponding to the multiple target center points respectively to determine multiple target detection frames; filtering out multiple target center points according to the multiple comprehensive confidences includes: judging whether the multiple comprehensive confidences are lower than a preset threshold; when the comprehensive confidence is lower than the preset threshold, deleting the corresponding reference center point; when the comprehensive confidence is greater than or equal to the preset threshold, determining the corresponding reference center point as the target center point; Determine a detection result of the image to be detected based on the multiple target detection frames.
2. The target detection method according to claim 1, wherein: The image to be detected is processed to obtain multiple scale features including: Performing normalization and scaling processing on the image to be detected; The processed image to be detected is input into a feature extraction network model for feature extraction to obtain the multiple scale features; the multiple scale features include 1 / 4 scale, 1 / 8 scale, 1 / 16 scale and 1 / 32 scale.
3. The target detection method according to claim 1, wherein: The calculating the coordinate values corresponding to the plurality of target center points respectively to determine the plurality of target detection frames includes: Obtaining width values, height values, first center point deviation values, and second center point deviation values corresponding to the plurality of target center points by indexing the first branch and the third branch respectively; According to the coordinate values corresponding to each target center point, the coordinate values, width value, height value, first center point deviation value and second center point deviation value are calculated according to a predetermined algorithm to obtain the coordinate points of each target detection frame; The coordinate points are connected to obtain the target detection frame.
4. The target detection method according to claim 1, wherein: Determining the detection result of the image to be detected according to the multiple target detection frames includes: Scaling the multiple target detection frames according to the scale features of the image to be detected; When the scale features of the multiple object detection frames correspond to the scale features of the image to be detected, terminating the scaling operation on the multiple object detection frames; The scaled multiple target detection boxes are determined as detection results.
5. A target detection device, characterized in that: include: A processing module is used to process the image to be detected to obtain multiple scale features; A feature fusion module, configured to fuse the multiple scale features to generate a fused feature map corresponding to the target scale feature; A prediction module is configured to input the fused feature map into a prediction network model to obtain a width and height feature map, a category feature map, a center point deviation feature map, and a target background feature map; wherein the prediction network model includes a first branch, a second branch, a third branch, and a fourth branch, the first branch being configured to output the width and height feature map, the second branch being configured to output the category feature map, the third branch being configured to output the center point deviation feature map, and the fourth branch being configured to output the target background feature map; the second branch and the fourth branch storing a preset confidence level; and further configured to perform peak point detection on the target background feature map; determining whether the target background feature map contains a peak point value greater than a preset confidence level; and when a peak point value greater than a preset confidence level is contained, determining the coordinates corresponding to the peak point as a reference center point. The first determination module is used to determine the corresponding multiple target detection frames based on the width and height feature map, the category feature map, the center point deviation feature map and the target background feature map; specifically comprising: using the second branch index to obtain the classification confidence corresponding to the reference center point; calculating multiple comprehensive confidences by the formula G=d×k, where G represents the comprehensive confidence, d represents the classification confidence, and k represents the preset confidence; screening out multiple target center points according to the multiple comprehensive confidences; respectively calculating the coordinate values corresponding to the multiple target center points to determine multiple target detection frames; screening out multiple target center points according to the multiple comprehensive confidences comprises: judging whether the multiple comprehensive confidences are lower than a preset threshold; when the comprehensive confidence is lower than the preset threshold, deleting the corresponding reference center point; when the comprehensive confidence is greater than or equal to the preset threshold, determining the corresponding reference center point as the target center point; The second determination module is used to determine the detection result of the image to be detected according to the multiple target detection frames.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the target detection method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the target detection method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Multi-class object detection method, terminal equipment and storage medium
CN112418278A
Video image small target detection method based on deep learning
CN112966659A