Target detection method and device, equipment, storage medium and product

By using preset image detection models to detect key point positions on the target object in industrial scenarios, the problem of inefficient target detection caused by unstable edge extraction effect is solved, and more efficient target attitude calculation and detection are achieved.

CN119273890APending Publication Date: 2025-01-07北京阿丘机器人科技有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411335288.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In the prior art, the target detection efficiency is low in industrial scenarios, mainly due to the unstable edge extraction effect and the time-consuming increase with the target attitude range, resulting in a decrease in detection efficiency.

Method used

By obtaining the image to be detected of the target object and inputting it into the preset image detection model, using position detection of multiple key points instead of edge mode comparison of position-by-position attitudes, the target attitude of the target object is calculated, reducing the dependence on edge extraction effect , reduce the time increase caused by changes in attitude range.

Benefits of technology

It improves the efficiency of object detection, reduces detection time, and improves the stability and accuracy of image detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273890A_ABST
    Figure CN119273890A_ABST
Patent Text Reader

Abstract

The invention discloses a target detection method and device, equipment, a storage medium and a product, and relates to the technical field of image processing, and the target detection method comprises the steps: obtaining a to-be-detected image corresponding to a target object; the to-be-detected image is input to a preset image detection model, the to-be-detected image is processed based on the preset image detection model, a detection result is obtained, and the detection result is obtained by detecting the positions of a plurality of key points on a target object. The key points are output when the at least two key points are matched with a preset matching template; and calculating a target attitude of the target object based on the detection result. The detection efficiency of the to-be-detected image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a target detection method, device, equipment, storage medium and computer program product. Background Art

[0002] In industrial scenarios, the shapes of targets on the production line are relatively fixed, but during the production process, it may be necessary to detect, classify, and measure defects on these targets. Therefore, it is necessary to first determine a ROI (Region of Interest) of the target through relevant algorithms, that is, the area in the image that needs special processing, and align its posture.

[0003] At present, the edge extraction and preservation of the template image is mainly carried out through geometric matching. When performing image detection, the same edge extraction is performed on the image to be tested, and the edge pattern of the template image is slid on the image to be tested to calculate whether the edge of each position matches the template. The core of this method is to compare the edge patterns of each position and posture one by one, and whether the edge extraction effect is stable will directly affect the detection effect. The time consumption will increase as the possible posture range of the target increases, which will lead to low target detection efficiency of the algorithm.

[0004] Therefore, how to improve the detection efficiency of target objects in images is a problem that needs to be solved urgently.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The main purpose of this application is to provide a target detection method, device, equipment, storage medium and computer program product, aiming to solve the technical problem of comparing edge patterns of position and posture one by one in the related technology, and whether the edge extraction effect is stable will directly affect the detection effect, and the time consumption will increase as the possible posture range of the target increases, which will lead to low target detection efficiency of the algorithm.

[0007] To achieve the above objectives, the present application proposes a target detection method, which includes:

[0008] Obtain an image to be detected corresponding to the target object;

[0009] Inputting the image to be detected into a preset image detection model, and processing the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is output by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template;

[0010] Based on the detection result, a target posture of the target object is calculated.

[0011] In one embodiment, the step of processing the image to be detected based on the preset image detection model to obtain a detection result includes:

[0012] Based on the preset image detection model, feature conversion is performed on the image to be detected, and a first feature map is output;

[0013] Extracting multiple key points from the first feature map, and performing matching processing on each of the key points using a preset matching template to obtain coarse positioning data;

[0014] Performing segmentation area matching processing on the coarse positioning data to obtain precise positioning data;

[0015] Based on the precise positioning data, a detection result is generated.

[0016] In one embodiment, the step of performing matching processing on each of the key points through a preset matching template to obtain coarse positioning data includes:

[0017] Pairing each of the key points in pairs to generate multiple groups of paired key points;

[0018] Perform matching processing on the paired key points through a preset matching template to generate matching area data;

[0019] The matching area data is filtered to obtain coarse positioning data.

[0020] In one embodiment, the step of performing segmentation area matching processing on the coarse positioning data to obtain precise positioning data includes:

[0021] Performing a disturbance process on the target object within a preset moving range, and extracting first image data obtained after multiple disturbance operations;

[0022] Determining a plurality of pixel positions of a segmented area in the first image data;

