Image target detection method, device, equipment and storage medium
By using the target recognition model combined with plane and depth processing technology in image target detection, the problem of difficult identification of occluded targets is solved, and efficient and accurate automatic target detection is achieved.
Patent Information
- Application Number
- CN202310066858.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-16
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2043-01-16
AI Technical Summary
In the existing technology, image target detection in complex images is prone to missing occluded targets, resulting in low detection accuracy, and manual secondary labeling is time-consuming and inefficient.
By receiving the target image and using the target recognition model to identify the target, the system combines plane processing and depth processing to remove non-targets and retain occluded targets, thereby improving detection accuracy and efficiency.
It achieves effective recognition of occluded targets, improves the accuracy and efficiency of image target detection, and avoids manual secondary processing.
Smart Images

Figure CN116597468B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to an image target detection method, apparatus, device and storage medium. Background Art
[0002] With the development of science and technology, in order to determine the location and category of targets in images, the targets in images have gradually changed from manual labeling to automatic target detection, which improves the efficiency of image target detection and saves time.
[0003] In the existing technology, automatic target detection generally identifies the target in the image, then marks it with a marking box, and then further classifies the target in the marking box. However, as the complexity of the image increases, there are more and more targets in the image, and some targets may be occluded. Since there is less information about the occluded target, simple automatic target detection is difficult to identify the occluded target, and it is easy to miss the detection, resulting in low target detection accuracy. At the same time, if the image after automatic target recognition is manually checked or re-annotated, it takes a long time and there is a problem of low target detection efficiency.
[0004] Based on this, how to improve the accuracy and efficiency of image target detection is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention
[0005] Based on the above problems, the present application provides an image target detection method, apparatus, device and storage medium to improve the accuracy and efficiency of image target detection.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides an image object detection method, the method comprising:
[0008] Receiving a target image to be detected;
[0009] Performing target recognition on the target image using a target recognition model to obtain multiple initial targets;
[0010] Performing plane processing and depth processing on the multiple initial targets to obtain at least one processed target;
[0011] The at least one processing target is used as the target detection result of the target image.
[0012] Optionally, performing plane processing and depth processing on the multiple initial targets to obtain at least one processed target includes:
[0013] Performing plane processing on the multiple initial targets to obtain targets to be retained and targets to be deduplicated;
[0014] Determining the depth value of the target to be deduplicated;
[0015] Determining whether the depth value is greater than or equal to a preset depth value;
[0016] If it is greater than or equal to, the target to be deduplicated and the target to be retained are taken as processing targets;
[0017] If it is less than, the target to be retained will be used as the processing target.
[0018] Optionally, determining the depth value of the target to be deduplicated includes:
[0019] Determine an object that overlaps the object to be deduplicated as an overlapping object;
[0020] Determining an overlap ratio between the to-be-deduplicated object and the overlapping object;
[0021] The depth value of the object to be deduplicated is determined according to the object to be deduplicated, the overlapping object and the overlapping ratio.
[0022] Optionally, the target recognition model is trained in the following manner:
[0023] receiving a first image and a second image;
[0024] determining at least one object in the first image as a first object;
[0025] extracting a preset number of targets from the second image as second targets;
[0026] Overlapping and pasting a preset number of second targets with the first target;
[0027] Copying the first target to obtain a first sub-target;
[0028] Pasting the first sub-object to a position that does not overlap with any object in the first image;
[0029] Using a first image including a first target, a second target, and a first sub-target as a training image;
[0030] determining a training function according to the training image;
[0031] The target recognition model to be trained is trained by using the training function.
[0032] Optionally, determining a training function according to the training image includes:
[0033] determining a first mean and a first variance of the first target;
[0034] determining a second mean and a second variance of the first sub-goal;
[0035] A mean square error loss function is determined according to the first mean, the second mean, the first variance, and the second variance as a training function.
[0036] In a second aspect, an embodiment of the present application provides an image object detection device, the device comprising:
[0037] A receiving module, configured to receive a target image to be detected;
[0038] A target recognition module is used to perform target recognition on the target image using a target recognition model to obtain multiple initial targets;
[0039] A target processing module, configured to perform plane processing and depth processing on the multiple initial targets to obtain at least one processed target;
[0040] The target detection module is configured to use the at least one processing target as a target detection result of the target image.
[0041] Optionally, the target processing module includes:
[0042] A plane processing module, configured to perform plane processing on the multiple initial targets to obtain targets to be retained and targets to be deduplicated;
[0043] A depth value determination module, configured to determine the depth value of the target to be deduplicated;
[0044] A determination module, configured to determine whether the depth value is greater than or equal to a preset depth value;
[0045] A first target processing submodule, configured to use the target to be deduplicated and the target to be retained as processing targets if the target is greater than or equal to the target;
[0046] The second target processing submodule is configured to take the target to be retained as a processing target if is less than .
[0047] Optionally, the depth value determination module includes:
[0048] An overlapping target determining module, configured to determine targets overlapping the target to be deduplicated as overlapping targets;
[0049] An overlap ratio determination module, configured to determine an overlap ratio between the target to be deduplicated and the overlapping target;
[0050] The depth value determination submodule is configured to determine the depth value of the to-be-deduplicated object according to the to-be-deduplicated object, the overlapping object, and the overlapping ratio.
[0051] In a third aspect, an embodiment of the present application provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the image target detection method as described in the first aspect is implemented.
[0052] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes the image target detection method as described in the first aspect.
[0053] Compared with the prior art, this application has the following beneficial effects:
[0054] The present application receives a target image to be detected, uses a target recognition model to perform target recognition on the target image to obtain multiple initial targets, performs plane processing and depth processing on the multiple initial targets to obtain at least one processed target, and uses the at least one processed target as the target detection result of the target image. Among them, by using plane processing and depth processing to remove non-target initial targets, and processing the initial targets from both plane and depth aspects, it is possible to retain occluded targets, improve the accuracy of image target detection, and at the same time ensure that occluded targets can be identified, thereby improving the reliability of image target detection. Without the need for manual secondary processing, automatic image target detection is achieved, thereby improving the efficiency of image target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0056] Figure 1 A flowchart of an image target detection method provided in an embodiment of the present application;
[0057] Figure 2 A schematic diagram of a target image including multiple initial targets provided in an embodiment of the present application;
[0058] Figure 3 A schematic diagram of another target image including multiple initial targets provided in an embodiment of the present application;
[0059] Figure 4a A schematic diagram of a first image and a second image provided in an embodiment of the present application;
[0060] Figure 4b A schematic diagram of determining a first image of a first target provided in an embodiment of the present application;
[0061] Figure 4c A process diagram for extracting a preset number of second targets provided in an embodiment of the present application;
[0062] Figure 4d A schematic diagram of the second target overlapping the first target provided in an embodiment of the present application;
[0063] Figure 4e A schematic diagram of a training image provided in an embodiment of the present application;
[0064] Figure 5 A schematic diagram of a recognition frame of a training image provided in an embodiment of the present application;
[0065] Figure 6 A schematic diagram of the structure of an image target detection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] As described above, in the research on target detection, it was found that in the existing technology, automatic target detection generally identifies the target in the image, then marks it with a marking box, and then further classifies the target in the marking box. However, as the complexity of the image increases, there are more and more targets in the image, and some targets may be occluded. Since there is less information about the occluded target, simple automatic target detection is difficult to identify the occluded target, and it is easy to miss the detection, resulting in low target detection accuracy. At the same time, if the image after automatic target recognition is manually checked or re-annotated, it takes a long time and there is a problem of low target detection efficiency.
[0067] To address the above-mentioned issues, embodiments of the present application provide an image target recognition method, apparatus, device, and storage medium. The method comprises: receiving a target image to be detected, performing target recognition on the target image using a target recognition model to obtain multiple initial targets, performing plane processing and depth processing on the multiple initial targets to obtain at least one processed target, and using the at least one processed target as the target detection result for the target image.
[0068] In this way, by using plane processing and depth processing to remove non-target initial targets and processing the initial targets from both plane and depth aspects, the occluded targets can be retained, thereby improving the accuracy of image target detection. At the same time, it is ensured that the occluded targets can be identified, thereby improving the reliability of image target detection. Without the need for manual secondary processing, automatic image target detection can be achieved, thereby improving the efficiency of image target detection.
[0069] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0070] See also Figure 1 , which is a flow chart of an image target detection method provided by an embodiment of the present application, combined with Figure 1 As shown, the image target detection method provided by the embodiment of the present application may specifically include:
[0071] S101: Receive a target image to be detected.
[0072] The target image refers to an image to be detected and contains multiple targets.
[0073] It should be noted that this embodiment primarily targets images in crowded scenes for detection. Therefore, the target image in this embodiment refers to an image containing multiple overlapping targets to be detected. However, this application is not limited to images in crowded scenes and is also applicable to ordinary images. A normal image refers to an image in which targets do not overlap, or the degree of overlap between targets is minimal and does not affect the recognition of occluded targets.
[0074] It should be noted that the target refers to a recognizable person, plant, or object. The target to be recognized varies in different scenarios, and the corresponding target has different meanings. In this embodiment, the target refers to a person. In other achievable implementations, if the target image to be detected is an image taken underwater in a fish pond, the target can be a fish.
[0075] S102: Performing target recognition on the target image using a target recognition model to obtain a plurality of initial targets.
[0076] The target recognition model refers to a model used to recognize a target in a target image, wherein the target recognition model is a model obtained through training.
[0077] The initial target refers to the result output by the target recognition model.
[0078] It should be noted that, in this embodiment, since the purpose is to detect image targets in crowded scenes, the number of the initial targets is multiple. However, when the target image contains only one target, the corresponding number of the initial targets is one.
[0079] It should be noted that the target recognition model can identify the target in the target image without manual labeling, which saves time and improves the efficiency of target recognition.
[0080] S103: Performing plane processing and depth processing on the multiple initial targets to obtain at least one processed target.
[0081] It should be noted that when the target image is identified by the target recognition model, the target on the target image will be marked with an identification frame. There may be multiple identification frames for one target, and the targets corresponding to the multiple identification frames are all regarded as initial targets.
[0082] However, in reality, there is only one recognition frame for one target, that is, one target should correspond to one recognition frame. Therefore, in order to determine the unique recognition frame of the target, the confidence of each recognition frame is generally calculated, and then the one with the largest confidence is used as the final recognition frame. However, in a crowded scene, assuming that the target is a target person, there may be other people overlapping behind the target person. There is less feature information about the obscured person, and the person may be mistakenly identified in the recognition frame of the target person. In the process of determining the recognition frame of the person, the person is removed due to low confidence, resulting in the loss of the obscured person.
[0083] In order to further prevent the occluded target from being mistakenly removed in the process of determining the unique identification frame corresponding to a target, it is necessary to use both plane processing and depth processing to determine the unique identification frame corresponding to the target.
[0084] Plane processing refers to determining the confidence of each of the multiple initial targets (or multiple identification boxes) corresponding to any target from a planar perspective, and distinguishing the initial target with the highest confidence from the other initial targets.
[0085] Depth processing means that after distinguishing the initial target with the highest confidence from other initial targets, depth calculation is performed on the other initial targets to determine whether the other initial targets have a spatial front-to-back position relationship with the target with the highest confidence, that is, whether the other initial targets have a depth relationship in the image with the initial target with the highest confidence.
[0086] In order to further explain the plane processing and depth processing, the specific Figure 2 and for example, see Figure 2 , which is a schematic diagram of a target image including multiple initial targets provided by an embodiment of the present application, combined with Figure 2 As shown, the plane processing and depth processing process are:
[0087] The target image contains person A and person B. After the target image is input into the target recognition model, the initial target (attached Figure 2 3 recognition boxes in the image) 21, 22 and 23. Since most of person B is blocked by person A, person B has fewer relevant features. The confidence of 21 is calculated to be 0.9, the confidence of 22 is 0.7, and the confidence of 23 is 0.5. Then 21 is the initial target with the highest confidence, and 22 and 23 should be removed as the initial targets. However, Figure 2 It can be seen that the dotted box corresponding to 23 includes most of the features of person A and a small part of the features of person B, and thus will be mistakenly included in multiple identification boxes of person A. If we follow the conventional method, 22 and 23 need to be removed, but in fact 23 needs to be retained, so it is necessary to calculate the depth values of 22 and 23 relative to 21 respectively. For a specific example, assuming that the default depth value of each box is 1, since 22 and 21 are at the same depth, the depth value of 22 should be 1, and the person B corresponding to 23 is behind the person A, that is, the dotted box corresponding to 23 is behind the solid box of 21, so the depth value of 23 should be 2, then 23 needs to be retained, that is, the processing targets should be 21 and 23.
[0088] It should be noted that the above example is only an illustration of a feasible implementation method and is not a basis for limiting the scope of protection of this application.
[0089] It should be noted that, through plane processing and depth processing, different from the simple deduplication processing in the existing technology, the combination of 2D (plane processing) and 3D (depth processing) is used to achieve recognition from both plane and three-dimensional aspects, avoiding the occluded targets from being mistakenly removed or lost, and improving the accuracy of target detection.
[0090] S104: Using the at least one processing target as the target detection result of the target image.
[0091] The processed target refers to the target obtained after the initial target is processed by plane and depth.
[0092] The image target detection method provided by the embodiment of the present application receives a target image to be detected, uses a target recognition model to perform target recognition on the target image to obtain multiple initial targets, performs plane processing and depth processing on the multiple initial targets to obtain at least one processed target, and uses the at least one processed target as the target detection result of the target image. Among them, by using plane processing and depth processing to remove non-target initial targets, and processing the initial targets from both plane and depth aspects, it is possible to retain occluded targets, improve the accuracy of image target detection, and at the same time ensure that occluded targets can be identified, thereby improving the reliability of image target detection, eliminating the need for manual secondary processing, and realizing automated image target detection, thereby improving the efficiency of image target detection.
[0093] Based on the image target detection method provided in the above embodiment, the present application embodiment also provides another image target detection method, see Figure 3 , which is a schematic diagram of another target image including multiple initial targets provided by an embodiment of the present application, combined with Figure 3 As shown, another image detection method provided by an embodiment of the present application may include:
[0094] Step 1: Receive the target image to be detected.
[0095] It should be noted that, in this embodiment, the target image provided is an image in a crowded scene, that is, it includes multiple targets, and there is an overlapping relationship between the targets.
[0096] Step 2: Use the target recognition model to perform target recognition on the target image to obtain multiple initial targets.
[0097] See also Figure 3 , Figure 3 There are 7 characters A, B, C, D, E, F, and G as targets. There is an overlapping relationship between the 7 characters. Among them, if the 7 characters are arranged in actual space, characters A, C, F, and G are in the first row, characters B and E are in the second row, and character D is in the third row.
[0098] like Figure 3 As shown, the recognition contents in the recognition boxes Q1 to Q7 are the initial targets recognized by the recognition model.
[0099] It should be noted that the implementation process of step 1 and step 2 is the same as the implementation process of step S101 and step S102, so it will not be repeated here. For details, please refer to the implementation process of step S101 and step S102.
[0100] Step 3: Perform plane processing on the multiple initial targets to obtain targets to be retained and targets to be deduplicated.
[0101] It should be noted that, in this example, the confidence level of each initial target is calculated, and then whether the initial target is a target to be retained or a target to be deduplicated is determined based on the confidence level.
[0102] In this example, the preset confidence value is determined to be 0.7, the confidence of Q1 is 1, the confidence of Q2 is 0.7, the confidence of Q3 is 0.9, the confidence of Q4 is 0.65, the confidence of Q5 is 0.5, the confidence of Q6 is 0.95, and the confidence of Q7 is 1. It can be seen that Q1, Q2, Q3, Q6 and Q7 are targets to be retained, while Q4 and Q5 are targets to be deduplicated.
[0103] Step 4: Determine the depth value of the target to be deduplicated.
[0104] Based on the targets to be deduplicated determined in step 3, it is necessary to further calculate the depth values of the targets to be deduplicated to avoid the problem of Q4 and Q5 being deduplicated due to low confidence, resulting in target omission.
[0105] As a feasible implementation method, the depth value of the target to be deduplicated can be obtained in the following way:
[0106] Step 11: Determine the target that overlaps with the target to be deduplicated as the overlapping target.
[0107] Step 12: Determine the overlap ratio between the to-be-deduplicated objects and the overlapping objects.
[0108] Step 13: Determine the depth value of the object to be deduplicated according to the object to be deduplicated, the overlapping object and the overlap ratio.
[0109] Overlapping targets refer to targets that overlap with the target to be deduplicated, such as Figure 3 The positional relationship between Q5 and Q6 in .
[0110] Specifically Figure 3 Take the target Q5 to be deduplicated as an example. Figure 3 As shown, Q5 and Q6 are in an overlapping state, Q5 is the target to be deduplicated, and Q6 is the overlapping target. The overlapping ratio between Q5 and Q6 is determined. Assuming that the value of the overlapping ratio is 0.25, and then further calculated based on the overlapping ratio of Q5 and Q6, the depth value is 1.25, and the preset depth value is set to 1, then Q5 should be retained.
[0111] In a feasible implementation, assuming that each target (both the target to be deduplicated and the overlapping target are targets) is assigned a depth of 1, then if all targets are assigned with b j Indicates that the corresponding b j The collection should be:
[0112]
[0113] in, Indicates b j The set that satisfies the overlapping relationship, S(*) represents the area of the region, ovl(b i ,b j ) represents the overlap ratio between the target to be deduplicated and the overlapping target.
[0114] The overlap ratio may specifically be a ratio of the union of the two detection frames to the intersection of the two detection frames.
[0115] Correspondingly, the depth value of the target to be deduplicated can be obtained by the following formula:
[0116]
[0117] Among them, i Indicates the depth value of the target to be deduplicated. Indicates b j The set of S(*) represents the area of the region, ovl(b i ,b j ) represents the overlap ratio between the target to be deduplicated and the overlapping target.
[0118] It should be noted that the serial numbers of steps 11 to 13 are only used to distinguish different steps or to distinguish the temporal relationship between different steps, and therefore are not shown in the figure.
[0119] Step 5: Determine whether the depth value is greater than or equal to a preset depth value.
[0120] As a feasible implementation method, the preset depth value can be obtained by the following formula:
[0121]
[0122] Among them, od Indicates the preset depth value, δ and is a constant, and IoU represents the ratio of the union of two overlapping detection boxes to the intersection of two overlapping detection boxes.
[0123] It should be noted that, based on step four, step five needs to further judge the size between the depth value and the preset depth value. If it is greater than or equal to, the target to be deduplicated and the target to be retained will be used as processing targets. That is to say, the target to be deduplicated corresponding to the preset depth value that is greater than or equal to the preset depth value should be retained, so the target to be deduplicated and the target to be retained will be used as processing targets together, which is the detection result.
[0124] It should be noted that if it is less than, the target to be retained will be used as the processing target, that is, the target to be deduplicated that is less than the preset depth value is the target that needs to be deduplicated, and is not used as the final result.
[0125] Based on the image target detection method provided by the above embodiment, see Figure 4a
[0014] The present embodiment further provides a training image construction process to obtain a training image for training or optimizing an object recognition model to be trained or optimized, which may specifically include:
[0126] Step 21: Receive a first image and a second image.
[0127] It should be noted that the first image and the second image are two images randomly selected from the image set, as shown in the following example: Figure 4a As shown, Figure 4a A schematic diagram of a first image and a second image provided in an embodiment of the present application.
[0128] Step 22: Determine at least one target in the first image as a first target.
[0129] See also Figure 4b , which is a schematic diagram of determining the first image of the first target provided in an embodiment of the present application.
[0130] It should be noted that in this example, only one target is determined as the first target, but in other feasible implementations, multiple targets can be selected as the first target, and this is not specifically limited here. The first target will subsequently serve as the center of the first image, that is, the center position of the subsequent overlap.
[0131] As a feasible implementation, when there are multiple first targets, the first image includes multiple centers. The centers corresponding to the multiple first targets can be specifically expressed by the following formula:
[0132]
[0133] in, represents the number of the first target, x i ,y i represents the position of the first target, s i represents the size of the first target, Indicates the center corresponding to each first target.
[0134] It should be noted that, since the size of the first target selected is s i is roughly the same, so it can be expressed by the following formula Probability density function on scores:
[0135]
[0136] in, represents the scale of the pasted example, p(*) represents the probability density, I represents the image, express The probability density function on the score, σ represents the standard deviation, s i Indicates the size of the first target.
[0137] Step 23: Extract a preset number of targets from the second image as second targets.
[0138] See also Figure 4c , this figure is a process diagram for extracting a preset number of second targets provided in an embodiment of the present application, wherein ①, ②, and ③ are extracted from the second image. In this example, the number of second targets is set to 3. In other implementations, the preset number can be determined according to actual conditions and is not specifically limited here.
[0139] Step 24: Overlap a preset number of second targets with the first target and paste them together.
[0140] See also Figure 4d , this figure is a schematic diagram of the overlap of the second target and the first target provided in an embodiment of the present application. It should be noted that the second target extracted from the second image needs to be overlapped with the first target as the center and pasted on the first image.
[0141] As a feasible implementation method, in order to ensure that the second target overlaps with the first target, the pasting position x used in the process of constructing the training image is i ,y i are two independent uniform distributions:
[0142]
[0143]
[0144] Among them, d w and d h It represents the maximum distance that the annotation deviates from the center of the first target, and the coefficient τ>1 and the coefficient ∈>1.
[0145] Step 25: Duplicate the first target to obtain a first sub-target.
[0146] Step 26: Paste the first sub-target to a position that does not overlap with any targets in the first image.
[0147] Step 27: Use the first image containing the first target, the second target and the first sub-target as a training image.
[0148] See also Figure 4e , which is a schematic diagram of a training image provided in an embodiment of the present application, Figure 4e This is the training image finally obtained in steps 21 to 27.
[0149] It should be further explained that the first target and the first sub-target in the training image are the same target, so the confidence of the two should be the same. However, since the first target is occluded, the confidence of the first target will be lower than the confidence of the first sub-target, which will also cause the recognition results of the subsequent target recognition model to be less accurate. Therefore, the training image constructed in this example uses the first sub-target as a control for the first target. The target training model learns through the training image, and can use the confidence distribution of the first target to learn the confidence distribution of the first sub-target, which can improve the recognition accuracy of the target recognition model and make the confidence calculated for the occluded target closer to the confidence of the unobstructed target.
[0150] In this embodiment, through the construction process of the provided training image, image data enhancement can be achieved, and further when the target recognition model to be trained or optimized is trained or optimized, the impact of the occluded target on the confidence distribution can be effectively alleviated.
[0151] Based on the training images constructed in the above embodiment, the present embodiment further provides a training process for a target recognition model, which may include:
[0152] Step 31: Determine a training function according to the training image.
[0153] Step 32: Train the target recognition model to be trained using the training function.
[0154] As an optional implementation, step 31 may specifically include:
[0155] Step 41: Determine a first mean and a first variance of the first target.
[0156] Step 42: Determine the second mean and second variance of the first sub-goal.
[0157] Step 43: Determine a mean square error loss function according to the first mean, the second mean, the first variance, and the second variance as a training function.
[0158] It should be noted that in an embodiment of the present application, the training image includes an occluded first target and an unobstructed first sub-target. By learning the confidence distribution of the unobstructed first sub-target through the confidence distribution of the occluded first target, the confidence of the occluded first target can be improved, that is, the recognition accuracy of the target recognition model can be improved.
[0159] For details, see Figure 5 , which is a schematic diagram of a recognition frame of a training image provided by an embodiment of the present application. The embodiment of the present application further provides a process for determining a training function, which may include:
[0160] Determine the identification boxes of the first target and the first sub-target respectively, such as Figure 5 As shown, the identification box of the first target is P i1 , P i2 , P i3 ; The recognition box of the first sub-target is
[0161] Furthermore, by identifying the box P i and Calculate the first mean μ of the distribution of the first target and the first sub-target respectively i and the first variance σ i , the second mean μ i * and the second variance σ i * :
[0162]
[0163]
[0164] Among them, m and m * P i and The size of , c(*) represents the score of the recognition box prediction.
[0165] On the basis of determining the mean and variance of the first target and the first sub-target, the mean square error loss function L is further determined based on the mean and variance. cl :
[0166]
[0167] in, Represents the set of first targets.
[0168] Among them, L cl As a training function to train the object recognition model.
[0169] It should be noted that, in this embodiment, in order to better reflect the determination process of the above training function, Figure 5 The first target in the training image only overlaps with two second targets. However, in other embodiments, there is more than one first target in the training image, and the number of second targets is not limited to two. Figure 5 It is only an example of a training image and is not intended to limit the scope of protection of this application.
[0170] Based on the image target detection method provided in the above embodiment, the present application embodiment provides an image target detection device, see Figure 6 , which is a schematic diagram of the structure of the image target detection device provided by the embodiment of the present application, combined with Figure 6 As shown, the apparatus 600 may include:
[0171] Receiving module 601, used for receiving the target image to be detected;
[0172] The target recognition module 602 is used to perform target recognition on the target image using a target recognition model to obtain multiple initial targets;
[0173] The target processing module 603 is configured to perform plane processing and depth processing on the multiple initial targets to obtain at least one processed target;
[0174] The target detection module 604 is configured to use the at least one processing target as a target detection result of the target image.
[0175] As an example, the target processing module 603 includes:
[0176] A plane processing module, configured to perform plane processing on the multiple initial targets to obtain targets to be retained and targets to be deduplicated;
[0177] A depth value determination module, configured to determine the depth value of the target to be deduplicated;
[0178] A determination module, configured to determine whether the depth value is greater than or equal to a preset depth value;
[0179] A first target processing submodule, configured to use the target to be deduplicated and the target to be retained as processing targets if the target is greater than or equal to the target;
[0180] The second target processing submodule is configured to take the target to be retained as a processing target if is less than .
[0181] As an example, the depth value determination module includes:
[0182] An overlapping target determining module, configured to determine targets overlapping the target to be deduplicated as overlapping targets;
[0183] An overlap ratio determination module, configured to determine an overlap ratio between the target to be deduplicated and the overlapping target;
[0184] The depth value determination submodule is configured to determine the depth value of the to-be-deduplicated object according to the to-be-deduplicated object, the overlapping object, and the overlapping ratio.
[0185] As an example, the target recognition model is trained in the following manner:
[0186] A receiving unit, configured to receive a first image and a second image;
[0187] a first target determining unit, configured to determine at least one target in the first image as a first target;
[0188] a second target extraction unit, configured to extract a preset number of targets from the second image as second targets;
[0189] a processing unit, configured to overlap and paste a preset number of second objects with the first object;
[0190] a copying unit, configured to copy the first target to obtain a first sub-target;
[0191] a pasting unit, configured to paste the first sub-object to a position which does not overlap with any object in the first image;
[0192] a training image determining unit, configured to use a first image including a first target, a second target, and a first sub-target as a training image;
[0193] a training function determining unit, configured to determine a training function according to the training image;
[0194] The training unit is used to train the target recognition model to be trained using the training function.
[0195] As an example, the training function determination unit includes:
[0196] a first calculation subunit, configured to determine a first mean and a first variance of the first target;
[0197] a second calculation subunit, configured to determine a second mean and a second variance of the first sub-objective;
[0198] The training function determination subunit is used to determine a mean square error loss function according to the first mean, the second mean, the first variance and the second variance as a training function.
[0199] The image target detection device provided in the embodiment of the present application has the same beneficial effects as the image target detection method provided in the above embodiment, so it will not be described in detail.
[0200] The embodiments of the present application also provide corresponding devices and computer storage media for implementing the solutions provided by the embodiments of the present application.
[0201] The device includes a memory and a processor, the memory is used to store instructions or codes, and the processor is used to execute the instructions or codes so that the device executes the image target detection method described in any embodiment of the present application.
[0202] The computer storage medium stores code, and when the code is executed, the device executing the code implements the image target detection method described in any embodiment of the present application.
[0203] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The device and equipment embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.
[0204] The "first" and "second" (if any) in the names mentioned in the embodiments of this application are only used as name identifiers and do not represent the first or second in order.
[0205] Through the description of the above embodiments, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above embodiment methods can be implemented by means of software plus a general hardware platform. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment or certain parts of the embodiments of the present application.
[0206] The above is merely one specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for detecting an image target, characterized in that: The method comprises: Receiving a target image to be detected; Performing target recognition on the target image using a target recognition model to obtain multiple initial targets; Performing plane processing and depth processing on the multiple initial targets, and obtaining at least one processed target based on the depth value of the target to be deduplicated; determining the depth value of the target to be deduplicated, including: determining a target overlapping the target to be deduplicated as an overlapping target; determining an overlap ratio between the target to be deduplicated and the overlapping target; determining the depth value of the target to be deduplicated based on the target to be deduplicated, the overlapping target, and the overlap ratio; The at least one processing target is used as the target detection result of the target image.
2. The image target detection method according to claim 1, characterized in that: The performing plane processing and depth processing on the multiple initial targets to obtain at least one processed target includes: Performing plane processing on the multiple initial targets to obtain targets to be retained and targets to be deduplicated; Determining the depth value of the target to be deduplicated; Determining whether the depth value is greater than or equal to a preset depth value; If it is greater than or equal to, the target to be deduplicated and the target to be retained are taken as processing targets; If it is less than, the target to be retained will be used as the processing target.
3. The image target detection method according to claim 1, characterized in that: The target recognition model is specifically trained in the following way: receiving a first image and a second image; determining at least one object in the first image as a first object; extracting a preset number of targets from the second image as second targets; Overlapping and pasting a preset number of second targets with the first target; Copying the first target to obtain a first sub-target; Pasting the first sub-object to a position that does not overlap with any object in the first image; Using a first image including a first target, a second target, and a first sub-target as a training image; determining a training function according to the training image; The target recognition model to be trained is trained by using the training function.
4. The image target detection method according to claim 3, characterized in that: The determining of the training function according to the training image comprises: determining a first mean and a first variance of the first target; determining a second mean and a second variance of the first sub-goal; A mean square error loss function is determined according to the first mean, the second mean, the first variance, and the second variance as a training function.
5. An image target detection device, characterized in that: The device comprises: A receiving module, configured to receive a target image to be detected; A target recognition module is used to perform target recognition on the target image using a target recognition model to obtain multiple initial targets; An object processing module, configured to perform plane processing and depth processing on the multiple initial objects, and obtain at least one processed object based on the depth value of the object to be deduplicated; an object detection module, configured to use the at least one processing object as an object detection result of the target image; The depth determination module is used to determine the depth value of the target to be deduplicated, including: An overlapping target determining module, configured to determine targets overlapping the target to be deduplicated as overlapping targets; An overlap ratio determination module, configured to determine an overlap ratio between the target to be deduplicated and the overlapping target; The depth value determination submodule is configured to determine the depth value of the to-be-deduplicated object according to the to-be-deduplicated object, the overlapping object, and the overlapping ratio.
6. The image target detection device according to claim 5, characterized in that: The target processing module includes: A plane processing module, configured to perform plane processing on the multiple initial targets to obtain targets to be retained and targets to be deduplicated; A depth value determination module, configured to determine the depth value of the target to be deduplicated; A determination module, configured to determine whether the depth value is greater than or equal to a preset depth value; A first target processing submodule, configured to use the target to be deduplicated and the target to be retained as processing targets if the target is greater than or equal to the target; The second target processing submodule is configured to take the target to be retained as a processing target if is less than .
7. A computer device, characterized in that: include: 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 image target detection method according to any one of claims 1 to 4 is implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the image object detection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Face image detection method and device, terminal equipment and storage medium
CN114170652A
Method and device for detecting target in image
CN114241345A