Method and related apparatus for determining image quality recognition model

HK40086925BActive Publication Date: 2026-07-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
HK · HK
Patent Type
Patents
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2023-07-21
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In existing image recognition business scenarios, the high cost of image quality recognition makes it difficult to guarantee the accuracy of image recognition results, and requires a lot of manpower and time for image quality annotation.

Method used

By acquiring image samples labeled with actual classification categories, using an initial classification model to determine the probability distribution of image samples under multiple classification categories, setting an attention layer to generate attention weights, training the classification model, and changing the attention layer to the output layer, an image quality recognition model is formed without the need to specifically label image quality samples.

Benefits of technology

It reduces the cost of acquiring image quality recognition models, improves the accuracy of image recognition technology, enables convenient identification of image quality, and enhances the effectiveness of image recognition in business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a kind of determination method and related device of image quality identification model, it is related to image recognition and machine learning in artificial intelligence field, in image classification scene, image quality and classification difficulty are relevant, so obtain the image sample labeled actual classification category, determine the probability distribution of image sample under multiple classification categories by initial classification model, generate the attention weight of corresponding classification difficulty for image sample based on the probability distribution by attention layer, the attention weight can let model more focus on the image sample not easy to be classified, so that the classification model trained, the size of the attention weight output by the attention layer of its can play the role of distinguishing the height of the image quality of input image.Further, without specially labeling the sample of image quality, by changing the attention layer in the trained classification model to the model output layer, an identification model for identifying image quality according to the attention weight can be obtained, which reduces the acquisition cost of the identification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and in particular to a method and apparatus for determining an image quality recognition model. Background Technology

[0002] Many current business scenarios require the application of image recognition technology. By taking an input image to be recognized, image recognition technology can be used to perform services such as face recognition, face editing, video understanding, and content recommendation.

[0003] In these business scenarios, the quality of the input image to be recognized will affect the accuracy of the image recognition result. However, most related technologies use deep models to recognize image quality, but training deep models requires a large number of image samples, and the image samples need to be labeled with labels that reflect the quality of the image. Labeling requires a lot of manpower and time.

[0004] Therefore, in order to save costs, the image quality of the image to be recognized is generally not assessed before processing in the above business scenarios, which makes it difficult to guarantee the accuracy of the image recognition results. Summary of the Invention

[0005] To address the aforementioned technical problems, this application provides a method and related apparatus for determining an image quality recognition model. This method can obtain a recognition model for image quality recognition without the need for specially labeled image quality samples, thus greatly reducing the cost of acquiring the recognition model.

[0006] The embodiments of this application disclose the following technical solutions:

[0007] On one hand, embodiments of this application provide a method for determining an image quality recognition model, the method comprising:

[0008] Obtain image samples including sample labels, the sample labels being used to identify the actual classification category of the image samples;

[0009] The image samples are input into an initial classification model, and the probability distribution under multiple classification categories is determined by the initial classification model.

[0010] Based on the probability distribution, the attention weights corresponding to the image samples are determined through the attention layer of the initial classification model, and the attention weights are used to identify the classification difficulty of the image samples;

[0011] The loss function corresponding to the image sample is determined based on the attention weights and the difference between the probability distribution and the actual classification category;

[0012] The initial classification model is trained using the loss function to obtain a classification model.

[0013] The attention layer of the classification model is changed to the model output layer to obtain a recognition model for identifying image quality based on the attention weights.

[0014] On the other hand, embodiments of this application provide an apparatus for determining an image quality recognition model, the apparatus comprising an acquisition unit, a determination unit, a training unit, and a modification unit:

[0015] The acquisition unit is used to acquire image samples including sample labels, wherein the sample labels are used to identify the actual classification category of the image samples;

[0016] The determining unit is used to input the image sample into an initial classification model and determine the probability distribution under multiple classification categories through the initial classification model.

[0017] The determining unit is further configured to determine the attention weight corresponding to the image sample through the attention layer of the initial classification model according to the probability distribution, wherein the attention weight is used to identify the classification difficulty of the image sample;

[0018] The determining unit is further configured to determine the loss function corresponding to the image sample based on the attention weight and the difference between the probability distribution and the actual classification category;

[0019] The training unit is used to train the initial classification model using the loss function to obtain a classification model.

[0020] The modification unit is used to change the attention layer of the classification model to the model output layer, thereby obtaining a recognition model for recognizing image quality based on the attention weights.

[0021] In another aspect, embodiments of this application provide a computer device, the computer device including a processor and a memory:

[0022] The memory is used to store program code and transmit the program code to the processor;

[0023] The processor is used to execute the image quality recognition model determination method described above according to the instructions in the program code.

[0024] In another aspect, embodiments of this application provide a computer-readable storage medium for storing a computer program for executing the image quality recognition model determination method described above.

[0025] In another aspect, embodiments of this application provide a computer program product including instructions that, when run on a computer, cause the computer to execute the method for determining the image quality recognition model described above.

[0026] As can be seen from the above technical solution, in image classification scenarios, images whose classification type is easily determined generally have better image quality, while images whose classification type is difficult to determine generally have poor image quality. Therefore, image samples labeled with actual classification categories are obtained, and the probability distribution of image samples under multiple classification categories is determined through an initial classification model. This probability distribution can directly reflect whether an image sample is easy to classify. By setting an attention layer in the initial classification model, attention weights corresponding to the classification difficulty are generated for the image samples based on this probability distribution. Thus, when training the initial classification model using the loss function determined by the attention weights and sample labels, these attention weights allow the model to pay more attention to image samples that are difficult to classify. The classification model trained in this way can distinguish whether the input image is easy or difficult to classify by the magnitude of the attention weights output by its attention layer, which is equivalent to intuitively reflecting the image quality. Therefore, there is no need to specifically label images for quality. The aforementioned classification model can be trained using a large number of samples with existing category labels, and its attention layer can be changed to the model output layer to obtain a recognition model for identifying image quality based on attention weights. This greatly reduces the cost of obtaining a recognition model, thereby conveniently improving the image quality of input images in business scenarios where image recognition technology is applied. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 A scene diagram illustrating the determination of an image quality recognition model provided in this application embodiment;