[0023] The pixel position and the actual position of the key point are accurately calculated to obtain precise positioning data.

[0024] In one embodiment, the step of calculating the accuracy of the pixel position and the actual position of the key point to obtain precise positioning data includes:

[0025] Calculating a first distance between each of the pixel positions and the actual position of the key point;

[0026] The positioning data corresponding to the minimum value in the first distance is extracted as the precise positioning data.

[0027] In one embodiment, before the step of inputting the image to be detected into a preset image detection model, the method further includes:

[0028] Get training set images;

[0029] Determine a first target instance to be detected in the training set image, and mark a segmented area of ​​the first target instance by rotating a rectangle;

[0030] Based on the segmented area, generating a preset matching template;

[0031] All target instances in the training set image are labeled and located using the preset matching template to obtain a labeling result, and when the labeling result meets a preset error threshold requirement, a trained image detection model is output.

[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a target detection device, which includes:

[0033] A first acquisition module is used to acquire an image to be detected corresponding to the target object;

[0034] A processing module, used for inputting the image to be detected into a preset image detection model, and processing the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is output by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template;

[0035] A calculation module is used to calculate the target posture of the target object based on the detection result.

[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes a target detection device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the target detection method described above.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the target detection method described above are implemented.

[0038] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the target detection method described above are implemented.

[0039] The present application proposes a target detection method, apparatus, equipment, storage medium and computer program product. The present application obtains an image to be detected corresponding to a target object, inputs the image to be detected into a preset image detection model, processes the image to be detected by the preset image detection model, calculates the target posture of the target object according to the obtained detection result, and thus determines the target posture of the target object. Because the detection result is obtained by position detection of multiple key points on the target object rather than by comparing edge patterns of position and posture one by one, it will not be affected by whether the edge extraction effect is stable, and the time consumption will not increase with the possible posture range of the target, thereby reducing the actual target detection time consumption and improving the image detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the target detection method of the present application;

[0043] Figure 2 A schematic diagram of a flow chart provided for the second embodiment of the target detection method of the present application;

[0044] Figure 3 This is a schematic diagram of the overall process involved in the target detection method of this application;

[0045] Figure 4 A schematic diagram of the example annotation process involved in the target detection method of this application;

[0046] Figure 5 This is a schematic diagram of the structure of a preset image detection model involved in the target detection method of this application;

[0047] Figure 6 This is a schematic diagram of the key point detection process involved in the target detection method of this application;

[0048] Figure 7 A schematic diagram of the overall positioning process involved in the target detection method of this application;

[0049] Figure 8 This is a schematic diagram of the rough positioning process involved in the target detection method of this application;

[0050] Fig. 9 A schematic diagram of the detailed positioning process involved in the target detection method of this application;

[0051] Fig.10 A schematic diagram of the matching area score calculation process involved in the target detection method of this application;

[0052] Fig.11 This is a schematic diagram of the module structure of the target detection device according to an embodiment of the present application;

[0053] Fig.12 Schematic diagram of the device structure of the hardware operating environment involved in the target detection method in the embodiment of the present application.

[0054] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0057] The main solutions of the embodiments of this application are:

[0058] Obtain an image to be detected corresponding to the target object;

[0059] Inputting the image to be detected into a preset image detection model, and processing the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is output by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template;

[0060] Based on the detection result, a target posture of the target object is calculated.

[0061] In the prior art, the edge extraction of the template image is mainly carried out and saved by means of geometric matching. When performing image detection, the same edge extraction is performed on the image to be tested, and the edge pattern of the template image is slid on the image to be tested to calculate whether the edge of each position matches the template. The core of this method is to compare the edge patterns of each position and posture one by one, and whether the edge extraction effect is stable will directly affect the detection effect. In addition, the time consumption will increase as the possible posture range of the target increases, which will lead to low target detection efficiency of the algorithm.

[0062] The present application proposes a target detection method, apparatus, equipment, storage medium and computer program product. The present application obtains an image to be detected corresponding to a target object, inputs the image to be detected into a preset image detection model, processes the image to be detected by the preset image detection model, calculates the target posture of the target object according to the obtained detection result, and thus determines the target posture of the target object. Because the detection result is obtained by position detection of multiple key points on the target object rather than by comparing edge patterns of position and posture one by one, it will not be affected by whether the edge extraction effect is stable, and the time consumption will not increase with the possible posture range of the target, thereby reducing the actual target detection time consumption and improving the image detection efficiency.

[0063] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a target detection device, etc. The following takes the target detection device as an example to illustrate this embodiment and the following embodiments.

[0064] Based on this, the present application embodiment provides a target detection method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the target detection method of the present application.

[0065] In this embodiment, the target detection method includes steps S10 to S30:

[0066] Step S10, obtaining an image to be detected corresponding to the target object;

[0067] It should be noted that when the present application is applied to industrial machine vision scenarios, usually before analyzing the target image, it is necessary to first locate the target, extract the detected target area, and then align the object's posture for subsequent processing.

[0068] It should be noted that the target object may be a food packaging bag, a chip, a plug or a cable, or other objects on the production line, without any specific limitation.

[0069] It should be noted that the image to be detected can be image data obtained by photographing the target object with a camera. When performing position detection on the target object, it is necessary to first collect the image of the target object, and then classify the image through the model to determine which category the target object in the image belongs to, so as to determine the object posture.

[0070] Step S20, inputting the image to be detected into a preset image detection model, and processing the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is output by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template;

[0071] It should be noted that the preset image detection model can be a neural network model based on deep learning and used for image detection. Before the image to be detected is input into the model, the preset image detection model has been trained. After the image to be detected is input into the preset image detection model, the image is classified by the neural network in the model to obtain the detection result. The detection result includes which category of image the target object belongs to and the posture of the target object, etc.

[0072] It should be noted that the preset matching template is a template formed by the posture and segmentation area of ​​the target object selected during training. It serves as the benchmark for subsequent image classification. When using model inference, the network outputs the segmentation area of ​​the target object, and the edge of the segmentation area will be used to match the preset matching template, thereby accurately locating the target object.

[0073] It should be noted that the preset image detection model can process the image to be detected in the following way: for each target, output its center position and the four corner points of the rectangular box on the feature map, determine multiple key points on the target object, extract the key point set on the feature map to generate a Proposal (candidate area containing the target object), and finally match each key point with the preset matching template to screen out the required Proposal, and then determine the actual posture of the target object.

[0074] In this embodiment, a total of five points, including four corner points and a center point, are predicted, and then the points are combined to obtain the target-level result. On the one hand, this method transforms the detection problem of a target into the detection problem of multiple key points. As long as at least two points are correctly detected, there will be no over-detection. On the other hand, by completing the instantiation through the key points, the possible postures of the target are locked in a small range, and a more detailed search can be performed on it, resulting in higher accuracy, or less time consumption at the same accuracy.

[0075] Specifically, the overall execution flow chart of this embodiment is as follows: Figure 3 As shown by Figure 3 It can be seen that the processing method of the present application includes a training process and a model reasoning process. First, the training set images are received, and then each target in the training set images is labeled. After the model training is completed, the image to be detected is input into the preset image detection model, the training set images are reasoned, and the posture of the target object is calculated according to the key features of the target.

[0076] In a feasible implementation manner, before the step S20 of inputting the image to be detected into a preset image detection model, the method further includes:

[0077] Get training set images;

[0078] Determine a first target instance to be detected in the training set image, and mark a segmented area of ​​the first target instance by rotating a rectangle;

[0079] It should be noted that the training set images can be image data obtained by photographing plugs, plug wires or other products. During the training process, the main focus is on the labeling process of the target objects, where the labeling process mainly includes two steps: (1) creating a template; and (2) labeling other instances.

[0080] It should be noted that the first target instance is the target object in the training set image. At this time, the type of the target object and the posture of the target object are determined, and the segmented area is a part of the independent area with the characteristics of the target object, and the characteristics of the target object are extracted.

[0081] Based on the segmented area, generating a preset matching template;

[0082] It should be noted that, by selecting the target object and dividing the target object into labeled segmented areas, the segmented areas are used as preset matching templates for subsequent reasoning.

[0083] Specifically, when building a template, you need to select a target, mark the target on the image with a rotated rectangle, and mark the segmented area. In this step, marking the rotated rectangle is to define the benchmark of the target's posture. The marked segmented area will be used for training, and eventually the network can output the target's segmented area, and its edges will be used for matching and precise positioning.

[0084] All target instances in the training set image are labeled and located using the preset matching template to obtain a labeling result, and when the labeling result meets a preset error threshold requirement, a trained image detection model is output.

[0085] It should be noted that after the target object is labeled, other target instances in the training set image are labeled. When labeling other instances, it is sufficient to frame the rotated rectangular bounding boxes on other targets. There is no need to mark their segmented areas. The labeled posture should be basically consistent with the posture when the template was created, and the deviation should not be too large. Otherwise, the subsequent training will not converge.

[0086] It should be noted that the annotation result can be a rectangular frame of each target instance to determine the image features of each instance. Subsequently, a preset matching template is used to match each target instance, and multiple iterations of training are performed. When the error meets the requirements, the model training is completed. The example annotation process diagram involved in this embodiment is as follows: Figure 4 shown.

[0087] In a feasible implementation manner, the step S20 of processing the image to be detected based on the preset image detection model to obtain the detection result includes:

[0088] Based on the preset image detection model, feature conversion is performed on the image to be detected, and a first feature map is output;

[0089] It should be noted that the model structure of the preset image detection model is as follows Figure 5 As shown, the image to be detected is first input into the neural network, and then processed by the neural network to output the key points and segmented areas of the target object, where the target detection MAP is the key point and the area map represents the segmented area.

[0090] It should be noted that after the model receives the image to be detected, it is necessary to first perform feature conversion on the image to be detected to obtain the corresponding feature map, that is, the first feature map.

[0091] Extracting multiple key points from the first feature map, and performing matching processing on each of the key points using a preset matching template to obtain coarse positioning data;

[0092] It should be noted that the process of extracting the key points of each target instance is as follows: Figure 6 As shown in the figure, for each target, its center position and the four corner points of the rectangular box are output on the feature map, a total of 5 points of the Gaussian Kernel. Each point has its own category.

[0093] It should be noted that after outputting the key points of the target object and the segmented area, the overall positioning flow chart is as follows: Figure 7 As shown in the figure, the processing is completed by instantiation using the key points output by the network and completing the rough positioning; then matching is performed based on the edge of the segmented area to complete the fine positioning. The rough positioning link mainly consists of two steps. The first step is proposal generation, and the second step is filtering the generated proposals to filter out obviously incorrect parts based on simple information.

[0094] It should be noted that, each target instance in the first feature map is selected, and multiple key points are generated for each target instance. The number of key points can be 4, 5, etc., and is not specifically limited.

[0095] It should be noted that the coarse positioning data is the candidate area corresponding to the initially generated target instance, including multiple sets of key point sets. These data include a lot of irrelevant data and need to be further filtered.

[0096] Performing segmentation area matching processing on the coarse positioning data to obtain precise positioning data;

[0097] Based on the precise positioning data, a detection result is generated.

[0098] It should be noted that the process of segmenting and matching the coarse positioning data includes the following steps: 1. Proposal expansion: This step will generate all the posture results to be enumerated and evaluated. The coarse positioning results will be disturbed in a small range to generate them.

[0099] The basis of proposal augmentation is the positioning accuracy of key points: under the premise that the key points are extracted correctly, the distance between the detected position and the true value is generally no more than 4 pixels.

[0100] 2. Proposal evaluation: Matching score calculation. After the previous step of amplification, a large number of proposals need to be evaluated. As shown in the figure above, the two red boxes are generated by the previous step of proposal amplification, but which one is finally selected requires an evaluation mechanism.

[0101] It should be noted that after calculating the matching score, the distance between the key point on the image data and each point on the matching template is calculated. When the distance is the smallest, the final positioning is more accurate. Finally, the obtained precise positioning data is the final detection result.

[0102] Step S30: Calculate the target posture of the target object based on the detection result.

[0103] It should be noted that after the data to be detected is classified, the obtained precise positioning data is used as the final output result. The precise positioning data includes the posture of the target object, and the posture of the target object can be calculated by data extraction.

[0104] In a feasible implementation manner, the step of performing matching processing on each of the key points through a preset matching template to obtain coarse positioning data includes:

[0105] Pairing each of the key points in pairs to generate multiple groups of paired key points;

[0106] It should be noted that this step only relies on the key point results output by the network. After obtaining the key point set, the key points are paired with each other to obtain multiple groups of paired key points. Each pair of key points determines a Proposal posture.

[0107] Perform matching processing on the paired key points through a preset matching template to generate matching area data;

[0108] It should be noted that the matching area data is the data of each key point obtained after the key points are matched.

[0109] It should be noted that if Figure 8 As shown, it is assumed that the correct key points are only {A-0, A-1, A-2, A-3} at the four corners of the rectangle. In the figure below, there is an A-1 that has passed the inspection, and there is also an A-2 that has passed the inspection (coincidentally coincides with A-3). In the figure, two Proposals will be generated. The first one is that the template's A-1 and A-2 match the correct A-1 and A-2; the second one is that the template's A-1 matches the wrong A-1, and A-2 matches the wrong A-2. (Of course, other Proposals are also included, such as the Proposal generated by the wrong A-1 and the correct A-0, etc.). These proposals will all be generated and filtered later.

[0110] The robustness of this method lies in the fact that as long as 2 out of 10 key points are correctly detected, the proposal of the target will be proposed and finally retained. Even if the model effect is not very ideal, this goal is not difficult to achieve.

[0111] The matching area data is filtered to obtain coarse positioning data.

[0112] It should be noted that after extracting a large number of rough positioning proposals in the previous step, they are filtered according to the following conditions:

[0113] 1. Whether the scaling scale is consistent with the original template. If the scaling scales in different directions are different, or the scaling scales in all directions are the same but exceed the reasonable scale range of the target itself, it will be eliminated;

[0114] 2. Whether it is close to overlapping with other proposals, and the overlapping ones are removed;

[0115] 3. Whether most of the interior is within the segmentation area. If most of it is not within the segmentation area of ​​the network output segmentation map, it is removed. After the filtering operation is completed, the coarse positioning data is obtained.

[0116] The present application proposes a target detection method, apparatus, equipment, storage medium and computer program product. The present application obtains an image to be detected corresponding to a target object, inputs the image to be detected into a preset image detection model, processes the image to be detected by the preset image detection model, calculates the target posture of the target object according to the obtained detection result, and thus determines the target posture of the target object. Because the detection result is obtained by position detection of multiple key points on the target object rather than by comparing edge patterns of position and posture one by one, it will not be affected by whether the edge extraction effect is stable, and the time consumption will not increase with the possible posture range of the target, thereby reducing the actual target detection time consumption and improving the image detection efficiency.

[0117] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 The step of performing segmentation area matching processing on the coarse positioning data to obtain precise positioning data comprises steps S100 to S300:

[0118] Step S100, performing disturbance processing on the target object within a preset moving range, and extracting first image data obtained after multiple disturbance operations;

[0119] It should be noted that this step will generate all the posture results to be enumerated and evaluated. It will be generated by performing a small range of disturbance on the rough positioning results.

[0120] It should be noted that the preset moving range can be a rotation operation of 5 degrees based on the center point of the target object. After each rotation, the image data of the target object at the current moment after each rotation, that is, the first image data, is recorded.

[0121] Step S200, determining a plurality of pixel positions of a segmented area in the first image data;

[0122] Step S300, performing precision calculation on the pixel position and the position of the key point in the coarse positioning data to obtain precise positioning data.

[0123] It should be noted that the detailed positioning process diagram in this embodiment is as follows Fig. 9 As shown in the figure, the proposal is obtained by correctly matching the template's A-1 and A-2 with the detected key points. Due to the accuracy limit of the key points, the actual position of A-1 and A-2 of the target proposal will not exceed the yellow circle area in the figure below. We only need to enumerate all the cases where A-1 and A-2 are within the yellow circle area.

[0124] If the accuracy requirement is less than sub-pixel, it is only necessary to enumerate the template's A-1 and A-2 to match the integer pixel positions. The number of proposals for subsequent evaluation is in the order of thousands and can be run in parallel, ultimately achieving a balance between accuracy and efficiency.

[0125] In a feasible implementation manner, the step S300 of calculating the accuracy of the pixel position and the actual position of the key point to obtain precise positioning data includes:

[0126] Calculating a first distance between each of the pixel positions and the actual position of the key point;

[0127] It should be noted that the first distance is the actual distance between the pixel position and the actual position of the key point.

[0128] The positioning data corresponding to the minimum value in the first distance is extracted as the precise positioning data.

[0129] Specifically, the matching area score calculation process diagram is as follows: Fig.10 As shown in the figure, after the previous step of amplification, a large number of proposals need to be evaluated. As shown in the figure above, the two red boxes are generated by the previous step of proposal amplification, but which one is finally chosen requires an evaluation mechanism. The specific scoring method is as follows:

[0130] 1. Calculate the shortest distance from all pixels in the image to the contour of the area output by the network (distance transformation). Note that the threshold of the distance transformation map should be set to an upper bound to avoid two points that fail to match and have a large distance to the contour, but the scoring results are inconsistent because one of the distances is smaller than the other (for example, 100 is much smaller than 1000);

[0131] 2. Take the edge template after slight posture change and calculate the sum of the distance values ​​of each point on the template;

[0132] 3. Find the one with the smallest average distance as the final result.

[0133] In this embodiment, instantiation is completed through key points, and the possible postures of the target are locked in a small range, so that a more detailed search can be performed on it to obtain higher accuracy, or less time is consumed under the same accuracy.

[0134] It should be noted that in the present application, the method of precise positioning based on the boundary of the segmented area is compared with the method of extracting edges through edge extraction algorithm and then matching. The boundary of the segmentation map output by deep learning is used for matching, which avoids the problem that the traditional algorithm may be unstable due to interference from local edge features.

[0135] Even if the edge of the segmented area is not very accurate, the edge of the area has the following characteristics: ① There are random "bumps" but the amplitude is almost the same; ② If an error occurs, the general form is a large block of over-detection or missing, and most of the edges are still correct. There will be no overall translation. The problem of inaccurate segmentation area can be overcome by implementing a subsequent robustness scoring mechanism.

[0136] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the target detection method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0137] This application also provides a target detection device, please refer to Fig.11 , the target detection device comprises:

