An image detection method, device, and computer-readable storage medium
By using the feature similarity between the detection feature template and the recognition feature template for secondary judgment in target detection, the problem of low target detection accuracy in the prior art is solved, and higher detection accuracy and reliability are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-12
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies for target detection in industry require the collection of large amounts of data for model training for each target type, resulting in long data cycles and low detection accuracy.
By extracting features from the detected image, and using the feature similarity between the detection feature template and the recognition feature template, a secondary judgment of the target detection result is made, including the determination of the feature sequence set and similarity calculation, to screen out accurate target detection features.
It improves the accuracy of target detection and reduces the false detection rate. Through secondary recognition and judgment of template features, it enhances the accuracy and reliability of target detection.
Smart Images

Figure CN116612302B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, and in particular to an image detection method, device, and computer-readable storage medium. Background Technology
[0002] The development of artificial intelligence has led to the increasing application of intelligent target detection devices in industry. In the intelligent transformation of industries, target detection functions include face detection, detection of specific targets within a region, and counting of specific targets. Traditional development methods require collecting large amounts of data for model training for each target type. This approach has a long data collection cycle, and model training relies on the target detection features of general sample data. Using the model to detect specific targets results in low image detection accuracy. Summary of the Invention
[0003] The main technical problem solved by this invention is to provide an image detection method, device and computer-readable storage medium that can perform secondary judgment on the target detection results and improve the recognition accuracy.
[0004] To address the aforementioned technical problems, one technical solution adopted by this invention is: providing an image detection method, which includes: extracting features from a detection image to obtain image features; performing target detection on the detection image based on each detection feature template in a detection feature template set and the image features, respectively, to obtain a target detection feature set, wherein the target detection features in the target detection feature set represent the target location information detected in the detection image; performing target recognition on each target detection feature in the target detection feature set, respectively, to obtain a target recognition feature set; and determining whether the target detection feature corresponding to each target recognition feature can be used as the target detection result of the detection image based on the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set. Wherein, each detection feature template in the detection feature template set is obtained by extracting features from a template image, and each recognition feature template in the recognition feature template set is obtained by recognizing a target from the template image.
[0005] Specifically, determining whether a target detection feature corresponding to each target recognition feature can be used as the target detection result of the detection image, based on the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set, includes: determining at least one feature sequence set representing each target recognition feature and one feature sequence set representing each recognition feature template; calculating the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set based on the determined feature sequence set; and using the target detection feature corresponding to the target recognition feature with a feature similarity greater than the feature similarity threshold as the target detection result of the detection image.
[0006] The process of determining at least one of the feature sequence set representing each target identification feature and the feature sequence set representing each identification feature template includes: determining the feature sequence set representing each target identification feature; and calculating the feature similarity between each target identification feature in the target identification feature set and each identification feature template in the identification feature template set based on the determined feature sequence set includes: calculating the feature similarity between each identification feature template in the target identification feature set and the identification feature template set.
[0007] The process of determining at least one of the feature sequence set representing each target identification feature and the feature sequence set representing each identification feature template includes: determining the feature sequence set representing each identification feature template; and calculating the feature similarity between each target identification feature in the target identification feature set and each identification feature template in the identification feature template set based on the determined feature sequence set includes: calculating the feature similarity between each target identification feature in the target identification feature set and the feature sequence set of the identification feature template.
[0008] Among them, determining at least one of the feature sequence set representing each target recognition feature and the feature sequence set representing each recognition feature template includes: determining the feature sequence set representing the target recognition feature and the feature sequence set representing each recognition feature template; calculating the feature similarity between the feature sequence set representing the target recognition feature and the feature sequence set representing each recognition feature template.
[0009] The process of determining the feature sequence set representing the target recognition features includes: calculating the first target cosine distance between the target recognition features and each recognition feature template; and determining the feature sequence set of the target recognition features based on the recognition feature template corresponding to the minimum first preset number of first target cosine distances.
[0010] The process of determining the feature sequence set of target recognition features based on the recognition feature templates corresponding to the minimum first preset number of first target cosine distances includes: calculating the second target cosine distance between each first preset number of recognition feature templates and the remaining recognition feature templates; determining the second preset number of remaining recognition feature templates corresponding to the minimum second preset number of second target cosine distances; and using the second preset number of remaining recognition feature templates corresponding to each first preset number of recognition feature templates and the first preset number of recognition feature templates as the feature sequence set of target recognition features.
[0011] The feature sequence set representing each identification feature template includes: calculating the first template cosine distance between each identification feature template; and determining the feature sequence set of the identification feature template based on the identification feature template corresponding to the smallest third preset number of first template cosine distances.
[0012] The process of determining the feature sequence set of the identification feature template based on the identification feature template corresponding to the minimum third preset number of first template cosine distances includes: calculating the second template cosine distance between each third preset number of identification feature templates and the remaining identification feature templates; determining the fourth preset number of remaining identification feature templates corresponding to the minimum fourth preset number of second template cosine distances; and using the fourth preset number of remaining identification feature templates and the third preset number of identification feature templates corresponding to each third preset number of identification feature templates as the feature sequence set of the identification feature template.
[0013] The calculation of the feature similarity between the feature sequence set representing the target recognition features and the feature sequence set representing each recognition feature template includes: calculating the average cosine distance between each feature in the feature sequence set representing the target recognition features and each feature in the feature sequence set representing each recognition feature template.
[0014] The method for obtaining the detection feature template set includes: extracting features from multiple template images; clustering the feature extraction results to obtain multiple feature sets; and fusing the features in the feature sets to obtain the detection feature templates in the detection feature template set.
[0015] The process of fusing features from the feature set to obtain the detection feature templates in the detection feature template set includes: obtaining the number of features in the feature set; and deleting features from the feature set when the number of features in the feature set is less than a first threshold.
[0016] The method for obtaining the recognition feature template set includes: performing image recognition on multiple template images; clustering the image recognition results to obtain multiple recognition sets; obtaining the number of features in the recognition sets; when the number of features in the recognition sets is less than a second threshold, deleting the recognition sets; obtaining the features in the retained recognition sets; and obtaining the recognition feature templates in the recognition feature template set.
[0017] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is to provide an image detection device, which includes a processor for executing the above-mentioned image detection method.
[0018] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is to provide a computer-readable storage medium for storing instruction / program data, which can be executed to implement the above-mentioned image detection method.
[0019] The beneficial effects of this invention are as follows: Unlike the prior art, this invention detects the corresponding target of the feature template in the detection image, performs further target recognition on the obtained target detection features, determines the accuracy of the target recognition features of the image by the feature similarity between the target recognition features and the recognition template, and further characterizes the accuracy of the target detection result corresponding to the target recognition result, thereby enabling the selection of target detection features that can be used as the target detection result. Therefore, this application uses template features to perform secondary recognition and judgment of target detection features, and further improves the accuracy of target detection by using target recognition. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating one embodiment of the image detection method of this application;
[0021] Figure 2 This is a flowchart illustrating one implementation of the feature similarity calculation method of this application;
[0022] Figure 3 This is a flowchart illustrating a specific implementation of the image detection method of this application;
[0023] Figure 4 This is a flowchart illustrating one embodiment of the method for obtaining detection feature templates according to this application;
[0024] Figure 5 This is a flowchart illustrating one embodiment of the method for obtaining identification feature templates according to this application;
[0025] Figure 6 This is a schematic diagram of the structure of the image detection device in the embodiments of this application;
[0026] Figure 7 This is a schematic diagram of the structure of the image detection device in the embodiments of this application;
[0027] Figure 8 This is a schematic diagram of the structure of a computer-readable storage medium in an embodiment of this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and effects of the present invention clearer and more explicit, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0029] This application provides an image detection method that determines the accuracy of the target recognition features of an image by the feature similarity between the target recognition features and the recognition template, and further characterizes the accuracy of the target detection result corresponding to the target recognition result. In this way, the target detection features that can be used as the target detection result can be selected. Therefore, this application uses template features to perform secondary recognition and judgment on the target detection features, and uses target recognition to further improve the accuracy of target detection.
[0030] Please see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the image detection method of this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily reflect that result. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, this embodiment includes:
[0031] S110: Extract image features from the detected image.
[0032] The first feature extraction model is used to perform preliminary feature extraction on the detection image to obtain image detection features with the same detection degree as the detection feature template.
[0033] S130: Based on each detection feature template in the detection feature template set and the image features, perform target detection on the detection image to obtain the target detection feature set.
[0034] A set of detection feature templates is pre-defined based on a template image. Each detection feature template in the set is obtained by extracting features from the template image. These templates provide a reference for the detection image. By comparing each template with the image features, the target corresponding to the template is detected from the detection image, resulting in a target detection feature set. The target detection features in this set represent the location information of the detected target in the detection image.
[0035] S150: Perform target recognition on each target detection feature in the target detection feature set to obtain the target recognition feature set.
[0036] Furthermore, the target recognition features obtained in the above steps may contain false detections. Therefore, based on the detection of the target, target recognition is performed on each target detection feature in the target detection feature set, and the accuracy of the target recognition features is further judged using the target recognition features.
[0037] S170: Based on the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set, determine whether the target detection feature corresponding to each target recognition feature can be used as the target detection result of the detection image.
[0038] In this system, each recognition feature template in the recognition feature template set is obtained by performing target recognition on a template image. The similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set is compared. The accuracy of the target recognition feature is determined based on the similarity magnitude, thereby indirectly judging whether the corresponding target recognition feature is accurate and determining whether the target detection feature corresponding to each target recognition feature can be used as the target detection result of the detected image.
[0039] In this embodiment, the accuracy of the target recognition features of the image is determined by the feature similarity between the target recognition features and the recognition template, and the accuracy of the target detection result corresponding to the target recognition result is further characterized. Thus, the target detection features that can be used as the target detection result can be selected. Therefore, this application uses template features to perform secondary recognition and judgment on the target detection features, and uses target recognition to further improve the accuracy of target detection.
[0040] Please see Figure 2 , Figure 2 This is a flowchart illustrating one embodiment of the feature similarity calculation method of this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily reflect that result. Figure 2 The illustrated process sequence is limited. For example... Figure 2 As shown, this embodiment includes:
[0041] S210: Determine at least one of the feature sequence sets representing the identification features of each target and one of the feature sequence sets representing the templates of each identification feature.
[0042] In one embodiment, only the feature sequence set representing each target identification feature is determined, that is, multiple identification feature templates are selected as the target identification feature set for each target identification feature; the first target cosine distance between the target identification feature and each identification feature template is calculated; the feature sequence set of the target identification feature is determined based on the identification feature templates corresponding to the smallest first preset number of first target cosine distances. Specifically, the second target cosine distance between each first preset number of identification feature templates and the remaining identification feature templates is calculated; the second preset number of remaining identification feature templates corresponding to the smallest second preset number of second target cosine distances are determined; the second preset number of remaining identification feature templates corresponding to each first preset number of identification feature templates and the first preset number of identification feature templates are used as the feature sequence set of the target identification feature. Specifically, the cosine distance between each target identification feature and the identification feature template is calculated and sorted, and the z identification feature templates corresponding to the smallest z cosine distances are selected; the cosine distance between the z identification feature templates and the remaining identification feature templates is calculated and sorted, and the y identification feature templates corresponding to the smallest y cosine distances are selected for each feature in the z identification feature templates; the z+z×y identification feature templates are used as the target identification feature set.
[0043] In another embodiment, a feature sequence set representing each identification feature template is determined, i.e., multiple identification feature templates are selected as an identification feature template set for each identification feature template; a first template cosine distance is calculated between each identification feature template; and a feature sequence set for the identification feature template is determined based on the identification feature template corresponding to the smallest third preset number of first template cosine distances. Specifically, a second template cosine distance is calculated between each third preset number of identification feature templates and the remaining identification feature templates; a fourth preset number of remaining identification feature templates corresponding to the smallest fourth preset number of second template cosine distances are determined; and the fourth preset number of remaining identification feature templates corresponding to each third preset number of identification feature templates and the third preset number of identification feature templates are used as the feature sequence set for the identification feature template. Specifically, the cosine distance between each identification feature template and other identification feature templates is calculated and sorted, and the n identification feature templates corresponding to the smallest n cosine distances are selected; the cosine distance between the n identification feature templates and the remaining identification feature templates is calculated and sorted, and the m identification feature templates corresponding to the smallest m cosine distances are selected for each feature in the n identification feature templates; and the n+n×m identification feature templates are used as the identification feature template set.
[0044] In another embodiment, a feature sequence set representing the target recognition feature and a feature sequence set representing each recognition feature template are determined. Specifically, multiple recognition feature templates are selected for each target recognition feature as the target recognition feature set, and then multiple recognition feature templates are selected for each recognition feature template as the recognition feature template set. The cosine distance between the target recognition feature set and the recognition feature template set is calculated. Optionally, the average cosine distance between each feature in the target recognition feature set and each feature in the recognition feature template set is calculated as the cosine distance between the target recognition feature set and the recognition feature template set. Specifically, the cosine distance between each target recognition feature and the recognition feature template is calculated and sorted, and the z recognition feature templates corresponding to the smallest z cosine distances are selected. The cosine distances between the z recognition feature templates and the remaining recognition feature templates are calculated and sorted, and the y recognition feature templates corresponding to the smallest y cosine distances are selected for each feature in the z recognition feature templates. The z + z × y recognition feature templates are used as the target recognition feature set. Then, calculate and sort the cosine distances between each recognition feature template and other recognition feature templates, and select the n recognition feature templates corresponding to the smallest n cosine distances; calculate and sort the cosine distances between the n recognition feature templates and the remaining recognition feature templates, and select the m recognition feature templates corresponding to the smallest m cosine distances for each feature in the n recognition feature templates; and use the n+n×m recognition feature templates as the recognition feature template set.
[0045] S230: Calculate the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set based on the determined feature sequence set.
[0046] In one embodiment, a feature sequence set representing each target identification feature is determined, and the feature similarity between the feature sequence set of the target identification features and each identification feature template in the identification feature template set is calculated. Specifically, the cosine distance between each feature in the target identification feature set and the identification feature template is calculated and the average value is obtained.
[0047] In another embodiment, a feature sequence set representing each identification feature template is determined, and the feature similarity between each target identification feature in the target identification feature set and the feature sequence set of the identification feature template is calculated. Specifically, the cosine distance between the target identification feature and each feature in the identification feature template set is calculated, and the average of the cosine distances is taken.
[0048] In another embodiment, a feature sequence set representing the target identification features and a feature sequence set representing each identification feature template are determined, and the feature similarity between the feature sequence set representing the target identification features and the feature sequence set representing each identification feature template is calculated. Specifically, the cosine distance between each feature in the target identification feature set and each feature in the identification feature template set is calculated, and the average value of the cosine distances is obtained.
[0049] S250: The target detection feature corresponding to the target recognition feature with a feature similarity greater than the feature similarity threshold is taken as the target detection result of the detection image.
[0050] The multiple cosine distances obtained above are sorted, and the target detection features corresponding to the target recognition features with feature similarity greater than the feature similarity threshold are taken as the target detection results of the detection image.
[0051] In this embodiment, a re-sorting strategy is adopted in the secondary confirmation process of target detection results using recognition feature templates. That is, the number of features in the target recognition feature set and the recognition feature template set is increased, making the filtering results more robust and reducing the risk of false filtering while filtering false detections.
[0052] Please see Figure 3 , Figure 3 This is a flowchart illustrating a specific implementation of the image detection method of this application. It should be noted that if substantially the same result is obtained, this embodiment is not necessarily identical. Figure 3 The illustrated process sequence is limited. For example... Figure 3 As shown, this embodiment includes:
[0053] First, detection feature templates and recognition feature templates are obtained in advance. This step is completed offline. Please refer to [link to relevant documentation]. Figure 4 , Figure 4 This is a flowchart illustrating one embodiment of the method for obtaining detection feature templates according to this application. It should be noted that if substantially the same result is obtained, this embodiment is not necessarily identical. Figure 4 The illustrated process sequence is limited. For example... Figure 4 As shown, this embodiment includes:
[0054] S410: Extract features from multiple template images.
[0055] N known target images are selected as registration templates, and features are extracted using detection model M1 to obtain n features f. s1 ,f s2 ,f s3 ,…f sm The detection model is based on ResNet50 as the backbone.
[0056] S430: Cluster the feature extraction results to obtain multiple feature sets.
[0057] The N features extracted in step S410 are clustered using a clustering algorithm such as DBSCAN to generate n1 feature sets, which are c s1 ,c s2 ,c s3 ,…c sn1 .
[0058] Furthermore, the features in the n1 feature sets may contain features of poor quality. Therefore, outlier removal is performed on the n1 feature sets to obtain the number of features in each set. If the number of features in a feature set is less than a first threshold, the feature set is deleted. Specifically, when the number of features in each feature set is less than the threshold T... c If a feature within a given feature set is considered an outlier, meaning the template selection for that feature is of poor quality and will negatively impact detection performance, it is removed, and a new feature set c is generated. s1 ,c s2 ,c s3 ,…c sm1 .
[0059] S450: Fuse features from the feature set to obtain multiple detection feature templates.
[0060] Feature fusion is performed on the generated feature set to reduce the number of features and decrease the overall algorithm time. Simultaneously, feature fusion yields comprehensive information, improving detection performance and achieving a higher recall rate. Specifically, the feature set c... sj All features within the template are fused to obtain the final detection feature template F. s1 ,F s2 ,F s3 ,…Fsm1 .
[0061] Please see Figure 5 , Figure 5 This is a flowchart illustrating one embodiment of the method for obtaining identification feature templates according to this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily reflect that outcome. Figure 5 The illustrated process sequence is limited. For example... Figure 5 As shown, this embodiment includes:
[0062] S510: Perform image recognition on multiple template images.
[0063] Similarly, for N known target images, the corresponding features f are extracted using the recognition model M. i1 ,f i2 ,f i3 ,…f iN Among them, the recognition model M is a target recognition model trained based on ResNet34.
[0064] S530: Cluster the image recognition results to obtain multiple recognition sets.
[0065] The N features extracted in step S510 are clustered using a clustering algorithm such as DBSCAN to generate n² recognition sets, which are c i1 ,c i2 ,c i3 ,…c in2 .
[0066] Furthermore, the features in the n² identification sets may include low-quality features. Therefore, outlier removal is performed on the n² identification sets to obtain the number of features in each set. When the number of features in an identification set is less than a second threshold, the set is deleted. Specifically, when the number of features in each identification set is less than the threshold T... e If a feature within the identification set is considered an outlier, meaning the template selection for that feature is of poor quality and will affect the detection performance, it will be removed, and a new identification set c will be generated. i1 ,c i2 ,c i3 ,…c im2 .
[0067] S550: Updated multiple recognition feature templates.
[0068] The generated recognition set is updated to obtain the final recognition feature template F. i1 ,F i2 ,F i3 ,…F ik .
[0069] Then, a smart device is used to acquire the detection image and extract image detection features. The detection model M1 is used to extract features from the detection image, obtaining image detection features F. The image detection features and the detection feature template are then used together for detection to obtain the target recognition features. Specifically, the automatically generated detection feature template F... s1 ,F s2 ,F s3 ,…F sm1 The image detection features F are fed into the detection model M2 to obtain the detection result D. d1 D d2 D d3 ,…D dx Among them, the detection model M2 is a CNN-based regression and analysis model, D di This represents the bounding box of the detected target in the image, i.e., the location information.
[0070] The above output detection results may contain false detections. Therefore, the target recognition features are screened and detected using recognition feature templates to determine the accuracy of the target recognition features.
[0071] Specifically, the detection results are used to extract the corresponding features F using the recognition model M. d1 ,F d2 ,F d3 ,…F dx The set of recognition feature templates and the set of target recognition features are obtained by using recognition feature templates and target recognition features respectively for feature comparison.
[0072] For the target recognition feature set, the target recognition feature F di With the recognition feature template F i1 ,F i2 ,F i3 ,…F ik Calculate the cosine distance for each feature, and sort the calculated cosine distances to obtain the sorted result d = [d]. di,i1 ,d di,i2 ,d di,i3 ,…d di,ij ], where d di,ij Representing feature F di With feature F ij The cosine distance between them. Then, from the j cosine distances in the sorted results, select the z features with the largest cosine distance as the extended combination E(F). di ,z)={F i1 ,F i2 ,F i3 ,…F izThen, the cosine distances between the z features in the extended set and the remaining jz features are calculated, and the y features with the largest cosine distances are selected as the extended set E(F). ij Finally, we obtain the complete extended set N(F). di ,t)={E(F di ,z),E(F ij ,y)} is the target recognition feature set, where t=z+z×y.
[0073] Similarly, for the feature template set, the cosine distance is calculated between each of the k feature templates and the remaining k-1 feature templates, and the calculated cosine distances are sorted. Then, the 'a' features with the largest cosine distances in the sorted results are used as the extended set. Next, the cosine distances of the 'a' features in this extended set are calculated with the remaining features, and the 'b' features with the largest cosine distances are selected as the extended set. Finally, a + a × b extended sets are obtained as the feature template set.
[0074] Using the obtained target recognition feature set and feature template set, the target recognition feature F is recalculated. di With the recognition feature template F ij Feature similarity:
[0075]
[0076] The results are sorted, and the result with the largest value is selected as the feature similarity between the target feature and the feature template. When the feature similarity is greater than the feature similarity threshold T, the result is considered a feature similarity. s If the result is correct, the algorithm will retain it; otherwise, it will consider the result a false positive and will not output a result.
[0077] In this implementation, by pre-setting template features, the system can automatically generate and filter templates while simultaneously detecting targets through registration. This reduces computation time, lowers the barrier to entry for users, and makes the product easier to use and improves detection results. Further target identification is performed on the target detection results, and the pre-extracted detection and identification feature templates are used for secondary verification, improving the accuracy of the model output and reducing false alarms. Simultaneously, a re-sorting strategy is employed during the secondary verification process to make the filtering results more robust, reducing the risk of false filtering while filtering out false positives.
[0078] Please see Figure 6 , Figure 6 This is a schematic diagram of the image detection device according to an embodiment of this application. In this embodiment, the image detection device includes an extraction module 61, a detection module 62, a recognition module 63, and a determination module 64.
[0079] The image detection device comprises the following modules: an extraction module 61 extracts features from the detected image to obtain image features; a detection module 62 performs target detection on the detected image based on each detection feature template in the detection feature template set and the image features, respectively, to obtain a target detection feature set, where the target detection features represent the location information of the detected target in the detected image; a recognition module 63 performs target recognition on each target detection feature in the target detection feature set, respectively, to obtain a target recognition feature set; and a determination module 64 determines whether the target detection feature corresponding to each target recognition feature can be used as the target detection result of the detected image based on the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set. This image detection device further performs target recognition on the obtained target detection features by detecting the corresponding target in the detection image and determining the accuracy of the target recognition features of the image by the feature similarity between the target recognition features and the recognition template, further characterizing the accuracy of the target detection result corresponding to the target recognition result. Therefore, this application utilizes template features for secondary recognition and judgment of target detection features, and further improves the accuracy of target detection by utilizing target recognition.
[0080] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an image detection device according to an embodiment of this application. In this embodiment, the image detection device 71 includes a processor 72.
[0081] Processor 72 can also be referred to as a CPU (Central Processing Unit). Processor 72 may be an integrated circuit chip with signal processing capabilities. Processor 72 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor, or processor 72 can be any conventional processor.
[0082] The image detection device 71 may further include a memory (not shown) for storing instructions and data required for the processor 72 to run.
[0083] The processor 72 is used to execute instructions to implement the method provided by any embodiment of the image detection method of this application and any non-conflicting combination thereof.
[0084] Please see Figure 8 , Figure 8This is a schematic diagram of the structure of a computer-readable storage medium in an embodiment of this application. The computer-readable storage medium 81 in this embodiment stores instruction / program data 82. When executed, this instruction / program data 82 implements the method provided by any embodiment of the image detection method of this application and any non-conflicting combination thereof. The instruction / program data 82 can be formed into a program file and stored in the storage medium 81 in the form of a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) or processor can execute all or part of the steps of the methods in various embodiments of this application. The aforementioned storage medium 81 includes various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or terminal devices such as computers, servers, mobile phones, and tablets.
[0085] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0086] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0087] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. An image detection method, characterized in that, The method includes: Image features are obtained by extracting features from the detected image; Target detection is performed on the detection image based on each detection feature template in the detection feature template set and the image features, respectively, to obtain a target detection feature set. The target detection features in the target detection feature set represent the target location information detected in the detection image. Each target detection feature in the target detection feature set is used for target recognition to obtain a target recognition feature set. Based on the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set, it is determined whether the target detection feature corresponding to each target recognition feature can be used as the target detection result of the detection image; Wherein, each detection feature template in the detection feature template set is obtained by extracting features from the template image, and each recognition feature template in the recognition feature template set is obtained by recognizing the target from the template image.
2. The image detection method according to claim 1, characterized in that, The step of determining whether the target detection feature corresponding to each target recognition feature can be used as the target detection result of the detection image based on the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set includes: At least one of the feature sequence set representing each of the target identification features and one of the feature sequence set representing each of the identification feature templates are determined; Based on the determined feature sequence set, calculate the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set; The target detection feature corresponding to the target recognition feature whose feature similarity is greater than the feature similarity threshold is taken as the target detection result of the detection image.
3. The image detection method according to claim 2, characterized in that, The determination of at least one of the feature sequence sets representing each of the target recognition features and the feature sequence sets representing each of the recognition feature templates includes: Determine the feature sequence set representing the identification features of each of the aforementioned targets; The calculation of the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set based on the determined feature sequence set includes: Calculate the feature similarity of each recognition feature template in the feature sequence set and the recognition feature template set of the target recognition features.
4. The image detection method according to claim 2, characterized in that, The determination of at least one of the feature sequence sets representing each of the target recognition features and the feature sequence sets representing each of the recognition feature templates includes: Determine the feature sequence set representing each of the aforementioned identification feature templates; The calculation of the feature similarity between each target recognition feature in the target recognition feature set and each recognition feature template in the recognition feature template set based on the determined feature sequence set includes: Calculate the feature similarity between each target recognition feature in the target recognition feature set and the feature sequence set of the recognition feature template.
5. The image detection method according to claim 2, characterized in that, The determination of at least one of the feature sequence sets representing each of the target recognition features and the feature sequence sets representing each of the recognition feature templates includes: Determine the feature sequence set representing the target recognition features and the feature sequence set representing each of the recognition feature templates; Calculate the feature similarity between the feature sequence set of the target recognition features and the feature sequence set representing each of the recognition feature templates.
6. The image detection method according to any one of claims 3 or 5, characterized in that, The determination of the feature sequence set representing the target recognition features includes: Calculate the first target cosine distance between the target recognition features and each of the recognition feature templates; The feature sequence set of the target recognition features is determined based on the recognition feature templates corresponding to the minimum first preset number of the first target cosine distances.
7. The image detection method according to claim 6, characterized in that, The feature sequence set for determining the target recognition features based on the recognition feature templates corresponding to the minimum first preset number of the first target cosine distances includes: Calculate the second target cosine distance between each of the first preset number of recognition feature templates and the remaining recognition feature templates; Determine the second preset number of remaining recognition feature templates corresponding to the minimum second preset number of second target cosine distances; The remaining second preset number of recognition feature templates corresponding to each of the first preset number of recognition feature templates and the first preset number of recognition feature templates are used as the feature sequence set of the target recognition feature.
8. The image detection method according to any one of claims 4 or 5, characterized in that, The feature sequence set representing each of the aforementioned identification feature templates includes: Calculate the first template cosine distance between each of the identified feature templates; The feature sequence set of the recognition feature template is determined based on the recognition feature template corresponding to the minimum third preset number of the first template cosine distance.
9. The image detection method according to claim 8, characterized in that, The feature sequence set of the recognition feature templates determined based on the recognition feature templates corresponding to the minimum third preset number of the first template cosine distances includes: Calculate the second template cosine distance between each of the third preset number of recognition feature templates and the remaining recognition feature templates; Determine the minimum fourth preset number of remaining recognition feature templates corresponding to the fourth preset number of second template cosine distances; The remaining fourth preset number of identification feature templates corresponding to each of the third preset number of identification feature templates and the third preset number of identification feature templates are used as the feature sequence set of the identification feature templates.
10. The image detection method according to claim 5, characterized in that, The calculation of the feature sequence set of the target recognition features and the feature sequence set representing each of the recognition feature templates includes: Calculate the average cosine distance between each feature in the feature sequence set of the target recognition feature and each feature in the feature sequence set of each recognition feature template.
11. The image detection method according to claim 1, characterized in that, The method for obtaining the detection feature template set includes: Feature extraction is performed on multiple template images; Clustering of the feature extraction results yields multiple feature sets; By fusing the features in the feature set, a detection feature template in the detection feature template set is obtained.
12. The image detection method according to claim 11, characterized in that, Before fusing the features in the feature set to obtain the detection feature template in the detection feature template set, the following steps are included: Obtain the number of features in the feature set. When the number of features in the feature set is less than a first threshold, delete the feature set.
13. The image detection method according to claim 1, characterized in that, The method for obtaining the set of recognition feature templates includes: Image recognition is performed on multiple template images; Clustering of image recognition results yields multiple recognition sets; Obtain the number of features in the recognition set. When the number of features in the recognition set is less than a second threshold, delete the recognition set, obtain the features in the retained recognition set, and obtain the recognition feature templates in the recognition feature template set.
14. An image detection device, characterized in that, Includes a processor, the processor being configured to execute instructions to implement the image detection method as described in any one of claims 1-13.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store instruction / program data that can be executed to implement the image detection method as described in any one of claims 1-13.
Citation Information
Patent Citations
Target detection tracking method and device, electronic equipment and storage medium
CN112651996A
Target detection method and device, electronic equipment and storage medium
CN112734747A