[0029] Figure 2 A flowchart illustrating a method for determining an image quality recognition model, provided in an embodiment of this application;

[0030] Figure 3 A schematic diagram of classification difficulty in vector space provided for an embodiment of this application;

[0031] Figure 4a This is a model structure diagram for a classification model;

[0032] Figure 4bA model structure diagram of a classification model provided in an embodiment of this application;

[0033] Figure 5 This is a schematic diagram of an image quality recognition result obtained through a recognition model, provided in an embodiment of this application.

[0034] Figure 6 A device structure diagram of an image quality recognition model determination apparatus provided in an embodiment of this application;

[0035] Figure 7 A structural diagram of a terminal device provided in an embodiment of this application;

[0036] Figure 8 This is a structural diagram of a server provided in an embodiment of this application. Detailed Implementation

[0037] The embodiments of this application will now be described with reference to the accompanying drawings.

[0038] Before implementing image recognition technology, pre-identifying the image to be recognized based on its image quality can effectively improve the accuracy of subsequent image recognition. For example, in image recognition technology scenarios related to face recognition, in most cases, it is desirable to recognize a high-quality face image.

[0039] However, the relevant technologies mainly achieve image quality recognition by training deep models. Before training, a large number of image samples with image quality labels need to be specifically labeled to complete the training of the deep model. Collecting and labeling image samples is time-consuming and labor-intensive. Therefore, image quality recognition is basically not performed before the implementation of image recognition technology.

[0040] Therefore, embodiments of this application provide a method and related apparatus for determining an image quality recognition model, which can obtain a recognition model for image quality recognition without the need for specially labeled image quality samples, greatly reducing the cost of obtaining the recognition model.

[0041] The image quality recognition model determination method provided in this application can be implemented using a computer device, which can be a terminal device or a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, and vehicle terminals. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitations on this connection.

[0042] This application can be applied to the field of artificial intelligence (AI). AI is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0043] With the research and advancement of artificial intelligence (AI) technology, AI is being studied and applied in various fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, smart customer service, vehicle networking, and intelligent transportation. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.

[0044] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, as well as machine learning / deep learning, autonomous driving, and intelligent transportation.

[0045] The embodiments of this application mainly relate to computer vision technology and machine learning.

[0046] Computer vision (CV) is the science that studies how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes in recognizing, tracking, and measuring targets, and then performs image processing to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), autonomous driving, intelligent transportation, and common biometric recognition technologies such as facial recognition and fingerprint recognition.

[0047] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.

[0048] For example, in the embodiments of this application, a classification model or a recognition model can be used to identify various types of information included in an image based on computer vision technology. An initial classification model can be trained based on machine learning, so that the attention layer in the initial classification model can distinguish between simple samples that are easy to classify and difficult samples that are not easy to classify. This establishes a relationship between attention weights and classification difficulty, so that the recognition model can distinguish images to be recognized with different image qualities based on the output attention weights.

[0049] It is understood that in the specific embodiments of this application, the image samples and images to be identified may involve user information, facial features and other related data. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0050] Figure 1 The illustration shows a model determination scenario provided in the embodiments of this application, wherein server 100 is used as an example of the aforementioned computer device for explanation.

[0051] Since there are already many images labeled with classification categories (not image quality), it is not necessary to specifically label the image samples with image quality-related sample labels. Instead, the actual classification categories that have already been labeled can be used as the sample labels for the image samples to train the classification model. This training process is supervised training relative to the classification model, but unsupervised training relative to the final recognition model used to identify image quality.

[0052] In the embodiments of this application, image quality includes not only the quality of conventional image attributes, such as sharpness and brightness, but also the quality related to image recognition technology, such as the display quality of the object to be recognized. For example, in a face recognition scenario, whether the face in the face image is frontal or whether it is occluded falls within the scope of image quality.

[0053] In image classification scenarios, images that are easy to classify generally have better image quality, while images that are difficult to classify generally have poor image quality. For example, for face images, blurry images, non-frontal images, and images with occlusions will all affect the classification of face images.

[0054] exist Figure 1 In the scenario shown, the image sample can be a face image, and its sample label can be a label that marks the actual person category, such as person a or person b, etc.

[0055] By acquiring image samples labeled with actual person categories, the probability distribution of image samples under multiple person categories is determined based on the initial classification model. This probability distribution can directly reflect whether the image samples are easy to classify.

[0056] Taking multiple character categories, character a and character b, as an example, when the probability distribution corresponding to face image 1 is [51%, 49%], it shows that the face in the image sample has a 51% probability of being character a and a 49% probability of being character b. Since the probabilities are relatively close, it indicates that the features of the face in face image 1 are not clear, such as the image is blurry or the face is occluded. The image quality is not high and it is a face image that is not easy to be correctly classified.

[0057] When the probability distribution corresponding to face image 2 is [91%, 9%], it shows that the face in the image sample has a 91% probability of being person a and a 9% probability of being person b. Since the probability difference is large, it indicates that the face in face image 2 has clear features, high image quality, and is a face image that is easy to be correctly classified.

[0058] By setting an attention layer in the initial classification model, attention weights corresponding to the classification difficulty are generated for image samples based on the probability distribution. Thus, when training the initial classification model using the loss function determined by the attention weights and sample labels, the attention weights can make the model pay more attention to image samples that are not easy to classify. Therefore, the attention weights assigned to face image 1 will be significantly different from those assigned to face image 2.

[0059] The classification model trained in this way can distinguish whether an input image is easy or difficult to classify by the magnitude of the attention weights output by its attention layer, which is equivalent to intuitively reflecting the quality of the image. For example, the aforementioned face image 1 is a low-quality image, while face image 2 is a high-quality image. By adjusting the magnitude of the attention weights, face image 1 and face image 2 can be effectively distinguished.