[0138] A first acquisition module 10 is used to acquire an image to be detected corresponding to the target object;

[0139] A processing module 20, configured to input the image to be detected into a preset image detection model, and process the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is outputted by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template;

[0140] The calculation module 30 is used to calculate the target posture of the target object based on the detection result.

[0141] Optionally, the processing module includes:

[0142] A conversion unit, configured to perform feature conversion on the image to be detected based on the preset image detection model, and output a first feature map;

[0143] An extraction unit, used for extracting a plurality of key points from the first feature map, and performing matching processing on each of the key points through a preset matching template to obtain coarse positioning data;

[0144] A processing unit, used for performing segmentation area matching processing on the coarse positioning data to obtain precise positioning data;

[0145] A generating unit is used to generate a detection result based on the precise positioning data.

[0146] Optionally, the extraction unit includes:

[0147] A generating subunit, used for pairing the key points in pairs to generate multiple groups of paired key points;

[0148] A matching processing subunit, used to perform matching processing on the pairing key points through a preset matching template to generate matching area data;

[0149] The filtering processing subunit is used to filter the matching area data to obtain coarse positioning data.

[0150] Optionally, the processing unit includes:

[0151] A disturbance processing subunit, used for performing disturbance processing on the target object within a preset moving range, and extracting first image data obtained after multiple disturbance operations;

