Image recognition method and device, electronic device, and storage medium
By identifying and sorting key points of dynamic captured images and calculating image quality scores, the problem of image recognition accuracy caused by artificially setting quality thresholds in the existing technology is solved, and the objectivity of image quality scoring and recognition accuracy are improved. .
Patent Information
- Application Number
- CN202210143151.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-16
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-02-16
AI Technical Summary
In the existing technology, dynamic capture image quality assessment relies on artificially setting quality thresholds, which results in the inability to objectively reflect image quality and reduces the accuracy of image recognition.
By obtaining multiple captured images of the target object, identify the key point type and the first confidence level of the target key point, perform sorting and score calculation, obtain the quality score of the image, and screen out images with quality scores within the target range for identification. , to achieve objectivity in image quality scoring.
The accuracy of image recognition is improved, low-quality images are cleaned through objective scoring, and the efficiency and accuracy of subsequent recognition are improved.
Smart Images

Figure CN114495241B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to an image recognition method and device, an electronic device, and a storage medium. Background Art
[0002] Dynamic capture is a common image acquisition method in image recognition applications. In the prior art, multiple images captured dynamically of the same object (such as a user's face) are input into multiple quality detection models (such as a shooting angle detection model and a clarity detection model, etc.) for quality assessment. Low-quality images can be screened out from multiple images according to the quality thresholds set by each quality detection model, so that higher-quality images are sent to the image recognition system for recognition. In practice, it is found that in this way, the quality thresholds of different quality detection models are set artificially, so there is a problem that the image quality cannot be objectively reflected, which reduces the accuracy of image recognition. Summary of the invention
[0003] The present application provides an image recognition method and device, an electronic device, and a storage medium, the main purpose of which is to improve the accuracy of image recognition.
[0004] To achieve the above object, the present application provides an image recognition method, which includes:
[0005] Acquire multiple captured images of the target object;
[0006] Performing key point recognition on the captured image to obtain a plurality of key point types and target key points corresponding to each of the key point types in the captured image, and determining a first confidence level of the target key points in the captured image;
[0007] For each of the key point types, sorting all the captured images according to the first confidence of the target key point corresponding to the key point type in the captured images to obtain a first sorting result, and calculating the score value of the captured image for the key point type according to the first sorting result;
[0008] A quality score of the captured image is obtained by summing up the scores of different key point types of the captured image;
[0009] Determining a target score range according to the quality score of each of the captured images, and taking the captured images whose quality scores are within the target score range as target images;
[0010] The target image is recognized to obtain an image recognition result.
[0011] To achieve the above purpose, the present application also provides an image recognition device, which includes:
[0012] An acquisition module, used for acquiring multiple captured images of a target object;
[0013] a first recognition module, configured to perform key point recognition on the captured image, obtain a plurality of key point types and target key points corresponding to each of the key point types in the captured image, and determine a first confidence level of the target key points in the captured image;
[0014] A sorting module, configured to sort all the captured images according to a first confidence level of a target key point corresponding to the key point type in the captured image for each of the key point types, to obtain a first sorting result;
[0015] a calculation module, configured to calculate a score value of the captured image for the key point type according to the first sorting result, and to obtain a quality score of the captured image by summing up the score values of the captured image for different key point types;
[0016] A determination module, used to determine a target score range according to the quality score of each of the captured images, and take the captured images with quality scores within the target score range as target images;
[0017] The second recognition module is used to recognize the target image and obtain an image recognition result.
[0018] To achieve the above objectives, an embodiment of the present application further proposes an electronic device, which includes a memory and a processor, wherein a program is stored in the memory, and the program implements the steps of the above method when executed by the processor.
[0019] To achieve the above objectives, the present application provides a storage medium for computer-readable storage, the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the aforementioned method.
[0020] The image recognition method and device, electronic device, and storage medium proposed in the present application obtain multiple captured images of the target object, identify multiple key point types and target key points corresponding to each key point type in the captured image from each captured image, and determine the first confidence of the target key point. Afterwards, for each key point type, all captured images are sorted according to the first confidence of the target key point corresponding to the key point type in the captured image to obtain a first sorting result, and the score value of each captured image for the same key point type is calculated according to the first sorting result. It can combine the key point features of the captured image, and based on the correlation between multiple captured images of the same target object for different key point types, independent key point confidence comparison sorting and quality scoring can be performed. Finally, the sorting and scoring results of each key point type are merged to obtain the quality score of the captured image, thereby achieving the objectivity of the image quality scoring. Based on this, the target score range is determined according to the actual calculated quality score, so that the captured images with quality scores that meet the target score range are selected for face recognition, and the images with low quality scores in the multiple captured images can also be cleaned, which is conducive to improving the accuracy of subsequent image recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a structural block diagram of an electronic device used in an embodiment of the present application;
[0022] Figure 2 It is a flowchart of an image recognition method provided in Example 1 of the present application;
[0023] Figure 3 It is a flowchart of an image recognition method provided in Embodiment 2 of the present application;
[0024] Figure 4 It is a schematic diagram of a model structure of a prediction model in an embodiment of the present application;
[0025] Figure 5 It is a structural block diagram of an image recognition device used in an embodiment of the present application. DETAILED DESCRIPTION
[0026] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0027] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no special meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0028] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Among them, the basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc., while artificial intelligence software technology mainly includes computer vision technology (such as image recognition), robotics technology, biometrics technology, speech processing technology, natural language processing technology and machine learning / deep learning and other major directions.
[0029] Dynamic capture is a common image acquisition method in image recognition applications. In the prior art, multiple images of the same object (such as a user's face) captured dynamically are input into multiple quality detection models (such as shooting angle detection models and clarity detection models, etc.) for quality assessment. Low-quality images can be screened out from multiple images according to the quality thresholds set by each quality detection model, so that higher-quality images are sent to the image recognition system for recognition. In practice, it is found that this method has the following problems: On the one hand, the use of multiple quality detection models for image quality assessment can easily lead to low overall recognition efficiency. On the other hand, the quality thresholds of different quality detection models are set artificially, so they cannot objectively reflect the image quality, reducing the accuracy of image recognition.
[0030] In order to solve the above problems, the present application provides an image recognition method, which is applied to an electronic device. Figure 1 As shown, Figure 1 It is a structural block diagram of an electronic device used in an embodiment of the present application.
[0031] In this embodiment, the electronic device may be a terminal device with computing functions, such as a server, a smart phone, a tablet computer, a portable computer, or a desktop computer.
[0032] The electronic device includes a memory 11 , a processor 12 , a network interface 13 and a data bus 14 .
[0033] The memory 11 includes at least one type of readable storage medium, and at least one type of readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory, etc. In some embodiments, the readable storage medium may be an internal storage unit of an electronic device, such as a hard disk of the electronic device. In other embodiments, the readable storage medium may also be an external memory of the electronic device, such as a plug-in hard disk equipped on the electronic device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc.
[0034] In this embodiment, the readable storage medium of the memory 11 is generally used to store image recognition programs installed in the electronic device, various sample sets, pre-trained models, etc. The memory 11 can also be used to temporarily store data that has been output or is to be output.
[0035] In some embodiments, the processor 12 may be a central processing unit (CPU), a microprocessor or other data processing chip, which is used to run program codes stored in the memory 11 or process data, such as executing an image recognition program.
[0036] The network interface 13 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and is generally used to establish a communication connection between the electronic device and other electronic devices.
[0037] The data bus 14 is used to realize the connection and communication between these components.
[0038] Optionally, the electronic device may further include a user interface, which may include an input unit such as a keyboard, a voice input device such as a microphone and other devices with voice recognition function, a voice output device such as a speaker, headphones, etc. Optionally, the user interface may also include a standard wired interface or a wireless interface.
[0039] Optionally, the electronic device may further include a display, which may also be referred to as a display screen or a display unit. In some embodiments, it may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (OLED) touch device. The display is used to display information processed in the electronic device and to display a visual user interface.
[0040] Optionally, the electronic device further includes a touch sensor. The area provided by the touch sensor for the user to perform a touch operation is called a touch control area. In addition, the touch sensor here may be a resistive touch sensor, a capacitive touch sensor, etc. Moreover, the touch sensor includes not only a contact touch sensor, but also a proximity touch sensor, etc. In addition, the touch sensor may be a single sensor or a plurality of sensors arranged in an array, for example.
[0041] In addition, the area of the display of the electronic device can be the same as or different from the area of the touch sensor. Optionally, the display and the touch sensor are stacked to form a touch display screen. The device detects a touch operation triggered by a user based on the touch display screen.
[0042] An image recognition method disclosed in an embodiment of the present application is described in detail below.
[0043] Embodiment 1
[0044] like Figure 2 As shown, Figure 2 Schematic diagram of a flow chart of an image recognition method provided in Example 1 of the present application. Figure 1 In the electronic device embodiment shown, the processor 12 implements the following steps when executing the program stored in the memory 11:
[0045] Step S200: Acquire multiple captured images of the target object.
[0046] The embodiments of the present application can be applied to various image recognition scenarios such as face recognition, human behavior recognition, traffic control systems, satellite image object positioning, pedestrian detection, and medical image processing. Among them, the captured image can be an image containing at least one identifiable object, and the identifiable object is any object with specific properties (including shape, grayscale, texture, etc.), such as face, human body, tumors and organs, tissues and other pathological positioning objects in medical images, and vehicles in traffic detection scenes. It can be understood that the identifiable object has a corresponding relationship with the target object. For example, the target object is user A, and the identifiable object is the face of user A, then the captured image is the face image of user A. In practical applications, multiple captured images of the target object can be directly captured dynamically using an electronic device. Alternatively, multiple captured images of the target object collected in advance can also be obtained from different data sources. According to actual needs, the data source includes but is not limited to the device album, image database, medical imaging device or road monitoring system.
[0047] Step S210: performing key point recognition on the captured image to obtain multiple key point types and target key points corresponding to each key point type in the captured image, and determining a first confidence level of the target key points in the captured image.
[0048] In an embodiment of the present application, the type of key points and their number may be related to the recognition task. The recognition task may be manually specified or determined according to the image type of the captured image. For example, for face images, the classification task is face recognition or disease diagnosis; for medical images, the classification task is lesion recognition; for human body images, the classification task is human behavior recognition, etc. The types of target key points required to be identified for different classification tasks are also different and can be set and adjusted manually. Accordingly, in the face recognition task, the key point types include but are not limited to the human face key points such as the corners of the eyes, the tip of the nose, the corners of the mouth, the face and the eyebrows; in the human behavior recognition task, the key point types include but are not limited to the human body key points such as the nose, eyes, ears, shoulders, elbows, wrists, hips, knees and ankles.
[0049] By determining the recognition task, a key point recognition model matching the recognition task can be used to perform key point recognition on the captured image. The key point recognition model is pre-trained and includes but is not limited to key point detectors based on convolutional neural networks, unsupervised learning or recurrent neural networks.
[0050] In practical applications, the captured image is input into the key point recognition model to obtain the target key points corresponding to the various key point types identified from the captured image and the first confidence of the target key points. The first confidence indicates the degree of deviation in locating the target key points in the captured image. The higher the first confidence, the easier it is to locate the target key points in the captured image, and the lower the first confidence, the greater the positioning deviation of the target key points in the captured image. For example, if the face image has problems such as too large side face angle, facial occlusion or low pixel count, resulting in missing facial features, difficulty in distinguishing or key point offset, the first confidence of the target key points in the face image becomes low.
[0051] Step S220: for each key point type, all captured images are sorted according to the first confidence of the target key point corresponding to the key point type in the captured image to obtain a first sorting result, and based on the first sorting result, a score value of the captured image for the key point type is calculated.
[0052] Step S230: Sum the scores of different key point types of the captured image to obtain a quality score of the captured image.
[0053] For example, assume that for three face images p1, p2, and p3, each face image includes two types of key points: corners of the eyes and corners of the mouth. According to the first confidence of the key points of the corners of the eyes in the three face images, the key points of the corners of the eyes in the three face images are sorted, and the first sorting result corresponding to the key point type of the corners of the eyes can be obtained: p3>p2>p1. According to the first confidence of the key points of the corners of the mouth in the three face images, the key points of the corners of the mouth in the three face images are sorted, and the first sorting result corresponding to the key point type of the corners of the mouth can be obtained: p1>p3>p2.
[0054] Accordingly, in step S220, the ranking number of each captured image for each key point type can be determined according to the first ranking result corresponding to each key point type. Then, the score of the captured image for the key point type is calculated according to the ranking number of the captured image for the key point type.
[0055] The scoring value of the captured image for the key point type is calculated according to the ranking number, including but not limited to the following methods: if the first key points of all captured images are sorted in order from small to large according to the first confidence, the ranking number of the captured image for each key point type can be directly taken as the scoring value of the captured image for the key point type, or the normalized value corresponding to the ranking number is taken as the scoring value of the captured image for the key point type, and the normalized value = 2 × ranking number ÷ (n 2 + n); if the first key points of all captured images are sorted in descending order according to the first confidence, the reciprocal of the sorting number can be taken as the score value of the captured image for the key point type.
[0056] Still taking the above three face images as an example, the scores of face image p1 for the eye corner key point type and the mouth corner key point type can be 1 / 3 and 1 respectively, then the quality score of face image p1 is 1 / 3+1=4 / 3. The scores of face image p2 for the eye corner key point type and the mouth corner key point type can be 1 / 2 and 1 / 3 respectively, then the quality score of face image p2 is 1 / 2+1 / 3=5 / 6. The scores of face image p3 for the eye corner key point type and the mouth corner key point type can be 1 and 1 / 2 respectively, then the quality score of face image p3 is 1+1 / 2=3 / 2.
[0057] It can be seen that comparing and ranking the key point confidences and scoring the quality of captured images for different key point types can further improve the accuracy of image quality assessment.
[0058] As another optional implementation, after step S210, the first confidences of the target key points corresponding to the multiple key point types in the captured image may be summed up to obtain the summed value corresponding to the captured image. All captured images are sorted according to the summed value corresponding to each captured image to obtain the target sorting result. For example, assuming that the number of key point types is n (n is a positive integer), and the first confidence of the target key point i corresponding to the i-th key point type is r i , then the sum of the captured images Among them, a i is the weight corresponding to the target key point i, which is related to the i-th key point type. For example, the weight of all key point types is 1.
[0059] Further, the ranking number corresponding to each captured image is directly determined according to the target ranking result, and then the quality score of each captured image is calculated according to the ranking number, and step S240 is performed. The method of calculating the quality score includes but is not limited to: determining the ranking number of the captured image as the quality score of the captured image, for example, if the ranking number of the captured image is 2, the corresponding quality score is 2.
[0060] Step S240: determining a target score range according to the quality score of each captured image, and taking the captured images with quality scores within the target score range as target images.
[0061] In the embodiment of the present application, through step S240, the captured images whose quality scores are not within the target score range are screened out from the multiple captured images, and the target images whose quality scores are within the target score range are retained, effectively ensuring the confidence level of the target images. The target score range may be related to the number of key point types and may be manually specified and adjusted; alternatively, the quality scores of all captured images may be sorted from large to small, and the quality score of the kth position in the sorting may be taken as the target threshold d0, where k is a positive integer and is manually specified, and then the preset threshold range is determined based on the target threshold d0, for example, the preset threshold range is [d0, dmax], where dmax is the quality score of the first position in the sorting; there is no specific limitation on the method for determining the target score range.
[0062] Step S250: Recognize the target image to obtain an image recognition result.
[0063] In the embodiments of the present application, different image recognition methods can be determined according to the recognition task to identify the target image, which can be applied to a variety of image recognition scenarios. For example, in the face recognition scenario, face recognition methods based on geometric features, principal component analysis, neural networks, support vector machines or hidden Markov models are used to perform face recognition on the target image to obtain face recognition results for the target object. In the human behavior recognition scenario, behavior recognition methods based on unsupervised learning, convolutional neural networks or recurrent neural networks are used to perform human posture detection and behavior recognition on the target image to obtain behavior recognition results for the target object.
[0064] It can be seen that the implementation of the above method embodiment can combine the key point features of the captured image, based on the correlation between multiple captured images of the same target object for different key point types, perform independent key point confidence comparison sorting and quality scoring, and finally merge the sorting and scoring results of each key point type to obtain the quality score of the captured image, thereby achieving the objectivity of the image quality score. Based on this, the target score range is determined according to the actual calculated quality score, so that the captured images with quality scores that meet the target score range are selected for face recognition, and the images with low quality scores in multiple captured images can also be cleaned, which is conducive to improving the accuracy of subsequent image recognition.
[0065] Embodiment 2
[0066] like Figure 3 As shown, Figure 3 Schematic diagram of a flow chart of an image recognition method provided in Example 2 of the present application. Figure 1 In the electronic device embodiment shown, the processor 12 implements the following steps when executing the program stored in the memory 11:
[0067] Step S300: Acquire multiple captured images of the target object.
[0068] Step S310: input the captured image into the feature extraction network of the preset model to obtain feature data of the captured image, and execute steps S320 and S330 respectively.
[0069] In the embodiment of the present application, the feature data may be a feature map of the captured image, that is, a matrix with dimensions of W*H*C.
[0070] In some optional implementations, a preset model can be constructed and trained. Figure 4 As shown, the preset model may include a feature extraction network, a detection box prediction branch, and a key point prediction branch, and the input of the detection box prediction branch and the input of the key point prediction branch are both connected to the output of the feature extraction network.
[0071] Specifically, the feature extraction network can adopt a convolutional neural network, which includes multiple convolutional layers, such as 5 convolutional layers. In practical applications, the captured image is input into a preset model, and the feature extraction network is used to extract feature data from the captured image. At this time, the specific values of W, H and C in the feature data are related to the size of the captured image and the convolution parameter setting of the feature extraction network. The detection frame prediction branch is used to generate the detection frame data of the captured image based on the feature data. The key point prediction branch is used to regress and classify the target key points according to the feature data, and output the key point data. The key point data includes but is not limited to the key point type of the target key point, the coordinates in the captured image and the first confidence. More specifically, the key point prediction branch can also include prediction branches corresponding to different key point types. For example, the key point prediction branch includes 5 prediction branches, namely, the left eye key point prediction branch, the right eye key point prediction branch, the nose tip key point prediction branch, the lip left side key point prediction branch and the lip right side key point prediction branch.
[0072] The training steps of the preset model may include: obtaining a certain number of image training samples and annotation information of the image training samples, the annotation information including detection box annotation data and key point annotation data of the image training samples. The constructed preset model is trained using the image training samples, and the output results of the preset model are verified using the annotation information. If the verification accuracy is less than the preset accuracy, the model loss value is calculated based on the output results and the annotation information, the parameters of the preset model are adjusted according to the model loss value, and the image training samples are added to re-execute the training steps; if the accuracy is greater than or equal to the preset accuracy, the training ends.
[0073] It can be seen that only one preset model needs to be used, and the detection box prediction branch and the key point prediction branch in the preset model share the same feature extraction network to realize feature extraction, detection box generation and key point prediction of the captured image, which can save the response and processing time of the overall image recognition process and improve image recognition efficiency.
[0074] Step S320: input the feature data into the detection frame prediction branch of the preset model to obtain the detection frame data of the captured image.
[0075] In the embodiment of the present application, the detection frame data is used to determine the feature detection frame, and the detection frame data includes but is not limited to the detection frame size (such as shape features such as the length and width of the detection frame) and positioning coordinates (such as the center coordinates or the upper left corner coordinates of the feature detection frame). The feature detection frame is used to locate the feature detection area containing the identifiable object in the captured image, which can reduce the interference of irrelevant features on image recognition. For example, the feature detection frame can be a face detection frame, a human body detection frame, a lesion detection frame, or a vehicle detection frame.
[0076] Step S330: input the feature data into the key point prediction branch of the preset model to obtain multiple key point types, target key points corresponding to each key point type in the captured image, and a first confidence level of the target key points.
[0077] Step S340: for each key point type, all captured images are sorted according to the first confidence of the target key point corresponding to the key point type in the captured image to obtain a first sorting result, and based on the first sorting result, a score value of the captured image for the key point type is calculated.
[0078] As an optional implementation, after step S330, the following steps (1) to (4) may also be included:
[0079] (1) Obtain designated key points from target key points corresponding to multiple key point types in the captured image, where the designated key points correspond to key point types manually designated for screening image quality, such as left eye key points, right eye key points, left lip key points, right lip key points, and facial contour key points in face images, and bone key points in human body images.
[0080] (2) Identify the actual positioning features corresponding to the designated key points in the captured image. The actual positioning features include but are not limited to at least one of the following: the coordinates of a single designated key point; the coordinate spacing between different designated key points; and the comparative features of the coordinate spacing between different designated key points.
[0081] (3) Using preset verification rules to verify the actual positioning features, and obtain the verification results of the captured images.
[0082] In one implementation, if the captured image is a face image, the designated key points include the left eye key point, the right eye key point, the left lip key point, and the right lip key point. Step (2) may also be:
[0083] Determine the first positioning coordinates (x1, y1) of the left eye key point, the second positioning coordinates (x2, y2) of the right eye key point, the third positioning coordinates (x3, y3) of the left lip key point, and the fourth positioning coordinates (x4, y4) of the right lip key point in the captured image. Determine the eyebrow center positioning coordinates and the first distance information between the two eyes based on the first positioning coordinates and the second positioning coordinates. Determine the second distance information between the eyebrow center and the lip center based on the eyebrow center positioning coordinates, the third positioning coordinates, and the fourth positioning coordinates. Calculate the distance feature value based on the first distance information and the second distance information, and take the distance feature value as the actual positioning feature corresponding to the specified key point in the captured image.
[0084] Optionally, the eyebrow center positioning coordinates may be (x5, y5) = (x2-x1, y2-y1), and the first spacing information d1 satisfies:
[0085]
[0086] The second distance information d2 satisfies:
[0087] Then the spacing characteristic value = d1 / d2.
[0088] Optionally, the designated key point may also include a nose tip key point, and the sixth positioning coordinate (x6, y6) of the nose tip key point may be determined in the captured image, thereby determining the second distance information between the eyebrow center and the lip center according to the eyebrow center positioning coordinate, the third positioning coordinate, the fourth positioning coordinate, and the sixth positioning coordinate, thereby improving the accuracy of positioning the distance between the eyebrow center and the lip center. For example, the second distance information also satisfies:
[0089]
[0090] Correspondingly, step (3) can be: verify the spacing feature value using a preset spacing value range. If the spacing feature value belongs to the spacing value range, the verification is successful. If the spacing feature value does not belong to the spacing value range, the verification fails. In other words, if the spacing feature value does not fall within the preset spacing value range, it means that there are factors such as the face angle is too large or the image is blurred, resulting in inaccurate positioning of key points. Therefore, by verifying the spacing feature value, the supervision and screening of the captured images can be further achieved based on the spacing of key points. Exemplarily, multiple (for example, 5,000) face images with normal angles and multiple (for example, 5,000) face images with excessive angles can be analyzed to statistically calculate the spacing value range corresponding to d1 / d2 when the angle is normal.
[0091] (4) From the plurality of captured images, the captured image with a verification result indicating successful verification is selected as the first image.
[0092] Correspondingly, step S340 is specifically: sorting all first images according to the first confidence of the target key point corresponding to the key point type in the first image to obtain a first sorting result. It can be seen that adding an image screening mechanism based on key point positioning features can further ensure the quality of the screened images.
[0093] Step S350: Sum the scores of different key point types of the captured image to obtain a quality score of the captured image.
[0094] As an optional implementation, after step S320, a second confidence level corresponding to the detection frame data in the captured image may also be obtained. According to the second confidence level corresponding to the detection frame data in the captured image, all captured images are sorted to obtain a second sorting result, and the first score of each captured image is calculated according to the second sorting result. Sorting all captured images according to the second confidence level may also refer to the description of the above step S220, which will not be repeated here.
[0095] Based on this, step S350 is specifically as follows: summing up the score values for different key point types of the captured image to obtain a second score of the captured image. Summing up the first score and the second score of the captured image to obtain a quality score of the captured image. Optionally, referring to the description of step S230 in embodiment 1, the first score and the second score may be calculated respectively according to the first sorting result and the second sorting result, and then the first score and the second score may be weightedly summed to obtain the quality score of the captured image. For example, the quality score of the captured image = q1 × first score + q2 × second score, where q1 and q2 are both experimentally measured.
[0096] Step S360: Determine a target score range according to the quality score of each captured image, and take the captured images with quality scores within the target score range as target images.
[0097] Step S370: determine the detection frame size and positioning coordinates from the detection frame data, locate the target position in the target image according to the positioning coordinates, and generate a feature detection frame matching the detection frame size at the target position.
[0098] Step S380: extracting the image area corresponding to the feature detection frame from the target image to obtain the feature detection area.
[0099] Step S390: Identify the feature detection area to obtain an image recognition result.
[0100] As an optional implementation, the detection frame category and key point category specified for the target object can also be obtained, and both can specifically correspond to the recognition task. Accordingly, step S320 is: input the feature data into the detection frame prediction branch corresponding to the detection frame category in the preset model to obtain the detection frame data of the captured image. Step S330 is: input the feature data into the key point prediction branch corresponding to the key point category in the preset model to obtain the target key point of the captured image, for example, input the feature data into the left eye key point prediction branch, the right eye key point prediction branch, the nose tip key point prediction branch, the lip left key point prediction branch and the lip right key point prediction branch for key point recognition. Correspondingly, step S390 is: according to the recognition task, identify the feature detection area to obtain the image recognition result. It can be seen that only by adjusting the recognition task, a variety of prediction combinations of detection frames and key point types can be generated, which is flexible and variable, and further expands the diversity of image recognition scenarios.
[0101] It can be understood that the specific implementation of steps S300 to S390 in this embodiment can also refer to the description of steps S200 to S250 in the above embodiment 1, and will not be repeated here.
[0102] It can be seen that the implementation of the above method embodiment can combine the key point features of the captured image, based on the correlation between multiple captured images of the same target object for different key point types, perform independent key point confidence comparison sorting and quality scoring, and finally merge the sorting and scoring results of each key point type to obtain the quality score of the captured image, thereby achieving the objectivity of the image quality score. Based on this, the target score range is determined according to the actual calculated quality score, so that the captured images with quality scores that meet the target score range are selected for face recognition, and the images with low quality scores in multiple captured images can also be cleaned, which is conducive to improving the accuracy of subsequent image recognition.
[0103] The present application also provides an image recognition device. Figure 5 , Figure 5 is a structural block diagram of an image recognition device used in the embodiment of the present application. Figure 5 As shown, the image recognition device 500 includes an acquisition module 510, a first recognition module 520, a sorting module 530, a calculation module 540, a determination module 550 and a second recognition module 560, wherein:
[0104] The acquisition module 510 is used to acquire multiple captured images of the target object.
[0105] The first recognition module 520 is used to perform key point recognition on the captured image, obtain multiple key point types and target key points corresponding to each key point type in the captured image, and determine a first confidence level of the target key points in the captured image.
[0106] The sorting module 530 is used to sort all the captured images for each key point type according to the first confidence of the target key point corresponding to the key point type in the captured image to obtain a first sorting result.
[0107] The calculation module 540 is used to calculate the score value of the captured image for the key point type according to the first sorting result, and to sum the score values of the captured image for different key point types to obtain the quality score of the captured image.
[0108] The determination module 550 is used to determine a target score range according to the quality score of each captured image, and take the captured images with quality scores within the target score range as target images.
[0109] The second recognition module 560 is used to recognize the target image and obtain an image recognition result.
[0110] It should be noted that the specific implementation process of this embodiment can refer to the specific implementation process of the above method embodiment, and will not be repeated here.
[0111] An embodiment of the present application further provides an electronic device, which includes a memory and a processor. The memory stores a program, and when the program is executed by the processor, the above-mentioned image recognition method is implemented.
[0112] An embodiment of the present application also provides a storage medium for computer-readable storage, the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned image recognition method.
[0113] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0114] In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0115] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but the scope of the present application is not limited thereby. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application shall be within the scope of the present application.
Claims
1. An image recognition method, characterized in that: The method comprises: Acquire multiple captured images of the target object; Inputting the captured image into a feature extraction network of a preset model to obtain feature data of the captured image; Inputting the feature data into a detection frame prediction branch corresponding to the detection frame category in the preset model to obtain detection frame data of the captured image; Performing key point recognition on the captured image to obtain a plurality of key point types and target key points corresponding to each of the key point types in the captured image, and determining a first confidence level of the target key points in the captured image, including: inputting the feature data into a key point prediction branch corresponding to the key point category in the preset model to obtain a plurality of key point types, target key points corresponding to each of the key point types in the captured image, and a first confidence level of the target key points; For each of the key point types, all the captured images are sorted according to the first confidence of the target key point corresponding to the key point type in the captured images to obtain a first sorting result, and according to the first sorting result, a score value of the captured image for the key point type is calculated, including: obtaining a sorting number corresponding to the captured image from the first sorting result, and taking the reciprocal of the sorting number as the score value of the captured image for the key point type; A quality score of the captured image is obtained by summing up the scores of different key point types of the captured image; Determining a target score range according to the quality score of each of the captured images, and taking the captured images whose quality scores are within the target score range as target images; The target image is recognized to obtain an image recognition result, including: obtaining a detection frame size and positioning coordinates from the detection frame data; locating the target position in the target image according to the positioning coordinates, and generating a feature detection frame matching the detection frame size at the target position; intercepting an image area corresponding to the feature detection frame from the target image to obtain a feature detection area; and according to a recognition task, recognizing the feature detection area to obtain the image recognition result; wherein the recognition task corresponds to the detection frame category and the key point category.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining a detection box category and a key point category specified for the target object; The step of inputting the feature data into the detection frame prediction branch of the preset model to obtain the detection frame data of the captured image includes: Inputting the feature data into a detection frame prediction branch corresponding to the detection frame category in a preset model to obtain detection frame data of the captured image; The step of inputting the feature data into the key point prediction branch of the preset model to obtain a plurality of key point types, target key points corresponding to each of the key point types in the captured image, and a first confidence level of the target key points includes: The feature data is input into a key point prediction branch corresponding to the key point category in the preset model to obtain multiple key point types, target key points corresponding to each key point type in the captured image, and a first confidence level of the target key points.
3. The method according to claim 1, characterized in that: After inputting the feature data into the detection frame prediction branch of the preset model, the method further includes: Obtaining a second confidence level corresponding to the detection frame data in the captured image; sorting all the captured images according to the second confidence level corresponding to the detection frame data in the captured images to obtain a second sorting result; Calculating a first score for each of the captured images according to the second sorting result; The step of summing up the score values of different key point types of the captured image to obtain the quality score of the captured image includes: Performing sum calculation according to the score values of different key point types of the captured image to obtain a second score of the captured image; A quality score of the captured image is obtained by summing up the first score and the second score of the captured image.
4. The method according to any one of claims 1 to 3, characterized in that: After performing key point recognition on the captured image to obtain multiple key point types and target key points corresponding to each key point type in the captured image, the method further includes: Acquire a designated key point from target key points corresponding to a plurality of key point types in the captured image, and identify an actual positioning feature corresponding to the designated key point in the captured image; Verifying the actual positioning feature using a preset verification rule to obtain a verification result of the captured image; From the plurality of photographed images, taking the photographed image with a verification result showing successful verification as the first image; The step of sorting all the captured images according to the first confidence of the target key point corresponding to the key point type in the captured images to obtain a first sorting result includes: All the first images are sorted according to the first confidence of the target key point corresponding to the key point type in the first image to obtain a first sorting result.
5. The method according to claim 4, characterized in that The captured image is a face image, and the designated key points include a left eye key point, a right eye key point, a left lip key point, and a right lip key point; The identifying the actual positioning feature corresponding to the designated key point in the captured image includes: Determine, in the captured image, a first positioning coordinate of a left eye key point, a second positioning coordinate of a right eye key point, a third positioning coordinate of a left lip key point, and a fourth positioning coordinate of a right lip key point; Determine the eyebrow center positioning coordinates and the first distance information between the eyes according to the first positioning coordinates and the second positioning coordinates; Determine second distance information between the eyebrow center and the lip center according to the eyebrow center positioning coordinates, the third positioning coordinates and the fourth positioning coordinates; Calculating a spacing feature value according to the first spacing information and the second spacing information, and taking the spacing feature value as an actual positioning feature corresponding to the designated key point in the captured image; The using the preset verification rule to verify the actual positioning feature to obtain the verification result of the captured image includes: The spacing characteristic value is verified using a preset spacing value range. If the spacing characteristic value belongs to the spacing value range, the verification is successful. If the spacing characteristic value does not belong to the spacing value range, the verification fails.
6. An image recognition device, characterized in that: The device comprises: An acquisition module, used for acquiring multiple captured images of a target object; a first recognition module, configured to perform key point recognition on the captured image, obtain a plurality of key point types and target key points corresponding to the key point types in the captured image, and determine a first confidence level of the target key points in the captured image; A sorting module, configured to sort all the captured images according to a first confidence level of a target key point corresponding to the key point type in the captured image for each of the key point types, to obtain a first sorting result; a calculation module, configured to calculate a score value of the captured image for the key point type according to the first sorting result, and to obtain a quality score of the captured image by summing up the score values of the captured image for different key point types; A determination module, used to determine a target score range according to the quality score of each of the captured images, and take the captured images with quality scores within the target score range as target images; A second recognition module is used to recognize the target image and obtain an image recognition result; After acquiring a plurality of captured images of the target object, the device is further used to: input the captured images into a feature extraction network of a preset model to obtain feature data of the captured images; input the feature data into a detection frame prediction branch corresponding to the detection frame category in the preset model to obtain detection frame data of the captured images; Wherein, for each of the key point types, according to the first confidence of the target key point corresponding to the key point type in the captured image, comprising: inputting the feature data into the key point prediction branch corresponding to the key point category in the preset model, obtaining multiple key point types, the target key point corresponding to each of the key point types in the captured image, and the first confidence of the target key point; The step of calculating the score of the captured image for the key point type according to the first sorting result includes: obtaining a sorting number corresponding to the captured image from the first sorting result; and taking the reciprocal of the sorting number as the score of the captured image for the key point type; Wherein, the identifying the target image to obtain the image recognition result includes: obtaining the detection frame size and positioning coordinates from the detection frame data; locating the target position in the target image according to the positioning coordinates, and generating a feature detection frame matching the detection frame size at the target position; intercepting the image area corresponding to the feature detection frame from the target image to obtain the feature detection area; identifying the feature detection area according to the recognition task to obtain the image recognition result; wherein the recognition task corresponds to the detection frame category and the key point category.
7. An electronic device, characterized in that: The electronic device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the steps of the image recognition method as described in any one of claims 1 to 5 are realized.
8. A storage medium for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the image recognition method according to any one of claims 1 to 5.