[0060] Therefore, there is no need to specifically label samples of image quality. The aforementioned classification model can be trained using a large number of samples with existing category labels, such as the aforementioned face images that identify human categories. By changing its attention layer to the model output layer, a recognition model for identifying image quality based on attention weights can be obtained, which greatly reduces the cost of acquiring the recognition model. This allows for convenient improvement of the image quality of input images in business scenarios where image recognition technology is applied through the recognition model.

[0061] Figure 2 This is a flowchart illustrating a method for determining an image quality recognition model, provided in an embodiment of this application. In this embodiment, a server is used as the aforementioned computer device for description.

[0062] The method includes:

[0063] S201: Obtain an image sample including a sample label, wherein the sample label is used to identify the actual classification category of the image sample;

[0064] This application does not limit the classification scenario corresponding to the classification model. The classification scenario can be determined by the actual classification category used as the sample label. For example, when the image sample is a face image, if the corresponding actual classification category includes the "person" category, the corresponding classification scenario can be "person" classification; if the corresponding actual classification category includes "gender," the corresponding classification scenario can be "gender" classification. In addition, it can also include various other classification scenarios that are unrelated to image quality, such as classification based on difficulty.

[0065] It should be emphasized that the sample label of this image sample does not directly represent the image quality of the image sample, but rather identifies the classification category related to the image content in the image sample.

[0066] This application does not limit the content included in the image sample. For example, the image sample can be a face image, or a landscape image, a film or television image, etc.

[0067] In one possible implementation, the image sample is a face image sample, and the sample label is used to identify the actual user identifier corresponding to the face in the face image sample.

[0068] The face image sample includes face-related image content, which is labeled with a corresponding actual user identifier. This actual user identifier is used to identify the face-related category included in the sample. For example, it can be a specific person identifier such as a celebrity or scholar, or a specific appearance feature such as long hair or bald head, or a human category such as gender.

[0069] Correspondingly, the initial classification model can achieve image recognition under multiple classification categories. When the image sample is a face image sample, the multiple classification categories can be determined based on the range involved by the actual user identifier of the face image sample; for example, the multiple classification categories can be constructed according to the range involved by the actual user identifier.

[0070] For example, when the actual user identifier is a specific person identifier, multiple categories can be determined based on different person identifiers, such as celebrity A, celebrity B, and scholar C. When the actual user identifier is gender, multiple categories can be determined based on gender, such as male and female.

[0071] S202: Input the image sample into the initial classification model, and determine the probability distribution under multiple classification categories through the initial classification model.

[0072] The initial classification model's ability to identify multiple categories can be determined based on the actual application scenario or on the existing sample labels of the image samples. For example, if the sample labels can only identify whether something belongs to a certain category, the initial classification model's identification of multiple categories can be a binary classification, meaning it either belongs to that category or it does not belong to that category. Conversely, if the sample labels can identify one of multiple categories, the initial classification model's identification of multiple categories can be a multi-class classification (including binary classification).

[0073] The initial classification model is a classification model that uses artificial intelligence to identify information related to multiple classification categories based on the image features carried in the input image samples. Based on this information, it identifies which of the multiple classification categories the image sample may belong to and outputs a quantified probability classification. The probability values ​​included in this probability distribution can be the same as and correspond one-to-one with the multiple classification categories, and are used to reflect the probability that the image sample may belong to the corresponding classification category.

[0074] This probability distribution reflects the probability that an image sample belongs to one of the multiple classification categories. The sum of these probabilities can be 1 or not, and this application does not impose any limitation on this. By observing the differences and magnitudes of the different probabilities in the probability distribution, the classification difficulty of the image sample can be reflected, and the classification difficulty will directly affect the magnitude of the difference between the loss function of the image sample and the actual classification category.

[0075] The classification difficulty reflected in the probability distribution is directly reflected in the loss function corresponding to the image sample. When the classification difficulty of an image sample is high, the initial classification model will not easily obtain the correct classification category, meaning the classification category differs greatly from the actual classification category identified by the image sample's label, resulting in a large loss function. Conversely, when the classification difficulty of an image sample is low, the initial classification model will easily obtain the correct classification category, meaning the classification category is very close to the actual classification category identified by the image sample's label, resulting in a small loss function.

[0076] like Figure 3 As shown, each circular and triangular point represents the position of the feature vector of a different image sample in the same vector space. The straight line in the middle represents the feature vector boundary between the two different classification categories of the initial classification model.

[0077] The closer the feature vector is to the top left corner of the image sample, the greater the likelihood that it will be identified as category 1 by the initial classification model. The closer the feature vector is to the bottom right corner of the image sample, the greater the likelihood that it will be identified as category 2 by the initial classification model. These image samples with feature vectors far from the feature vector boundary are easy to classify. The features related to the classification category are relatively clear in the image samples, and their image quality is generally relatively good.

[0078] Correspondingly, the closer the feature vector is to the boundary of the feature vector, the more difficult it is for the initial classification model to identify it as category 1 or category 2. These image samples with feature vectors close to the feature vector boundary are difficult to classify. The features related to the classification category in the image samples are relatively blurry, and their image quality is generally relatively poor.

[0079] Although in the early stages of training the initial classification model, the loss function cannot directly reflect the image quality of the image samples because the initial classification model has not yet learned enough classification knowledge. For example, at the beginning of training, even image samples with good image quality may be classified incorrectly, resulting in a large loss function. However, as training continues, the initial classification model learns more classification knowledge. Since high-quality image samples carry richer classification-related features, the probability of high-quality image samples being correctly classified increases, and the corresponding loss function decreases faster.

[0080] Correspondingly, although the loss function of low-quality image samples is not much different from that of high-quality image samples in the early stage of training, low-quality image samples carry fewer classification-related features. Even if the initial classification model learns classification knowledge as the training process progresses, it is difficult to correctly classify low-quality image samples, and the corresponding loss function decreases very slowly, remaining near the boundary of the loss function.

[0081] Therefore, the probability distribution of an image sample can effectively reflect the classification difficulty of that image sample.