[0152] A determination subunit, configured to determine a plurality of pixel positions of a segmented area in the first image data;

[0153] The calculation subunit is used to perform precision calculation on the pixel position and the position of the key point in the coarse positioning data to obtain precise positioning data.

[0154] Optionally, the computing subunit includes:

[0155] A calculation component, used for calculating a first distance between each pixel position and an actual position of the key point;

[0156] The extraction component is used to extract the positioning data corresponding to the minimum value in the first distance as the precise positioning data.

[0157] Optionally, the device further comprises:

[0158] The second acquisition module is used to acquire training set images;

[0159] A determination module, used to determine a first target instance to be detected in the training set image, and mark a segmented area of ​​the first target instance by rotating a rectangle;

[0160] A generating module, used for generating a preset matching template based on the segmented area;

[0161] The labeling and positioning module is used to label and position all target instances in the training set image through the preset matching template to obtain labeling results, and output the trained image detection model when the labeling results meet the preset error threshold requirements.

[0162] The target detection device provided by the present application adopts the target detection method in the above embodiment to solve the technical problem of target detection. Compared with the prior art, the beneficial effects of the target detection device provided by the present application are the same as the beneficial effects of the target detection method provided by the above embodiment, and other technical features in the target detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0163] The present application provides a target detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the target detection method in the above-mentioned embodiment one.

