Image classification method and device, electronic device, and storage medium
Through multiple corrections to the key point information in the image and guidance from the feature weight map, the problem of deep model error accumulation caused by small image sample data and unbalanced distribution is solved, improving the reliability of image classification and the accuracy of feature learning. .
Patent Information
- Application Number
- CN202210163242.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-22
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-02-22
AI Technical Summary
When image sample data is small and the distribution is unbalanced, existing depth models are susceptible to noise interference, leading to error accumulation and reducing the reliability of image classification.
By identifying key point information from the target image, making multiple corrections according to preset rules, a feature weight map is generated, and input into the second preset model for feature extraction to guide the model to learn effective feature information from key areas.
It improves the reliability of image classification, avoids error accumulation caused by unbalanced distribution of data volume, and enhances the accuracy and interpretability of feature learning.
Smart Images

Figure CN114519401B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to an image classification method and device, an electronic device, and a storage medium. Background Art
[0002] In recent years, computer vision-based image classification methods have been widely used in various fields such as disease prediction, risk prediction, and abnormality prediction. In existing image classification methods, deep models are usually trained using balanced positive and negative image samples. When the number of model layers of the deep model is deep enough, the model width is wide enough, and the number of model layer channels is large enough, the deep model can effectively fit the sample distribution and achieve better image classification results. However, in practice, it is found that when the image sample data is small and the distribution is unbalanced, the feature differences between positive and negative image samples are not easy to distinguish. Therefore, the existing deep models are easily disturbed by noise when identifying image features, resulting in error accumulation and affecting the subsequent training process, thereby reducing the reliability of image classification. Summary of the invention
[0003] The present application provides an image classification method and device, an electronic device, and a storage medium, the main purpose of which is to improve the reliability of image classification.
[0004] To achieve the above object, the present application provides an image classification method, which includes:
[0005] Acquire a target image, and identify first key point information from the target image;
[0006] The first key point information is modified multiple times according to a preset rule to obtain a key point information set, wherein the key point information set includes target key point information of each modification;
[0007] Inputting the target key point information of each revision into the first preset model to obtain a feature weight map of each revision;
[0008] Inputting the target image and each corrected feature weight map into a second preset model to extract features and obtain target feature information;
[0009] The target image is classified according to the target feature information to obtain an image classification result.
[0010] To achieve the above purpose, the present application also provides an image classification device, which includes:
[0011] An acquisition module, used for acquiring a target image;
[0012] A recognition module, used to recognize first key point information in the target image;
[0013] A correction module, used to correct the first key point information multiple times according to a preset rule to obtain a key point information set, wherein the key point information set includes target key point information of each correction;
[0014] A generation module, used for inputting the target key point information of each revision into the first preset model to obtain a feature weight map of each revision;
[0015] An extraction module, used for inputting the target image and each corrected feature weight map into a second preset model to perform feature extraction and obtain target feature information;
[0016] The classification module is used to classify the target image according to the target feature information to obtain an image classification result.
[0017] 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.
[0018] 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.
[0019] The image classification method and device, electronic device, and storage medium proposed in the present application can identify the first key point information from the acquired target image, and by correcting the first key point information multiple times according to preset rules, the target key point information for each correction can be obtained, and the error of the key point information can be continuously corrected to avoid the continuous accumulation of errors caused by the imbalanced distribution of data volume, which affects the subsequent feature learning process. Based on this, a feature weight map for each correction is generated according to the target key point information, and then the target image and the feature weight map for each correction are input into the second preset model for feature extraction. The feature weight map can be used to guide the second preset model to identify key areas with higher discrimination from the target image, and learn more effective and interpretable target feature information from the key areas, thereby improving the reliability of image classification based on the target feature information. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a structural block diagram of an electronic device used in an embodiment of the present application;
[0021] Figure 2 It is a flowchart of an image classification method provided in an embodiment of the present application;
[0022] Figure 3 yes Figure 2 A specific flow chart of step S210;
[0023] Figure 4 It is a schematic diagram of a system used in an embodiment of the present application;
[0024] Figure 5 It is a structural block diagram of an image classification device used in an embodiment of the present application. DETAILED DESCRIPTION
[0025] 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.
[0026] 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.
[0027] 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, robotics technology, biometrics technology, speech processing technology, natural language processing technology and machine learning / deep learning and other major directions.
[0028] Computer vision is the process of using machines to understand and analyze images, and is an important branch of artificial intelligence. In recent years, image classification methods based on computer vision have been widely used in various fields such as disease prediction, risk prediction, and abnormality prediction. In existing image classification methods, deep models are usually trained using balanced positive and negative image samples. When the number of model layers of the deep model is deep enough, the model width is wide enough, and the number of model layer channels is large enough, the deep model can effectively fit the sample distribution and achieve better image classification results. However, in practice, it is found that when the image sample data is small and the distribution is unbalanced, the feature differences between positive and negative image samples are not easy to distinguish. In order to prevent overfitting, the number of model layers, model width, and number of channels of the deep model cannot be effectively balanced. Therefore, the existing deep model is easily disturbed by noise when identifying image features, resulting in error accumulation and affecting the subsequent training process, thereby reducing the reliability of image classification.
[0029] In order to solve the above problems, the present application provides an image classification 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.
[0030] 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.
[0031] The electronic device includes a memory 11 , a processor 12 , a network interface 13 and a data bus 14 .
[0032] 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.
[0033] In this embodiment, the readable storage medium of the memory 11 is generally used to store image classification 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.
[0034] In some embodiments, the processor 12 may be a central processing unit (CPU), a microprocessor or other data processing chip, and is used to run program codes stored in the memory 11 or process data, such as executing an image classification program.
[0035] 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.
[0036] The data bus 14 is used to realize the connection and communication between these components.
[0037] 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.
[0038] 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.
[0039] 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.
[0040] 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.
[0041] The following is a detailed description of an image classification method disclosed in an embodiment of the present application.
[0042] like Figure 2 As shown, Figure 2 Schematic diagram of a flow chart of an image classification method provided in an embodiment 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:
[0043] Step S200: Acquire a target image, and identify first key point information from the target image.
[0044] The embodiments of the present application can be applied to various image recognition and classification scenarios such as face recognition, traffic control systems, satellite image object positioning, pedestrian detection, and medical image processing. Among them, the target image can be an image containing at least one identifiable object, and the identifiable object can be any object with specific properties (including shape, grayscale, and texture, etc.), such as a face, a human body, a tumor and other pathological positioning objects such as organs and tissues in medical images, and a vehicle in a traffic detection scene. Exemplarily, if the target image is a face image, the face in the face image is the identifiable object.
[0045] In the embodiment of the present application, the first key point information includes multiple key points identified from the target image and the coordinates of these key points in the target image. The type of the key point is related to the type of the target image. For example, for a face image, the multiple key points include but are not limited to the corners of the eyes, the tip of the nose, the corners of the mouth, the face and the eyebrows. Specifically, the first key point information can be identified from the target image using an existing machine learning library, for example, using the Dlib library, and identifying 68 face key points from the face image through a face detection model such as a histogram of oriented gradient (HOG) feature model or a convolutional neural network (CNN) model.
[0046] Step S210: the first key point information is corrected multiple times according to a preset rule to obtain a key point information set, where the key point information set includes the target key point information corrected each time.
[0047] In the embodiment of the present application, specifically, the first key point information can be input into the correction model for multiple corrections to obtain a key point information set. The correction model can adopt a neural network model (such as a CNN network model, a recurrent neural network model, a long short-term memory network model or a gate recurrent unit network model), a Bayesian model or an autoencoder deep learning model, etc., which is not specifically limited. In one implementation, a certain number of key point samples and annotated data for correcting the key point samples can be collected, wherein the key point samples are multiple key points identified from the sample image, and these key points include abnormal key points with problems such as position offset, abnormal values (such as values that are obviously too large or too small) and non-specified target key point types, and the annotated data represents the correction results of the above abnormal key points. Based on this, the pre-constructed correction model is trained using the key point samples, and the accuracy of the trained correction model is verified using the annotated data. If the accuracy is less than the preset accuracy, the number of key point samples is increased and the training step is re-executed; if the accuracy is greater than or equal to the preset accuracy, the training ends.
[0048] See also Figure 3 , Figure 3 yes Figure 2 A specific flow chart of step S210 in FIG. Figure 3 As shown, step S210 includes but is not limited to the following steps S211 to S214.
[0049] Step S211: Obtain classification task information for the target image, and determine the target key point type according to the classification task information.
[0050] The classification task information is used to indicate the classification task for the target image. The classification task can be manually specified or determined according to the image type of the target 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 images, the classification task is posture 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. For example, in the face recognition task, the target key point types include the key points of the facial features; in the lesion recognition task, the target key point types include the lesion contour points, etc.
[0051] Step S212: adjusting the first key point information according to the target image and the target key point type to obtain second key point information that meets the target key point type.
[0052] In practical applications, for different types of target images, a general key point recognition method can be first used (such as training a general key point recognition model, or directly calling an existing model) to identify the first key point information from the target image. It can be understood that at this time, the first key point information does not necessarily cover the target key point type actually required. Therefore, in step S212, the missing key point type can be determined based on the target key point type and the first key point information, and then the key point and its coordinates corresponding to the missing key point type can be further located from the target image based on the first key point information and the missing key point type, so as to generate the second key point information together with the first key point information, thereby realizing adaptive adjustment of the first key point information and ensuring complete coverage of the target key point type required for the classification task.
[0053] Exemplarily, assuming that the classification task is disease diagnosis, when the target image is a face image, the first key point information includes 68 specific face key points, such as lower lip key points, facial contour key points and eyebrow key points, but does not include key points related to the disease such as forehead, eye bags, chin and center of eyebrows. Therefore, the first key point information can be further improved by determining the chin key point and its coordinates from the face image based on the lower lip key point and facial contour key point, and determining the center of eyebrows key point and its coordinates based on the left and right eyebrow key points.
[0054] Step S213: Determine the target key point information for the first correction according to the second key point information.
[0055] Step S214: correct the second key point information N times, and when the second key point information is corrected for the i-th time, obtain the target key point information corrected for the (i+1)th time.
[0056] Wherein, N and i are both positive integers, and i∈[1,N]. Optionally, the correction model may include N correction units connected in sequence. Accordingly, step S214 is: inputting the second key point information into the correction model, obtaining the key point information output by each correction unit, and taking the key point information output by the i-th correction unit as the target key point information for the i+1-th correction.
[0057] For example, see Figure 4 , Figure 4 Schematic diagram of a system used in the embodiment of the present application. Figure 4 As shown, the second key point information is input into the first correction unit a1 of the correction model to obtain the key point information output by the correction unit a1, i.e., the target key point information of the second correction. After that, the key point information output by the correction unit a1 is input into the second correction unit a2 to obtain the key point information output by the correction unit a2, i.e., the target key point information of the third correction. And so on, until the key point information output by the Nth correction unit is obtained, i.e., the target key point information of the N+1th correction, and the correction is completed.
[0058] As an optional implementation, when the second key point information is corrected for the i-th time, a correction parameter can be generated according to the target key point information corrected for the i-th time. The target key point information corrected for the i-th time can be corrected using the correction parameter to obtain the target key point information corrected for the i+1th time.
[0059] Optionally, each correction unit in the correction model may also include a learning layer and a correction layer. Among them, the correction layer may be an addition unit, the learning layer may adopt a CNN module, and the learning layer includes multiple interconnected convolutional layers, such as 5 convolutional layers, which are not specifically limited. More specifically, the second key point information is input into the learning layer of the first correction unit to obtain the correction parameters of the first correction unit, and then the correction parameters of the first correction unit and the second key point information are input into the correction layer of the first correction unit to obtain the key point information output by the first correction unit. Afterwards, based on the interconnected characteristics of N correction units, the key point information output by the i-th correction unit is input into the learning layer of the i+1th correction unit to obtain the correction parameters of the i+1th correction unit, and then the correction parameters of the i+1th correction unit and the key point information output by the i+1th correction unit are input into the correction layer of the i+1th correction unit to obtain the key point information output by the i+1th correction unit. It can be seen that there is no need to completely define the learning area of the key point feature, and each correction unit can perform associated correction according to the output of the previous correction unit, which is more flexible.
[0060] Further, as an optional implementation, the target key point information corrected for the i-th time includes the first coordinates of multiple key points, and the target key point information corrected for the (i+1)th time includes the second coordinates of multiple key points, and the second coordinates satisfy:
[0061] (x′, y′) = (x, y) + (dx, dy), where (x′, y′) is the second coordinate, (x, y) is the first coordinate, and dx and dy are correction parameters, thereby achieving independent learning and adjustment of the horizontal and vertical coordinate correction amounts of the key points.
[0062] Step S220: input the target key point information of each revision into the first preset model to obtain a feature weight map of each revision.
[0063] In an embodiment of the present application, the first preset model may adopt an attention model, which is used to determine the attention area indicated by the target key point information from the target image, and obtain the corresponding feature weight map by weighting the attention area, thereby achieving the effect of focusing attention on the effective feature area. Specifically, the attention model may adopt a first preset model (convolutional block attention module, CBAM) based on a convolutional neural network, a squeeze-and-excitation (SE) module, or an efficient pyramid split attention module (EPSA), or a combination structure of at least two of the aforementioned modules, without limitation.
[0064] As an optional implementation, step S220 may include but is not limited to the following implementation steps:
[0065] According to the preset learning formula, the target key point information of each revision is input into the first preset model for attention parameter learning to obtain the attention parameter of each revision, and then the feature weight map of each revision is generated according to the target key point information and attention parameter of each revision, wherein the preset learning formula is:
[0066]
[0067] G(x,y) satisfies Gaussian distribution, x and y are the horizontal and vertical coordinates of each key point in the target key point information, and σ is the attention parameter.
[0068] Specifically, after obtaining the attention parameters for each revision, the attention parameters are substituted into the preset learning formula, and the weight values of each key point in the target key point information can also be obtained. By weighting the target key point information with the weight values of each key point in the target key point information, the feature weight map for each revision can be obtained, which can not only locate the attention area indicated by the target key point information, but also make the attention allocation probability of each key point in the feature weight map satisfy the Gaussian distribution.
[0069] In some implementations, the first preset model may also include multiple attention units, and each attention unit may include multiple convolutional layers connected in sequence, such as 3 convolutional layers, without limitation.
[0070] In practical applications, the i-th correction unit can correspond to the i+1-th attention unit, that is, the output of the i-th correction unit is connected to the input of the i+1-th attention unit. Figure 4 Take the following example to illustrate this. Figure 4 As shown, the second key point information is input into the first attention unit b1 to obtain the feature weight map output by the attention unit b1, that is, the feature weight map of the first correction; the key point information output by the correction unit a1 is input into the second attention unit b2 to obtain the feature weight map output by the attention unit b2, that is, the feature weight map of the second correction; and so on, until the N+1th attention unit b N+1 Get the feature weight map of the N+1th revision.
[0071] Step S230: Input the target image and each corrected feature weight map into the second preset model for feature extraction to obtain target feature information.
[0072] As an optional implementation, the second preset model may specifically include N+1 feature extraction units, each of which uses a pre-trained CNN module. Accordingly, step S230 may include but is not limited to the following implementation steps:
[0073] The target image and the feature weight map of each correction are input into the second preset model for N+1 feature extractions. In the first feature extraction, the target image and the feature weight map of the first correction can be fused to obtain the first feature information of the first correction. Specifically, the second preset model can also include an initial extraction unit, and the initial extraction unit can also be a CNN module. The target image is input into the initial extraction unit for feature extraction to obtain the original feature image (feature map), and then the feature weight map of the first correction is used to perform weighted processing on the original feature image to obtain the first feature information of the first correction. Based on this, the first feature information of the first correction is input into the second preset model for feature extraction to obtain the second feature information of the first extraction.
[0074] In the j+1th feature extraction, the second feature information extracted for the j+1th time and the feature weight map corrected for the j+1th time are fused to obtain the first feature information corrected for the j+1th time, and then the first feature information corrected for the j+1th time is input into the second preset model for feature extraction to obtain the second feature information extracted for the j+1th time, wherein j is a positive integer and j∈[1,N].
[0075] Finally, the second feature information extracted for the N+1th time is taken as the target feature information.
[0076] In practical applications, the jth feature extraction unit can correspond to the jth attention unit, and the N+1th feature extraction unit corresponds to the N+1th attention unit. Figure 4 Take the following example to illustrate this. Figure 4 As shown, the feature weight map output by the attention unit b1 is fused with the target image (or the original feature image) and then input into the first feature extraction unit c1 to obtain the second feature information output by the feature extraction unit c1, that is, the second feature information extracted for the first time; the feature weight map output by the attention unit b2 is fused with the second feature information output by the feature extraction unit c1 and then input into the second feature extraction unit c2 to obtain the second feature information output by the feature extraction unit c2, that is, the second feature information extracted for the second time; and so on, until the N+1th feature extraction unit c is obtained. N+1 The output second feature information is the second feature information extracted for the N+1th time.
[0077] It can be seen that the feature weight map output by each attention unit is used to input different feature extraction units in the second preset model, which can play a weighted role in different feature extraction stages, thereby guiding the feature extraction unit to extract feature details for the weighted key feature areas in the image. In addition, since the feature weight map is generated based on the continuously corrected target key point information, the correction of the key point information also runs through the entire feature extraction process, so that the second preset model has the ability to adapt to changes in the feature map. In other words, compared to relying on the attention mechanism, taking the maximum coordinates of the feature map parameters from the model channel dimension or the time domain dimension as the attention point for feature extraction, the present application can reduce the problem of error accumulation, such as the maximum value is unstable during the training process and often appears in completely irrelevant positions, resulting in the feature becoming more and more biased and unable to effectively explain the training results. Therefore, it is beneficial to effectively extract interpretable image features in the case of unbalanced sample data distribution, so as to achieve more accurate image classification results.
[0078] It can be understood that the second feature information can be a heat map of each correction. By adjusting the convolution parameters of each feature extraction unit, as the number of feature extractions increases, the size of the heat map of each correction gradually decreases until the second feature information extracted for the N+1th time meets the specified image size. Further, for the corresponding feature extraction units, attention units, and correction units (such as Figure 4 The feature extraction unit c2, attention unit b2 and correction unit a1) shown in the figure have correlation in the network parameters (such as convolution parameters) used by each of them, so as to realize the overall synchronization and coordination effect of key point correction and attention mechanism with different feature extraction stages.
[0079] Step S240: classify the target image according to the target feature information to obtain an image classification result.
[0080] In the embodiment of the present application, the implementation of step S240 may be specifically related to the classification task information, so as to be applicable to various image classification scenarios. As an optional implementation, in the scenario of disease diagnosis, step S240 specifically includes the following steps:
[0081] Input the target feature information into the face attribute prediction module to obtain the face attribute prediction result. Input the target feature information into the face anomaly prediction module to obtain the face anomaly prediction result. According to the face attribute prediction result and the face anomaly prediction result, classify the target image to determine the image classification result, which includes identifying the target disease from the target image or not identifying the target disease.
[0082] Among them, the face attribute prediction module is used to predict the abnormal face attributes contained in the target image according to the target feature information. These abnormal face attributes may include but are not limited to appearance features such as facial asymmetry, wide eye distance, flat face, flat bridge of nose, small palpebral fissure, epicanthus and upward displacement of the outer side of the eye. The face abnormality prediction module is used to predict whether the target image has dementia performance according to the target feature information. Dementia performance is used to characterize the disease types of target diseases such as Down syndrome, mental retardation and non-behavioral persons. Both the face attribute prediction module and the face abnormality prediction module can adopt a classification model based on a CNN network (such as VGG, GoogLeNet or ResNet, etc.) or naive Bayes, and there is no specific limitation on this. At the same time, the face attribute prediction module and the face abnormality prediction module respectively use different module parameters, do not share weights, and independently learn image features that are difficult to distinguish.
[0083] Optionally, when training the face attribute prediction module and the face anomaly prediction module, the overall loss value of the two is the weighted sum of the first loss value of the face attribute prediction module and the second loss value of the face anomaly prediction module, for example, the overall loss value = the first loss value + the second loss value, so that the parameters of the face attribute prediction module and the face anomaly prediction module are adjusted by back propagation of the overall loss value until the training is completed. Among them, the first loss value is the cross entropy of the face attribute prediction module, and the second loss value is the cross entropy of the face anomaly prediction module.
[0084] It can be seen that combining specific facial abnormal attributes with the prediction results of dementia manifestations can more accurately determine whether the target disease can be identified from the target image.
[0085] In other optional embodiments, different classification models can be trained for other application scenarios such as lesion recognition, human posture detection or vehicle recognition. In practical applications, after obtaining the target feature information through steps S200 to S230, the corresponding classification model is called according to the classification task information, and then the target feature information is input into the classification model to obtain the image classification result matching the current classification task. It can be understood that, according to actual needs, different correction models and / or second preset models can also be trained for different classification tasks, which are flexible and variable to meet diverse classification needs.
[0086] It can be seen that the implementation of the above method embodiment can continuously correct the errors in key point information, avoid the continuous accumulation of errors caused by unbalanced data distribution, and affect the subsequent feature learning process. It can also guide the second preset model to identify key areas with higher discrimination from the target image through the feature weight map, and then learn more effective and interpretable target feature information from the key areas, thereby improving the reliability of image classification based on target feature information.
[0087] The present application also provides an image classification device. Figure 5 , Figure 5 is a structural block diagram of an image classification device used in the embodiment of the present application. Figure 5 As shown, the image classification device 500 includes an acquisition module 510, a recognition module 520, a correction module 530, a generation module 540, an extraction module 550 and a classification module 560, wherein:
[0088] The acquisition module 510 is used to acquire a target image.
[0089] The recognition module 520 is used to recognize the first key point information in the target image.
[0090] The correction module 530 is used to correct the first key point information multiple times according to a preset rule to obtain a key point information set, where the key point information set includes target key point information of each correction.
[0091] The generation module 540 is used to input the target key point information of each revision into the first preset model to obtain the feature weight map of each revision.
[0092] The extraction module 550 is used to input the target image and the feature weight map corrected each time into the second preset model to perform feature extraction to obtain target feature information.
[0093] The classification module 560 is used to classify the target image according to the target feature information to obtain an image classification result.
[0094] 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.
[0095] 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 classification method is implemented.
[0096] 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 classification method.
[0097] 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.
[0098] 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.
[0099] 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 classification method, characterized in that: The method comprises: Acquire a target image, and identify first key point information from the target image; The first key point information is modified multiple times according to a preset rule to obtain a key point information set, wherein the key point information set includes target key point information of each modification; Inputting the target key point information of each revision into the first preset model to obtain a feature weight map of each revision; Inputting the target image and each corrected feature weight map into a second preset model to extract features and obtain target feature information; Classifying the target image according to the target feature information to obtain an image classification result; wherein the image classification result includes identifying a target disease from the target image or not identifying the target disease; The first key point information is modified multiple times according to a preset rule to obtain a key point information set, including: Acquire classification task information for the target image, and determine the target key point type according to the classification task information; According to the target image and the target key point type, adjusting the first key point information to obtain second key point information that meets the target key point type; Determine the target key point information for the first correction according to the second key point information; The second key point information is corrected N times, and when the second key point information is corrected for the i-th time, the target key point information corrected for the i+1th time is obtained, where N and i are both positive integers, and i∈[1,N].
2. The method according to claim 1, characterized in that When the second key point information is corrected for the i-th time, obtaining the target key point information corrected for the (i+1)th time includes: When the second key point information is corrected for the i-th time, a correction parameter is generated according to the target key point information corrected for the i-th time; The target key point information corrected for the i-th time is corrected using the correction parameters to obtain the target key point information corrected for the (i+1)th time.
3. The method according to claim 2, characterized in that The target key point information corrected for the i-th time includes first coordinates of a plurality of key points, and the target key point information corrected for the (i+1)th time includes second coordinates of a plurality of the key points, and the second coordinates satisfy: ,in, ) is the second coordinate, (x, y) is the first coordinate, is the correction parameter.
4. The method according to any one of claims 1 to 3, characterized in that: The step of inputting the target key point information of each revision into the first preset model to obtain the feature weight map of each revision includes: According to the preset learning formula, the target key point information of each correction is input into the first preset model to perform attention parameter learning to obtain the attention parameter of each correction; Generate a feature weight map for each revision based on the target key point information and attention parameters for each revision; Wherein, the preset learning formula is: , Satisfying Gaussian distribution, x and y are the horizontal coordinate and vertical coordinate of each key point in the target key point information, respectively. is the attention parameter.
5. The method according to any one of claims 1 to 3, characterized in that: The target image and each corrected feature weight map are input into a second preset model to extract features to obtain target feature information, including: Input the target image and each corrected feature weight map into a second preset model to perform N+1 feature extractions, where N is a positive integer; In the first feature extraction, the target image and the first corrected feature weight map are fused to obtain first corrected first feature information, and then the first corrected first feature information is input into the second preset model for feature extraction to obtain first extracted second feature information; In the j+1th feature extraction, the second feature information extracted for the jth time and the feature weight map corrected for the j+1th time are fused to obtain the first feature information corrected for the j+1th time, and then the first feature information corrected for the j+1th time is input into the second preset model for feature extraction to obtain the second feature information extracted for the j+1th time, wherein j is a positive integer and j∈[1,N]; The second feature information extracted for the N+1th time is taken as the target feature information.
6. The method according to any one of claims 1 to 3, characterized in that: The step of classifying the target image according to the target feature information to obtain an image classification result includes: Inputting the target feature information into a face attribute prediction module to obtain a face attribute prediction result; Inputting the target feature information into a face anomaly prediction module to obtain a face anomaly prediction result; The target image is classified according to the facial attribute prediction result and the facial anomaly prediction result to determine an image classification result.
7. An image classification device, characterized in that: The device comprises: An acquisition module, used for acquiring a target image; A recognition module, used to recognize first key point information in the target image; A correction module, used to correct the first key point information multiple times according to a preset rule to obtain a key point information set, wherein the key point information set includes target key point information of each correction; A generation module, used for inputting the target key point information of each revision into the first preset model to obtain a feature weight map of each revision; An extraction module, used for inputting the target image and each corrected feature weight map into a second preset model to perform feature extraction and obtain target feature information; A classification module, used to classify the target image according to the target feature information to obtain an image classification result; wherein the image classification result includes identifying a target disease from the target image or not identifying the target disease; The correction module is used to correct the first key point information multiple times according to a preset rule to obtain a key point information set, including: Acquire classification task information for the target image, and determine the target key point type according to the classification task information; According to the target image and the target key point type, adjusting the first key point information to obtain second key point information that meets the target key point type; Determine the target key point information for the first correction according to the second key point information; The second key point information is corrected N times, and when the second key point information is corrected for the i-th time, the target key point information corrected for the i+1th time is obtained, where N and i are both positive integers, and i∈[1,N].
8. 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 classification method as described in any one of claims 1 to 6 are realized.
9. 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 classification method according to any one of claims 1 to 6.