[0082] S203: Based on the probability distribution, determine the attention weights corresponding to the image samples through the attention layer of the initial classification model.

[0083] For the purpose of classification training, by setting an attention layer in the initial classification model, the attention mechanism provided by the attention layer will focus on difficult samples, i.e. image samples that are not easy to classify. Since the probability distribution can reflect the classification difficulty of the image sample, the attention weight output by the attention layer for the probability distribution of an image sample will be related to the classification difficulty of the image sample. That is, the attention weight is used to identify the classification difficulty of the image sample.

[0084] This attention layer can employ a self-attention mechanism, which includes two linear layers and an activation function, as expressed mathematically below:

[0085]

[0086]

[0087] Where, hidden is the output of the hidden layer in the attention layer, W1 and W2 are the model parameters adjusted through model training, embedding is the vector corresponding to the probability distribution, and tanh and sigmoid are the activation functions.

[0088] Since the purpose of attention weights is to guide the initial classification model to focus on difficult samples, optionally, the attention weights are inversely correlated with the classification difficulty of the image samples. That is, for image samples that are difficult to classify correctly, the corresponding attention weights are larger, thereby increasing the influence of the image sample on the adjustment of model parameters during training. Therefore, in one possible implementation, the greater the classification difficulty, the lower the image quality.

[0089] S204: Determine the loss function corresponding to the image sample based on the attention weights and the difference between the probability distribution and the actual classification category.

[0090] S205: Train the initial classification model using the loss function to obtain the classification model.

[0091] By using attention weights to guide the initial classification model to focus more on image samples that are more difficult to classify (i.e., difficult samples) and less on image samples that are easier to classify (i.e. easy samples) during training, the classification ability of the initial classification model can be improved and the overfitting on easy samples can be reduced.

[0092] like Figure 4a The model structure shown is the model structure of the initial classification model in related technologies. For the input image samples, the probability distribution related to the classification purpose is obtained through the feature extraction layer, and then the corresponding loss function is determined through the probability distribution and sample labels.

[0093] like Figure 4b The diagram shows the model structure of the initial classification model in an embodiment of this application, compared to... Figure 4a An attention layer was added to the original model structure. The input to this attention layer is a vector (embedding) containing a probability distribution, and the output is attention weights. These attention weights are related to... Figure 4a Together with the loss function in the previous example, we obtain the corresponding loss function in this application embodiment, thereby guiding the initial classification model of this application to pay more attention to image samples with greater classification difficulty through attention weight.

[0094] S206: Change the attention layer of the classification model to the model output layer to obtain a recognition model for recognizing image quality based on the attention weights.

[0095] Through the above training based on classification objectives, the obtained classification model can effectively classify images accurately under multiple classification categories. At the same time, the attention weights output by the attention layer of the classification model can also reasonably distinguish images with different classification difficulties. Based on the aforementioned correlation between classification difficulty and image quality, the attention weights can accurately distinguish between high-quality and low-quality images.

[0096] In one possible implementation, the recognition model can be obtained by removing the output layer of the original classification model. S206 includes:

[0097] S2061: Delete the classification layer that serves as the output layer of the classification model.

[0098] S2062: The attention layer of the classification model is used as the model output layer to obtain a recognition model for recognizing image quality based on the attention weights.

[0099] By deleting the original output layer of the trained classification model (the classification layer) and then using the attention layer as the output layer of the newly generated recognition model, the recognition model can output corresponding attention weights based on the input image to be recognized through the attention layer, which is the model output layer. By using the attention weights that are related to the classification difficulty, i.e., the image quality, the recognition model can accurately identify the image quality of the image to be recognized.

[0100] Therefore, the original output layer of the classification model can be replaced with an attention layer to obtain a recognition model. That is, the output of the recognition model is the attention weights output by the attention layer. Through the ability of the attention weights to distinguish image quality, the recognition model is able to identify the image quality of the input image.

[0101] In one possible implementation, embodiments of this application provide a method for image quality recognition using a recognition model. The method includes:

[0102] S11: Obtain the image to be recognized.

[0103] S12: Determine the attention weight corresponding to the image to be recognized based on the recognition model.

[0104] S13: Based on the correlation between the attention weight and the classification difficulty, determine the recognition result of the image quality for the image to be recognized.

[0105] As mentioned earlier, the attention weights output by the recognition model for the image to be recognized reflect the classification difficulty of the image. There is a correlation between classification difficulty and image quality; that is, images that are easy to classify have higher image quality than those that are difficult to classify. In other words, there is an inverse correlation between image quality and classification difficulty. Specifically, the greater the classification difficulty, the lower the image quality.

[0106] A higher attention weight indicates a more difficult classification. Therefore, according to the recognition model, a smaller attention weight output for the image to be recognized results in higher image quality. This allows for accurate identification of higher-quality images from the existing image based on the attention weight. For example, when the attention weight is greater than a first threshold, classifying the image to be recognized becomes more difficult, resulting in lower image quality that does not meet the processing requirements of subsequent image recognition techniques. Conversely, when the attention weight is less than a second threshold (which is less than the first threshold), classifying the image to be recognized becomes easier, resulting in higher image quality that meets the processing requirements of subsequent image recognition techniques.

[0107] Therefore, in image classification scenarios, images whose classification type is easily determined generally have better image quality, while images whose classification type is difficult to determine generally have poor image quality. Thus, by acquiring image samples labeled with their actual classification categories and using an initial classification model to determine the probability distribution of image samples across multiple categories, this probability distribution directly reflects whether an image sample is easy to classify. By setting an attention layer in the initial classification model and generating attention weights corresponding to the classification difficulty of the image samples based on this probability distribution, when training the initial classification model using the loss function determined by the attention weights and sample labels, these attention weights allow the model to focus more on image samples that are difficult to classify. The resulting classification model, with its attention layer outputting attention weights, can distinguish whether an input image is easy or difficult to classify, thus directly reflecting the image quality. Therefore, there is no need to specifically label image quality samples. By using a large number of samples with existing category labels to train the aforementioned classification model and changing its attention layer to the model's output layer, a recognition model for identifying image quality based on attention weights can be obtained. This significantly reduces the cost of acquiring a recognition model, thereby conveniently improving the image quality of input images in business scenarios where image recognition technology is applied.