[0164] Reference below Fig.12 , which shows a schematic diagram of the structure of a target detection device suitable for implementing the embodiment of the present application. The target detection device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.12 The target detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0165] like Fig.12 As shown, the target detection device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the target detection device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the target detection device to communicate with other devices wirelessly or by wire to exchange data. Although the target detection device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0166] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0167] The target detection device provided by the present application adopts the target detection method in the above embodiment to solve the technical problem of target detection. Compared with the prior art, the beneficial effects of the target detection device provided by the present application are the same as the beneficial effects of the target detection method provided by the above embodiment, and the other technical features in the target detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0168] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0169] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0170] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the target detection method in the above-mentioned embodiment.

[0171] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0172] The computer-readable storage medium may be included in the target detection device; or may exist independently without being assembled into the target detection device.

[0173] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the target detection device, the target detection device:

[0174] Obtain an image to be detected corresponding to the target object;

[0175] Inputting the image to be detected into a preset image detection model, and processing the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is output by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template;

[0176] Based on the detection result, a target posture of the target object is calculated.

[0177] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0178] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0179] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0180] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned target detection method, and can solve the technical problem of target detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the target detection method provided in the above-mentioned embodiment, and will not be repeated here.

[0181] The present application also provides a computer program product, including a computer program, which implements the steps of the target detection method as described above when executed by a processor.