[0108] The initial classification model will be trained multiple times during the model training process. Each training session can be achieved using a batch of image samples.

[0109] Therefore, in one possible implementation, S201 includes: obtaining a sample batch containing the target number of image samples from the image sample set. The image sample set includes a large number of collected image samples with actual classification categories. Based on the number of samples required for one training session: the target number, the corresponding sample batch can be selected from the image sample set.

[0110] During the training of the initial classification model with a batch of samples, the initial classification model will classify and identify each image sample in the batch. During the identification process, each image sample will generate a corresponding probability distribution and attention weight.

[0111] Therefore, in one possible implementation, S203 includes: determining the attention weights corresponding to the target number of image samples respectively through the attention layer of the initial classification model based on the probability distributions corresponding to the target number of image samples respectively.

[0112] Wherein, the sum of the attention weights corresponding to the target number of image samples is a constant. The mathematical expression is as follows:

[0113]

[0114] Where const is a constant, and N is the number of image samples included in the sample batch.

[0115] In other words, in order to improve the discrimination of attention weights in terms of classification difficulty, for a batch of samples, the total amount of attention weights is controlled so that the final value of each attention weight in the batch is comprehensively measured based on the overall attention weight of the batch. This improves the stability of the attention weight values ​​for similar image quality and the discrimination of the weights for images with significantly different quality.

[0116] Training an initial classification model typically requires multiple training iterations, each of which can be performed on a batch of image samples. The number of image samples used in different batches can be the same or different.

[0117] Optionally, for S201: Based on the target quantity corresponding to different sample batches, obtain multiple sample batches sequentially from the image sample set.

[0118] In the process of determining the attention weights corresponding to image samples in the multiple sample batches through the attention layer of the initial classification model, the sum of the attention weights corresponding to the multiple sample batches is the same. That is to say, for different sample batches, the generation of corresponding attention weights is also based on the same numerical range for unified control and model training, further improving the ability of the attention weights of the initial classification model to distinguish the classification difficulty.

[0119] Since the number of image samples included in different sample batches may be different, in order to reasonably reflect the attention weights of different sample batches, normalization processing is required in a unified numerical space. Moreover, even if the number of image samples included in different sample batches is the same, normalization processing can facilitate subsequent calculations.

[0120] Therefore, in one possible implementation, S203 includes:

[0121] Based on the probability distribution, the initial attention value corresponding to the image sample is determined through the attention layer of the initial classification model;

[0122] The attention weight is obtained by normalizing the initial attention value based on the number of target images in the sample batch to which the image sample belongs and the constant.

[0123] The normalized mathematical expression is as follows:

[0124]

[0125] Where batch_size is the number of image samples in the batch. ∑attention is the sum of attention weights in the batch, where attention on the left side of the equation is the attention weight and attention on the right side of the equation is the initial attention value.

[0126] The following explains how to determine the loss function using attention weights and probability distributions, specifically for S204, including:

[0127] The initial loss function is determined based on the difference between the probability distribution and the actual classification category.

[0128] The attention weights are used as weights in the initial loss function to determine the loss function corresponding to the image sample.

[0129] In related technologies, the mathematical expression of the loss function of a classification model is as follows:

[0130]

[0131] In this application, the attention weights corresponding to the image samples are used to guide the impact of the difference between the predicted results (determined by probability distribution) and the actual classification categories on model training. The specific mathematical expression is as follows:

[0132]

[0133] To incorporate the image quality assessment of the aforementioned image samples into the classification training task, this application employs an adaptively learned parameter to learn the contribution of the current image sample to the overall loss function. This adaptively weights the loss function (loss) for each image sample, ensuring that image samples of different qualities contribute differently to the overall loss. Consequently, during the image quality recognition stage using the recognition model, the adaptively learned parameter values ​​(i.e., attention weights) can be directly used to obtain the image quality score (i.e., the degree of quality) of the current image to be recognized.

[0134] Based on this, the loss function for the initial classification model in this embodiment can be:

[0135]

[0136]

[0137]

[0138]

[0139] In this process, log_softmax calculates the softmax value (loss_cls) of the embedding. Simultaneously, the embedding is fed into the attention layer to obtain the attention weights. Then, the original softmax value is weighted using the attention weights to obtain the final softmax value (loss_att). Finally, the cross-entropy between loss_att and the sample label is calculated to obtain the final loss function.

[0140] It should be noted that although the embodiments of this application provide a scheme for training a classification model, the actual purpose is to obtain a recognition model for image quality recognition by means of training the classification model. Therefore, the attention layer, which is the output layer of the recognition model, is the focus of training.

[0141] Since the value of attention weights is generally between 0 and 1, that is, the value of any attention weight output by the attention layer is within this range.

[0142] When the image quality of images in a batch is too similar, the attention weights of each image sample will be too similar. For example, in a batch of images with good quality, the attention weights corresponding to the image samples will all be close to 0 based on the output of the attention layer. Too small attention weights will result in an overall loss function that is too small, which is not helpful for training the attention layer, makes it difficult to distinguish between different classification difficulties, and is not conducive to the stable training of the attention layer.

[0143] Therefore, in one possible implementation, the method further includes: pre-adjusting the numerical range of the attention weights determined by the attention layer to increase the upper and lower limits of the numerical range.

[0144] By increasing the upper and lower limits of the numerical range, for example, increasing the numerical range from 0 to 1 to 0.5 to 1.5, the lower limit is increased to prevent the loss function for image samples with good image quality from being too small, which is not conducive to the training of the attention layer. The upper limit is increased to increase the influence of the loss function for image samples with low image quality on the model training process.

[0145] By increasing the upper and lower limits of the numerical range of attention weights, the training effect of the attention layer in the initial classification model can be improved, thereby enhancing the discrimination of attention weights against different classification difficulties and ensuring the stability of training.

[0146] As can be seen from the foregoing embodiments, the method for determining the image quality recognition model provided in this application can achieve at least the following characteristics:

[0147] First, unsupervised: For image samples, no additional annotation of image quality is required; existing image samples that have already been labeled with the actual classification category can be used.

[0148] Secondly, it has a significant effect and can effectively filter images with low quality, such as blurry, poorly lit, or obscured images.

[0149] Third, for facial images, the performance and efficiency of facial data filtering, video facial recognition, and video facial clustering have been effectively improved.

[0150] Fourth, the trained classification model can be transferred to other targets and tasks, such as object classification.

[0151] Fifth, it can be easily compatible with current mobile network backend structures, such as MobileNet v2, v3, etc., only the final classification layer (i.e. the model output layer) of the classification model needs to be replaced.

[0152] For facial images, the recognition model provided in this application can effectively filter out low-quality facial images, such as blurry, profile, low-light, and occluded images. Figure 5 The recognition results shown demonstrate that the recognition model of this application can effectively distinguish between different types of recognition. Figure 5 The image quality of the image to be identified shown in the figure, for example, is obtained. Figure 5 The image quality is sorted as follows: from left to right, the image quality decreases.

[0153] Quantitative analysis: The test dataset was filtered out using a specially trained quality assessment model to remove images with poor quality. Then, using the same test dataset, the recognition model of this application was used for image quality recognition. The recognition accuracy is as follows, showing that the recognition model provided in this application has high recognition accuracy for image quality:

[0154] All test data Top 50% of test data Top 20% of test data 86.7% 93.7% 95.1%

[0155] In the foregoing Figures 1-5 Based on the corresponding embodiments, Figure 6 The diagram shows the structure of an image quality recognition model determination device 600, which includes an acquisition unit 601, a determination unit 602, a training unit 603, and a modification unit 604.

[0156] The acquisition unit 601 is used to acquire an image sample including a sample label, wherein the sample label is used to identify the actual classification category of the image sample;

[0157] The determining unit 602 is used to input the image sample into an initial classification model and determine the probability distribution under multiple classification categories through the initial classification model.

[0158] The determining unit 602 is further configured to determine the attention weight corresponding to the image sample through the attention layer of the initial classification model according to the probability distribution, wherein the attention weight is used to identify the classification difficulty of the image sample;

[0159] The determining unit 602 is further configured to determine the loss function corresponding to the image sample based on the attention weight and the difference between the probability distribution and the actual classification category;

[0160] The training unit 603 is used to train the initial classification model using the loss function to obtain a classification model.

[0161] The modification unit 604 is used to change the attention layer of the classification model to the model output layer to obtain a recognition model for recognizing image quality based on the attention weights.

[0162] In one possible implementation, the acquisition unit is further configured to acquire the image to be recognized;

[0163] The determining unit is further configured to determine the attention weight corresponding to the image to be recognized based on the recognition model;

[0164] The determining unit is further configured to determine the recognition result of the image quality of the image to be recognized based on the correlation between the attention weight and the classification difficulty, wherein the greater the classification difficulty, the lower the image quality.

[0165] In one possible implementation, the acquisition unit is further configured to:

[0166] Obtain a sample batch containing the target number of image samples from the image sample set;

[0167] The step of determining the attention weights corresponding to the image samples through the attention layer of the initial classification model based on the probability distribution includes:

[0168] Based on the probability distributions corresponding to the target number of image samples, the attention weights corresponding to the target number of image samples are determined through the attention layer of the initial classification model, wherein the sum of the attention weights corresponding to the target number of image samples is a constant.

[0169] In one possible implementation, the acquisition unit is further configured to:

[0170] Based on the target quantity corresponding to different sample batches, multiple sample batches are sequentially obtained from the image sample set;

[0171] In the process of determining the attention weights corresponding to the image samples in the multiple sample batches through the attention layer of the initial classification model, the sum of the attention weights corresponding to the multiple sample batches is the same.

[0172] In one possible implementation, the determining unit is further configured to:

[0173] Based on the probability distribution, the initial attention value corresponding to the image sample is determined through the attention layer of the initial classification model;

[0174] The attention weight is obtained by normalizing the initial attention value based on the number of target images in the sample batch to which the image sample belongs and the constant.

[0175] In one possible implementation, the apparatus further includes an adjustment unit for pre-adjusting the numerical range of the attention weights determined by the attention layer to increase the upper and lower limits of the numerical range.

[0176] In one possible implementation, the determining unit is further configured to:

[0177] The initial loss function is determined based on the difference between the probability distribution and the actual classification category;

[0178] The attention weights are used as weights in the initial loss function to determine the loss function corresponding to the image sample.

[0179] In one possible implementation, the modification unit is further configured to:

[0180] Delete the classification layer that serves as the output layer of the classification model.

[0181] The attention layer of the classification model is used as the model output layer to obtain a recognition model for identifying image quality based on the attention weights.

[0182] In one possible implementation, the attention weights are inversely correlated with the classification difficulty of the image samples.

[0183] In one possible implementation, the image sample is a face image sample, and the sample label is used to identify the actual user identifier corresponding to the face in the face image sample.

[0184] In one possible implementation, the multiple classification categories are determined based on the actual user identifier.

[0185] Therefore, in image classification scenarios, images whose classification type is easily determined generally have better image quality, while images whose classification type is difficult to determine generally have poor image quality. Thus, by acquiring image samples labeled with their actual classification categories and using an initial classification model to determine the probability distribution of image samples across multiple categories, this probability distribution directly reflects whether an image sample is easy to classify. By setting an attention layer in the initial classification model and generating attention weights corresponding to the classification difficulty of the image samples based on this probability distribution, when training the initial classification model using the loss function determined by the attention weights and sample labels, these attention weights allow the model to focus more on image samples that are difficult to classify. The resulting classification model, with its attention layer outputting attention weights, can distinguish whether an input image is easy or difficult to classify, thus directly reflecting the image quality. Therefore, there is no need to specifically label image quality samples. By using a large number of samples with existing category labels to train the aforementioned classification model and changing its attention layer to the model's output layer, a recognition model for identifying image quality based on attention weights can be obtained. This significantly reduces the cost of acquiring a recognition model, thereby conveniently improving the image quality of input images in business scenarios where image recognition technology is applied.