[0182] The computer program product provided by the present application can solve the technical problem of target detection. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the target detection method provided by the above embodiment, which will not be repeated here.

[0183] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A target detection method, characterized in that: The method comprises: Obtain an image to be detected corresponding to the target object; Inputting the image to be detected into a preset image detection model, and processing the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is output by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template; Based on the detection result, a target posture of the target object is calculated.

2. The method according to claim 1, characterized in that The step of processing the image to be detected based on the preset image detection model to obtain a detection result includes: Based on the preset image detection model, feature conversion is performed on the image to be detected, and a first feature map is output; Extracting multiple key points from the first feature map, and performing matching processing on each of the key points using a preset matching template to obtain coarse positioning data; Performing segmentation area matching processing on the coarse positioning data to obtain precise positioning data; Based on the precise positioning data, a detection result is generated.

3. The method according to claim 2, characterized in that The step of matching each of the key points using a preset matching template to obtain coarse positioning data includes: Pairing each of the key points in pairs to generate multiple groups of paired key points; Perform matching processing on the paired key points through a preset matching template to generate matching area data; The matching area data is filtered to obtain coarse positioning data.

4. The method according to claim 2, characterized in that The step of performing segmentation area matching processing on the coarse positioning data to obtain precise positioning data comprises: Performing a disturbance process on the target object within a preset moving range, and extracting first image data obtained after multiple disturbance operations; Determining a plurality of pixel positions of a segmented area in the first image data; The pixel position and the position of the key point in the coarse positioning data are subjected to precision calculation to obtain precise positioning data.