[0186] This application also provides a computer device, which is the computer device described above, and may include a terminal device or a server. The aforementioned image quality recognition model determination device may be configured in this computer device. The computer device will now be described in conjunction with the accompanying drawings.

[0187] If the computer device is a terminal device, please refer to Figure 7 As shown, this application provides a terminal device, taking a mobile phone as an example:

[0188] Figure 7 This diagram illustrates a partial structural representation of a mobile phone related to the terminal device provided in this embodiment. (Reference) Figure 7 The mobile phone includes components such as: a radio frequency (RF) circuit 1410, a memory 1420, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a wireless Fidelity (WiFi) module 1470, a processor 1480, and a power supply 1490. Those skilled in the art will understand that... Figure 7 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0189] The following is combined Figure 7A detailed introduction to each component of a mobile phone:

[0190] RF circuit 1410 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 1480; additionally, it transmits uplink data to the base station. Typically, RF circuit 1410 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), and a duplexer. Furthermore, RF circuit 1410 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).

[0191] The memory 1420 can be used to store software programs and modules. The processor 1480 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1420. The memory 1420 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0192] The input unit 1430 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1430 may include a touch panel 1431 and other input devices 1432. The touch panel 1431, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1431), and drive the corresponding connected devices according to a pre-set program. Optionally, the touch panel 1431 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1480, and can also receive and execute commands sent by the processor 1480. In addition, the touch panel 1431 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1431, the input unit 1430 may also include other input devices 1432. Specifically, other input devices 1432 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0193] The display unit 1440 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1440 may include a display panel 1441, which may optionally be configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel. Further, a touch panel 1431 may cover the display panel 1441. When the touch panel 1431 detects a touch operation on or near it, it transmits the information to the processor 1480 to determine the type of touch event. Subsequently, the processor 1480 provides corresponding visual output on the display panel 1441 based on the type of touch event. Although in Figure 7 In this embodiment, the touch panel 1431 and the display panel 1441 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1431 and the display panel 1441 can be integrated to realize the input and output functions of the mobile phone.

[0194] The mobile phone may also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1441 according to the ambient light level, and the proximity sensor can turn off the display panel 1441 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0195] Audio circuit 1460, speaker 1461, and microphone 1462 provide an audio interface between the user and the mobile phone. Audio circuit 1460 converts received audio data into electrical signals and transmits them to speaker 1461, where speaker 1461 converts them into sound signals for output. On the other hand, microphone 1462 converts collected sound signals into electrical signals, which are received by audio circuit 1460, converted into audio data, and then processed by processor 1480 before being transmitted via RF circuit 1410 to, for example, another mobile phone, or the audio data can be output to memory 1420 for further processing.

[0196] WiFi is a short-range wireless transmission technology. Mobile phones, through the WiFi module 1470, can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 7 WiFi module 1470 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.

[0197] The processor 1480 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 1420, and by calling data stored in the memory 1420. Optionally, the processor 1480 may include one or more processing units; preferably, the processor 1480 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 1480.

[0198] The mobile phone also includes a power supply 1490 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1480 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0199] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.

[0200] In this embodiment, the processor 1480 included in the terminal device also has the following functions:

[0201] Obtain image samples including sample labels, the sample labels being used to identify the actual classification category of the image samples;

[0202] The image samples are input into an initial classification model, and the probability distribution under multiple classification categories is determined by the initial classification model.

[0203] Based on the probability distribution, the attention weights corresponding to the image samples are determined through the attention layer of the initial classification model, and the attention weights are used to identify the classification difficulty of the image samples;

[0204] The loss function corresponding to the image sample is determined based on the attention weights and the difference between the probability distribution and the actual classification category;

[0205] The initial classification model is trained using the loss function to obtain a classification model.

[0206] The attention layer of the classification model is changed to the model output layer to obtain a recognition model for identifying image quality based on the attention weights.

[0207] If the computer device is a server, this application embodiment also provides a server; please refer to [link to relevant documentation]. Figure 8 As shown, Figure 8This is a structural diagram of a server 1500 provided in an embodiment of this application. The server 1500 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1522 (e.g., one or more processors) and memory 1532, and one or more storage media 1530 (e.g., one or more mass storage devices) for storing application programs 1542 or data 1544. The memory 1532 and storage media 1530 can be temporary or persistent storage. The program stored in the storage media 1530 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 1522 may be configured to communicate with the storage media 1530 and execute the series of instruction operations in the storage media 1530 on the server 1500.

[0208] Server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input / output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.

[0209] The steps performed by the server in the above embodiments can be based on Figure 8 The server structure shown.

[0210] In addition, this application embodiment also provides a storage medium for storing a computer program for executing the method provided in the above embodiment.

[0211] This application also provides a computer program product including instructions that, when run on a computer, cause the computer to perform the methods provided in the above embodiments.

[0212] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk or optical disk, and other media that can store program code.

[0213] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0214] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Moreover, based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for determining an image quality recognition model, characterized in that, The method includes: Obtain image samples including sample labels, the sample labels being used to identify the actual classification category of the image samples; The image samples are input into an initial classification model, and the probability distribution under multiple classification categories is determined by the initial classification model. Based on the probability distributions corresponding to the target number of image samples, the attention weights corresponding to the target number of image samples are determined through the attention layer of the initial classification model. The sum of the attention weights corresponding to the target number of image samples is a constant. The attention weights are used to identify the classification difficulty of the image samples, and the attention weights are negatively correlated with the classification difficulty. The loss function corresponding to the image sample is determined based on the attention weights and the difference between the probability distribution and the actual classification category; The initial classification model is trained using the loss function to obtain a classification model. The attention layer of the classification model is changed to the model output layer to obtain a recognition model for identifying image quality based on the attention weights.

2. The method according to claim 1, characterized in that, The method further includes: Acquire the image to be recognized; The attention weights corresponding to the image to be recognized are determined based on the recognition model. Based on the correlation between the attention weight and the classification difficulty, the recognition result for the image quality of the image to be recognized is determined, wherein the greater the classification difficulty, the lower the image quality.

3. The method according to claim 1, characterized in that, The acquisition of image samples including sample labels includes: Obtain a batch of images from the image sample set, including the target number of images.

4. The method according to claim 3, characterized in that, The step of obtaining a sample batch containing a target number of image samples from the image sample set includes: Based on the target quantity corresponding to different sample batches, multiple sample batches are sequentially obtained from the image sample set; In the process of determining the attention weights corresponding to the image samples in the multiple sample batches through the attention layer of the initial classification model, the sum of the attention weights corresponding to the multiple sample batches is the same.

5. The method according to claim 3, characterized in that, The step of determining the attention weights corresponding to the image samples through the attention layer of the initial classification model based on the probability distribution includes: Based on the probability distribution, the initial attention value corresponding to the image sample is determined through the attention layer of the initial classification model; The attention weight is obtained by normalizing the initial attention value based on the number of target images in the sample batch to which the image sample belongs and the constant.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: The numerical range of attention weights determined by the attention layer is pre-adjusted to increase the upper and lower limits of the numerical range.

7. The method according to any one of claims 1-5, characterized in that, The step of determining the loss function corresponding to the image sample based on the attention weights and the difference between the probability distribution and the actual classification category includes: The initial loss function is determined based on the difference between the probability distribution and the actual classification category; The attention weights are used as weights in the initial loss function to determine the loss function corresponding to the image sample.

8. The method according to any one of claims 1-5, characterized in that, The step of changing the attention layer of the classification model to the model output layer to obtain a recognition model for identifying image quality based on the attention weights includes: Delete the classification layer that serves as the output layer of the classification model. The attention layer of the classification model is used as the model output layer to obtain a recognition model for identifying image quality based on the attention weights.

9. The method according to any one of claims 1-5, characterized in that, The image sample is a face image sample, and the sample label is used to identify the actual user identifier corresponding to the face in the face image sample.

10. The method according to claim 9, characterized in that, The multiple classification categories are determined based on the actual user identifier.

11. A device for determining an image quality recognition model, characterized in that, The device includes an acquisition unit, a determination unit, a training unit, and a modification unit: The acquisition unit is used to acquire image samples including sample labels, wherein the sample labels are used to identify the actual classification category of the image samples; The determining unit is used to input the image sample into an initial classification model and determine the probability distribution under multiple classification categories through the initial classification model. The determining unit is further configured to determine the attention weights corresponding to the target number of image samples respectively through the attention layer of the initial classification model based on the probability distributions corresponding to the target number of image samples respectively, wherein the sum of the attention weights corresponding to the target number of image samples is a constant, the attention weights are used to identify the classification difficulty of the image samples, and the attention weights are negatively correlated with the classification difficulty; The determining unit is further configured to determine the loss function corresponding to the image sample based on the attention weight and the difference between the probability distribution and the actual classification category; The training unit is used to train the initial classification model using the loss function to obtain a classification model. The modification unit is used to change the attention layer of the classification model to the model output layer, thereby obtaining a recognition model for recognizing image quality based on the attention weights.

12. The apparatus according to claim 11, characterized in that, The acquisition unit is also used to acquire the image to be recognized; The determining unit is further configured to determine the attention weight corresponding to the image to be recognized based on the recognition model; The determining unit is further configured to determine the recognition result of the image quality of the image to be recognized based on the correlation between the attention weight and the classification difficulty, wherein the greater the classification difficulty, the lower the image quality.

13. The apparatus according to claim 11, characterized in that, The acquisition unit is also used for: Obtain a batch of images from the image sample set, including the target number of images.

14. The apparatus according to claim 13, characterized in that, The acquisition unit is also used for: Based on the target quantity corresponding to different sample batches, multiple sample batches are sequentially obtained from the image sample set; In the process of determining the attention weights corresponding to the image samples in the multiple sample batches through the attention layer of the initial classification model, the sum of the attention weights corresponding to the multiple sample batches is the same.

15. The apparatus according to claim 13, characterized in that, The determining unit is further configured to: Based on the probability distribution, the initial attention value corresponding to the image sample is determined through the attention layer of the initial classification model; The attention weight is obtained by normalizing the initial attention value based on the number of target images in the sample batch to which the image sample belongs and the constant.

16. The apparatus according to any one of claims 11-15, characterized in that, The device further includes an adjustment unit, which is used to pre-adjust the numerical range of the attention weights determined by the attention layer to increase the upper and lower limits of the numerical range.

17. The apparatus according to any one of claims 11-15, characterized in that, The determining unit is further configured to: The initial loss function is determined based on the difference between the probability distribution and the actual classification category; The attention weights are used as weights in the initial loss function to determine the loss function corresponding to the image sample.

18. The apparatus according to any one of claims 11-15, characterized in that, The modification unit is also used for: Delete the classification layer that serves as the output layer of the classification model. The attention layer of the classification model is used as the model output layer to obtain a recognition model for identifying image quality based on the attention weights.

19. The apparatus according to any one of claims 11-15, characterized in that, The image sample is a face image sample, and the sample label is used to identify the actual user identifier corresponding to the face in the face image sample.

20. The apparatus according to claim 19, characterized in that, The multiple classification categories are determined based on the actual user identifier.

21. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method described in any one of claims 1-10 according to the instructions in the program code.

22. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method according to any one of claims 1-10.

23. A computer program product comprising instructions that, when run on a computer, cause the computer to perform the method of any one of claims 1-10.