5. The method according to claim 4, characterized in that The step of calculating the accuracy of the pixel position and the actual position of the key point to obtain precise positioning data includes: Calculating a first distance between each of the pixel positions and the actual position of the key point; The positioning data corresponding to the minimum value in the first distance is extracted as the precise positioning data.

6. The method according to claim 1, characterized in that Before the step of inputting the image to be detected into a preset image detection model, the method further includes: Get training set images; Determine a first target instance to be detected in the training set image, and mark a segmented area of ​​the first target instance by rotating a rectangle; Based on the segmented area, generating a preset matching template; All target instances in the training set image are labeled and located using the preset matching template to obtain a labeling result, and when the labeling result meets a preset error threshold requirement, a trained image detection model is output.

7. A target detection device, characterized in that: The device comprises: A first acquisition module is used to acquire an image to be detected corresponding to the target object; A processing module, used for inputting the image to be detected into a preset image detection model, and processing the image to be detected based on the preset image detection model to obtain a detection result, wherein the detection result is output by performing position detection on multiple key points on the target object and when at least two of the key points match a preset matching template; A calculation module is used to calculate the target posture of the target object based on the detection result.

8. A target detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the target detection method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the target detection method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the target detection method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Dimension measurement method and device, equipment and storage medium

    CN119904504A