Neural network, training method and prediction method for predicting image clarity
By extracting image features and automatically generating labels, it solves the problems of high manual annotation cost and low efficiency in the existing technology, realizes a semi-automatic image definition training process, and improves prediction accuracy and training efficiency.
Patent Information
- Application Number
- CN202110298042.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-19
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-03-19
AI Technical Summary
In the existing technology, image definition prediction requires a large amount of manual annotation, resulting in high labor costs, low efficiency, and difficulty in ensuring annotation accuracy, which affects the training cost, efficiency, and prediction accuracy of neural networks.
By extracting the sharpness features of the image, automatically generate labels for the images to be expanded, and achieve a semi-automatic training process. Only a small number of images need to be labeled and the expanded image samples need to be corrected to obtain accurate labels, reduce training costs and improve prediction accuracy. sex.
It achieves the acquisition of high-accuracy image samples without a large amount of manual annotation, reduces training costs, and improves training efficiency and prediction accuracy of neural networks.
Smart Images

Figure CN112926496B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and more specifically, to a neural network, training method, prediction method, computer device and medium for predicting image clarity. Background Art
[0002] At present, image clarity prediction is required in many scenarios to determine whether the image meets the clarity requirements and whether it can be used for subsequent applications. For example, when collecting face images through monitoring, face image clarity prediction is required to determine whether the face image can be used for face recognition; when receiving ID photo images remotely, ID photo image clarity prediction is required to determine whether the ID photo image can be used for user authentication; when receiving vehicle accident images remotely, vehicle accident image clarity prediction is required to determine whether the vehicle accident image can be used for damage assessment, etc.
[0003] Among the existing image clarity prediction schemes, a commonly used scheme is to predict the clarity of the input image to be predicted by a trained neural network. This scheme requires the use of a large number of image samples with clarity labels to train the neural network in the early stage. At present, the way to obtain image samples is that the user manually labels all images in the selected image set, that is, obtains the clarity labels of all images by manual labeling, thereby obtaining image samples. In the process of realizing the present invention, the inventors found that the above method has at least the following problems: the number of image samples used to train the neural network may reach thousands or even tens of thousands. If all of them are manually labeled, there will be problems such as high labor costs and low work efficiency. In addition, the labeling process is completely dependent on the subjective judgment of the user, and the accuracy of the labeling is difficult to guarantee, which will affect the training cost and training efficiency of the neural network and the prediction accuracy of the trained neural network. Summary of the invention
[0004] The object of the present invention is to provide a neural network, a training method, a prediction method, a computer device and a medium for predicting image clarity, so as to solve at least one of the problems existing in the prior art.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] A first aspect of the present invention provides a neural network training method for predicting image clarity, comprising:
[0007] Obtaining an image set and clarity labels of some images in the image set, obtaining image samples with clarity labels and images to be expanded other than the image samples;
[0008] Extract clarity features of at least part of the images in the image set, obtain clarity labels of at least part of the images to be expanded according to the extracted clarity features, correct the clarity labels of at least part of the images to be expanded to expand image samples and use the image samples to train a neural network for predicting image clarity to obtain a trained neural network.
[0009] Based on the neural network training method for predicting image clarity provided by the first aspect of the present invention, only a small number of images in the image set can be manually annotated at the beginning, and then the clarity features of the images in the image set are automatically extracted and the clarity labels of the remaining images in the image set are obtained by using the extracted clarity features to expand the image samples and complete the training of the neural network. Therefore, the neural network training method for predicting image clarity provided by the first aspect of the present invention realizes a semi-automatic training process, which can achieve the need for manually annotating a large number of images, only needing to annotate a small number of images and correct the expanded image samples, so as to obtain the required number of image samples with high label accuracy, so that the image samples can be accurately and efficiently obtained and the training can be completed, which can effectively reduce the training cost, improve the training efficiency and improve the prediction accuracy of the trained neural network.
[0010] Optionally, extracting clarity features of at least part of the images in the image set, obtaining clarity labels of at least part of the images to be expanded according to the extracted clarity features, correcting the clarity labels of at least part of the images to be expanded to expand image samples, and training a neural network for predicting image clarity using the image samples to obtain the trained neural network comprises:
[0011] training the neural network based on image samples;
[0012] Extracting definition features of a portion of the image to be expanded using the trained neural network to perform definition prediction on the portion of the image to be expanded, and obtaining a definition label of the portion of the image to be expanded;
[0013] Determine whether the proportion of the number of clarity labels that need to be corrected in the partial image in the image to be expanded is greater than a preset threshold: if greater than, perform correction and expand the image sample according to the corrected partial image in the image to be expanded, and enter the training of the neural network according to the image sample; if less than or equal to, end the training to obtain the trained neural network.
[0014] This optional method uses the neural network obtained through staged training to expand image samples, and then further trains the neural network based on the expanded image samples. This method is repeated in a cycle to ultimately achieve a neural network with prediction accuracy that meets the requirements. This method can effectively reduce training costs, improve training efficiency, and improve the prediction accuracy of the trained neural network.
[0015] Optionally, the number of images for which definition prediction is performed using the trained neural network increases each time.
[0016] This optional method can further improve training efficiency.
[0017] Optionally, the image set includes multiple groups of images, and the images in each group contain the same target; obtaining clarity labels of some images in the image set includes: obtaining clarity labels of images with the highest clarity in each group of images, and obtaining image samples with clarity labels.
[0018] Optionally, extracting clarity features of at least part of the images in the image set, obtaining clarity labels of at least part of the images to be expanded according to the extracted clarity features, correcting the clarity labels of at least part of the images to be expanded to expand image samples, and training a neural network for predicting image clarity using the image samples to obtain the trained neural network comprises:
[0019] Extracting a definition feature of each image in the image set;
[0020] Calculate the similarity between the definition feature of each image sample and the definition features of other images in the group to which the image sample belongs;
[0021] Obtaining definition labels of other images in each group of images to be expanded according to the similarity, and correcting the definition labels of the images to be expanded to expand image samples;
[0022] The expanded image samples are used to train a neural network for predicting image clarity to obtain a trained neural network.
[0023] This optional method, based on the image set including multiple groups of images, in which the images in each group contain the same target, expands the image samples by calculating the similarity between the image samples containing the same target and the clarity features of the unlabeled images, which can effectively reduce the training cost, improve the training efficiency and improve the prediction accuracy of the trained neural network.
[0024] Optionally, before extracting the definition feature of each image in the image set, the method further includes:
[0025] Detect target feature points of each image in the image set, and perform target alignment on each image in each group of images according to the target feature points.
[0026] This optional method can improve the accuracy and effectiveness of clarity feature extraction and similarity calculation.
[0027] Optionally, extracting clarity features of at least part of the images in the image set, obtaining clarity labels of at least part of the images to be expanded according to the extracted clarity features, correcting the clarity labels of at least part of the images to be expanded to expand image samples, and training a neural network for predicting image clarity using the image samples to obtain the trained neural network comprises:
[0028] Extracting a definition feature of each image in the image set;
[0029] Calculate the similarity between the definition feature of each image sample and the definition features of other images in the group to which the image sample belongs;
[0030] Obtaining definition labels of other images in each group of images to be expanded according to the similarity, and correcting the definition labels of some images in the obtained images to be expanded to expand the image samples;
[0031] training the neural network based on image samples;
[0032] Extracting definition features of a portion of the image to be expanded using the trained neural network to perform definition prediction on the portion of the image to be expanded, and obtaining a definition label of the portion of the image to be expanded;
[0033] According to whether the clarity labels of the partial images in the image to be expanded obtained based on clarity prediction are consistent with the clarity labels of the partial images in the image to be expanded obtained based on similarity calculation, it is judged whether the proportion of the number of clarity labels of the partial images in the image to be expanded that needs to be corrected is greater than a preset threshold: if greater than, correction is performed and image samples are expanded according to the corrected partial images in the image to be expanded, and the training of the neural network according to the image samples is entered; if less than or equal to, the training is terminated to obtain the trained neural network.
[0034] This optional method, based on the image set including multiple groups of images, in which the images in each group contain the same target, expands the image samples by calculating the similarity between the image samples containing the same target and the clarity features of the unlabeled images, and combines the image samples with the neural network obtained by staged training to expand the image samples, and then further trains the neural network based on the expanded image samples, and repeats the process to finally achieve a training scheme for the neural network with prediction accuracy that meets the requirements, which can effectively reduce training costs, improve training efficiency, and improve the prediction accuracy of the trained neural network.
[0035] Optionally, the correcting the clarity labels of at least part of the images to be expanded includes:
[0036] Displaying a correction interface, the correction interface including a correction control and at least a portion of the image to be expanded and a corresponding definition label;
[0037] In response to the operation on the correction control, the clarity label of the corresponding image in the correction interface is corrected.
[0038] Based on the correction operation interaction method provided by this optional method, the user can conveniently view the image of the expanded part and the corresponding clarity label, and can conveniently and efficiently implement the correction of the clarity label.
[0039] Optionally, the image set is a face image set.
[0040] A second aspect of the present invention provides a neural network for predicting image clarity, which is trained using the training method described in the first aspect of the present invention.
[0041] Optionally, the neural network is a lightweight neural network.
[0042] The lightweight neural network used in this optional method has the advantages of small number of parameters and small amount of computation, which is conducive to efficient training and improving prediction efficiency. It is suitable for image clarity prediction scenarios that usually have high real-time requirements.
[0043] Optionally, the lightweight neural network includes a convolution module, a first depth-separable convolution module, a second depth-separable convolution module and a third depth-separable convolution module connected in sequence, and also includes: a first adaptive average pooling layer connected to the first depth-separable convolution module, a second adaptive average pooling layer connected to the second depth-separable convolution module, a third adaptive average pooling layer connected to the third depth-separable convolution module, a splicing module respectively connected to the first adaptive average pooling layer, the second adaptive average pooling layer and the third adaptive average pooling layer, and a classifier connected to the splicing module.
[0044] The specific network structure of the lightweight neural network adopted in this optional method can increase the expressive power of the model by fusing features of three different scales, thereby improving the accuracy of image clarity prediction, and is conducive to achieving efficient training and improving prediction efficiency.
[0045] A third aspect of the present invention provides an image definition prediction method, comprising:
[0046] The image to be predicted is input into the neural network as described in the second aspect of the present invention to obtain a predicted value of image clarity.
[0047] The image clarity prediction method provided in the third aspect of the present invention can obtain the image clarity prediction value accurately and efficiently.
[0048] The fourth aspect of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements: the training method as described in the first aspect of the present invention, or the prediction method as described in the third aspect of the present invention.
[0049] The fifth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements: the training method as described in the first aspect of the present invention, or the prediction method as described in the third aspect of the present invention.
[0050] The beneficial effects of the present invention are as follows:
[0051] The technical solution described in the present invention realizes a semi-automatic training process, which can achieve the goal of not manually labeling a large number of images, but only labeling a small number of images and correcting the expanded image samples, so as to obtain the required number of image samples with high label accuracy, thereby accurately and efficiently acquiring image samples and completing training, which can effectively reduce training costs, improve training efficiency and improve the prediction accuracy of the trained neural network. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The specific implementation modes of the present invention are further described in detail below in conjunction with the accompanying drawings.
[0053] Figure 1 A diagram showing an exemplary system architecture in which one embodiment of the present invention may be applied.
[0054] Figure 2 A flow chart of a neural network training method for predicting the clarity of a facial image provided by an embodiment of the present invention is shown.
[0055] Figure 3 A flowchart of sub-steps of step S120 in one embodiment of the present invention is shown.
[0056] Figure 4 A flowchart of sub-steps of step S120 in another embodiment of the present invention is shown.
[0057] Figure 5 A flowchart of sub-steps of step S120 in another embodiment of the present invention is shown.
[0058] Figure 6 A schematic diagram showing the network structure of a lightweight neural network.
[0059] Figure 7 A schematic diagram showing the structure of the bottleneck layer.
[0060] Figure 8 An example diagram showing a scenario in which the method for predicting the clarity of a facial image provided by an embodiment of the present invention is applied to face recognition.
[0061] Fig. 9 A schematic diagram showing the structure of a computer system. DETAILED DESCRIPTION
[0062] In order to explain the present invention more clearly, the present invention is further described below in conjunction with embodiments and drawings. Similar components in the drawings are represented by the same reference numerals. It should be understood by those skilled in the art that the content specifically described below is illustrative rather than restrictive, and the protection scope of the present invention should not be limited thereto.
[0063] At present, image clarity prediction is required in many scenarios to determine whether the image meets the clarity requirements and whether it can be used for subsequent applications. For example, when collecting face images through monitoring, face image clarity prediction is required to determine whether the face image can be used for face recognition; when receiving ID photo images remotely, ID photo image clarity prediction is required to determine whether the ID photo image can be used for user authentication; when receiving vehicle accident images remotely, vehicle accident image clarity prediction is required to determine whether the vehicle accident image can be used for damage assessment, etc.
[0064] Among the existing image clarity prediction schemes, a commonly used scheme is to predict the clarity of the input image to be predicted by a trained neural network. This scheme requires the use of a large number of image samples with clarity labels to train the neural network in the early stage. At present, the way to obtain image samples is that the user manually labels all images in the selected image set, that is, obtains the clarity labels of all images by manual labeling, thereby obtaining image samples. In the process of realizing the present invention, the inventors found that the above method has at least the following problems: the number of image samples used to train the neural network may reach thousands or even tens of thousands. If all of them are manually labeled, there will be problems such as high labor costs and low work efficiency. In addition, the labeling process is completely dependent on the subjective judgment of the user, and the accuracy of the labeling is difficult to guarantee, which will affect the training cost and training efficiency of the neural network and the prediction accuracy of the trained neural network.
[0065] In view of this, an embodiment of the present invention provides a neural network training method for predicting image clarity, the method comprising:
[0066] Obtaining an image set and clarity labels of some images in the image set, obtaining image samples with clarity labels and images to be expanded other than the image samples;
[0067] Extract clarity features of at least part of the images in the image set, obtain clarity labels of at least part of the images to be expanded according to the extracted clarity features, correct the clarity labels of at least part of the images to be expanded to expand image samples and use the image samples to train a neural network for predicting image clarity to obtain a trained neural network.
[0068] Based on the neural network training method for predicting image clarity provided by the present embodiment, only a small number of images in the image set can be manually annotated at the beginning, and then the clarity features of the images in the image set are automatically extracted and the clarity labels of the remaining images in the image set are obtained by using the extracted clarity features to expand the image samples and complete the training of the neural network. Therefore, the neural network training method for predicting image clarity provided by the present embodiment realizes a semi-automatic training process, which can achieve the need for manually annotating a large number of images, and only requires annotating a small number of images and correcting the expanded image samples to obtain the required number of image samples with high label accuracy, so that image samples can be accurately and efficiently obtained and training can be completed, which can effectively reduce training costs, improve training efficiency, and improve the prediction accuracy of the trained neural network.
[0069] The clarity prediction provided by this embodiment can be used for different types of images in multiple scenarios. For example, when collecting facial images through monitoring, it is necessary to perform facial image clarity prediction to determine whether the facial images can be used for facial recognition; when remotely receiving ID photo images, it is necessary to perform ID photo image clarity prediction to determine whether the ID photo images can be used for user authentication; when remotely receiving vehicle accident images, it is necessary to perform vehicle accident image clarity prediction to determine whether the vehicle accident images can be used for damage assessment, etc., and no specific limitations are made here.
[0070] The neural network training method for predicting image clarity provided in this embodiment can be implemented by a computer device with data processing capabilities. Specifically, the computer device can be a computer with data processing capabilities, including a personal computer (PC), a minicomputer or a mainframe, or a server or server cluster with data processing capabilities, etc. This embodiment does not limit this.
[0071] In order to facilitate understanding of the technical solution of this embodiment, Figure 1 The practical scenario of the above method provided in this embodiment is described. Figure 1 , the scenario includes a training server 10 and a prediction server 20. In this embodiment, the training server 10 first uses image samples to train a neural network for predicting image clarity to obtain a trained neural network. Subsequently, the prediction server 20 can use the neural network trained by the training server 10 to predict image clarity. The image to be predicted is input into the prediction server 20 to obtain an image clarity prediction result.
[0072] It should be noted that Figure 1 In actual applications, the training server 10 and the prediction server 20 may be two independent servers or a server that integrates the model training function and the image definition prediction function. When the two servers are two independent servers, the two servers may communicate with each other through a network, and the network may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0073] Next, from the perspective of a processing device with data processing capabilities, taking the prediction of facial image clarity as an example, a neural network training method for predicting image clarity provided in this embodiment is described. The neural network training method for predicting image clarity provided in this embodiment is a neural network training method for predicting facial image clarity.
[0074] An embodiment of the present invention provides a neural network training method for predicting the clarity of a face image. Figure 2 As shown, the following steps are included:
[0075] S110, obtaining a face image set and definition labels of some face images in the face image set, obtaining image samples with definition labels and images to be expanded other than the image samples.
[0076] In a specific example, the clarity label can be a clarity level. For example, there are five clarity levels defined from 1 to 5, where: Level 5 means clear, the standard is that the outline and facial features of the face are clear, and the effect is good when applied to face recognition; Level 4 means relatively clear, the standard is that the outline and facial features of the face are relatively clear, and the effect is good when applied to face recognition; Level 3 means medium, the standard is that the outline of the face is relatively clear, and the facial features are not clear, and it can only be barely applied to face recognition; Level 2 means relatively blurry, the standard is that the outline of the face is not clear, and the facial features are basically not clear, and it is basically not applicable to face recognition; Level 1 means blurry, the standard is that the outline and facial features of the face are not clear, and it is definitely not applicable to face recognition.
[0077] In a specific example, for example, the neural network to be trained is a lightweight neural network, and the number of image samples used for training is about 2,000. If the existing solution of obtaining the clarity labels of all face images by manual labeling is used, the clarity labels of about 2,000 face images need to be manually labeled. In step S110 of this embodiment, for a face image set including 2,000 face images of different clarity, it is only necessary to manually label the clarity labels of, for example, 200 face images randomly selected, that is, 200 image samples with clarity labels are obtained, and the remaining 1,800 unlabeled face images are used as images to be expanded.
[0078] Continuing with the above example, a computer device implementing the training method provided by the present embodiment may provide a labeling interface, the labeling interface displays randomly selected face images and labeling controls (e.g., the labeling controls are five selection controls representing levels 1-5 displayed below the face images), and obtains the clarity label of the face image in response to the labeling personnel's operation of the labeling controls. Among them, the face image displayed on the labeling interface cannot be too small, otherwise the labeling personnel cannot see it clearly. Exemplarily, one labeling interface displays three face images and a page turning control, and displays subsequent randomly selected face images in response to the labeling personnel's operation of the page turning control. Exemplarily, in order to ensure the accuracy of the clarity label of the face image obtained in step S110, a multi-person labeling method may be adopted, for example, five labeling personnel respectively label the 200 selected face images, and for each of the 200 selected face images, after removing the highest and lowest clarity levels of the labels, the average level of the three remaining clarity levels is used as the clarity label.
[0079] S120, extracting clarity features of at least part of the facial images in the facial image set, obtaining clarity labels of at least part of the facial images in the to-be-expanded images based on the extracted clarity features, correcting the clarity labels of at least part of the facial images in the to-be-expanded images to expand image samples and using the image samples to train a neural network for predicting the clarity of facial images to obtain a trained neural network.
[0080] In a possible implementation, the correcting of the definition label of at least part of the face image in the image to be expanded in step S120 includes:
[0081] Displaying a correction interface, the correction interface including a correction control and at least a portion of the face image in the image to be expanded and a corresponding clarity label;
[0082] In response to the operation on the correction control, the clarity label of the corresponding face image in the correction interface is corrected.
[0083] Based on the correction operation interaction method provided by this implementation, the user can conveniently view the expanded facial image and the corresponding clarity label, and can conveniently and efficiently implement the correction of the clarity label.
[0084] Continuing with the above example, a computer device implementing the training method provided by this embodiment may provide a correction interface, which displays at least part of the face image in the image to be expanded and its clarity label obtained according to the extracted clarity features (i.e., the face image with the clarity label to be corrected and its clarity label to be corrected), and also displays a correction control (such as the correction control, which is five selection controls representing levels 1-5 displayed below the face image). In response to the operation of the correction control by the annotator, the corrected clarity label of the corresponding face image is obtained. Among them, the face image displayed on the correction interface cannot be too small, otherwise the annotator cannot see it clearly. For example, a correction interface displays three face images and a page turning control. In response to the operation of the page turning control by the annotator, the subsequent face image with the clarity label to be corrected is displayed.
[0085] In one possible implementation, Figure 3 As shown, step S120 includes the following sub-steps:
[0086] S1201. Train the neural network according to image samples.
[0087] Continuing with the above example, for example, the neural network to be trained is a lightweight neural network, the number of image samples used for training is about 2,000, the face image set includes 2,000 face images, and the clarity labels of 200 face images in the face image set are obtained in step S110 to obtain 200 image samples, and the remaining 1,800 unlabeled face images are used as images to be expanded. Then, when step S1201 is executed for the first time, that is, when the lightweight neural network is trained for the first time, the training is performed according to the 200 image samples with clarity labels obtained in step S110.
[0088] S1202, using the trained neural network to extract clarity features of the partial face images in the image to be expanded to perform clarity prediction on the partial face images in the image to be expanded, and obtain clarity labels for the partial face images in the image to be expanded.
[0089] Continuing with the above example, when step S1202 is executed for the first time, 200 face images are randomly selected from the 1800 unlabeled face images in the face image set as images to be expanded, and the lightweight neural network obtained by the first training is input to perform clarity prediction on the 200 images to be expanded using the lightweight neural network obtained by the first training, so as to obtain clarity labels (i.e., clarity label prediction values) of the 200 images to be expanded, that is, the lightweight neural network obtained by the first training is used to perform clarity prediction on some face images (200) in the images to be expanded (1800) to obtain clarity labels for the 200 images to be expanded.
[0090] S1203, determine whether the percentage of the number of clarity labels of the partial face images in the image to be expanded that needs to be corrected is greater than a preset threshold: if it is greater, perform correction and expand the image samples according to the corrected partial face images in the image to be expanded, and go to step S1201; if it is less than or equal to, end the training and obtain the trained neural network. Training ends
[0091] Continuing with the above example, when step S1203 is executed for the first time, it is determined whether the proportion of the number of clarity labels that need to be corrected in the 200 images to be expanded obtained by the first execution of step S1202 is greater than a preset threshold value, for example, set to 10%: if it is greater, the clarity labels that need to be corrected are corrected, and the image samples are expanded according to the 200 images to be expanded after the clarity labels are corrected, that is, the 200 face images with clarity labels are used together with the 200 image samples obtained in step S110 as image samples, and the image samples are expanded to 400. After the expansion, the process proceeds to step S1201 (after the first transition to step S1201, that is, the second execution of step S1201 and the second training of the lightweight neural network, the neural network is trained according to the 400 image samples; each subsequent training after entering step S1201 will increase the image samples compared to the previous training); if it is less than or equal to, the training is terminated to obtain the trained lightweight neural network.
[0092] The process of the above example is as follows:
[0093] For a face image set containing 2000 face images of different resolutions, 200 face images are randomly selected for manual annotation to obtain 200 image samples;
[0094] The lightweight neural network was trained for the first time using 200 image samples;
[0095] Randomly select 200 face images from the 1,800 unlabeled images in the face image set, input the lightweight neural network obtained in the first training to perform prediction to obtain the clarity labels of these 200 face images;
[0096] Determine whether the percentage of clarity labels of these 200 face images that require manual correction (i.e., the percentage of clarity labels with incorrect predictions, or the percentage of noise) exceeds 10%:
[0097] If it does not exceed, it means that the prediction accuracy of the neural network obtained by the first training has met the requirements (it should be noted that the prediction accuracy of the lightweight neural network trained for the first time is usually not too high, and the probability that the prediction error ratio does not exceed 10% is relatively small), then the training process ends;
[0098] If it exceeds, it means that the prediction accuracy of the lightweight neural network obtained by the first training does not meet the requirements, then the definition labels that need to be manually corrected are corrected, and these 200 face images (that is, face images with definition labels that do not need to be corrected or are predicted to be correct, and face images with corrected definition labels) are also used as image samples, so as to perform the first expansion on the 200 image samples obtained in step S110, and obtain a total of 400 image samples;
[0099] The lightweight neural network is trained for the second time using the 400 image samples after the first expansion;
[0100] 300 face images are randomly selected from the 1,600 unlabeled images in the face image set, and input into the lightweight neural network obtained by the second training to perform prediction to obtain the clarity labels of these 300 face images;
[0101] Determine whether the percentage of clarity labels of these 300 face images that require manual correction (i.e., the percentage of clarity labels with incorrect predictions) exceeds 10%:
[0102] If it does not exceed, it means that the prediction accuracy of the neural network obtained by the second training has met the requirements, and the training process ends;
[0103] If it exceeds, it means that the prediction accuracy of the lightweight neural network obtained by the second training has not met the requirements, so the clarity labels that need to be manually corrected are corrected, and these 300 face images are also used as image samples, so as to perform a second expansion on the 400 image samples obtained by the first expansion, and a total of 700 image samples are obtained;
[0104] The lightweight neural network is trained for the third time using the 700 image samples after the second expansion. Then, unlabeled face images are randomly selected for prediction to determine the proportion of prediction results that need to be corrected, until a lightweight neural network with prediction accuracy that meets the requirements is obtained.
[0105] In summary, this implementation method uses the neural network obtained by staged training to expand the image samples, and then further trains the neural network based on the expanded image samples, and repeats the cycle to finally achieve a neural network with prediction accuracy that meets the requirements. This implementation method uses a training scheme that combines progressive training with expanded image samples, which can effectively reduce training costs, improve training efficiency, and improve the prediction accuracy of the trained neural network.
[0106] It should be noted that although the manual correction method will also generate training costs and affect training efficiency, compared with the method of manually annotating the clarity labels of all image samples, firstly, the number of corrections required is less, and secondly, correction is obviously simpler and more efficient than annotation, because even if the predicted clarity labels are wrong, they still have a reference role. Among them, as the number of training rounds increases, the number of corrections required will decrease, and the incorrectly predicted clarity labels will get closer and closer to the correct value, that is, the reference value of the incorrectly predicted clarity labels will increase.
[0107] In a possible implementation, the number of images for which the trained neural network is used for definition prediction increases each time, which can further improve the training efficiency.
[0108] Continuing with the previous example, for example, after the first training, 200 face images are randomly selected from the face image set and input into the lightweight neural network obtained by the first training for prediction. After the second training, 300 face images are randomly selected from the face image set and input into the lightweight neural network obtained by the second training for prediction. After the third training, 400 face images are randomly selected from the face image set and input into the lightweight neural network obtained by the third training for prediction, and so on.
[0109] Another embodiment of the present invention provides a neural network training method for predicting the clarity of a face image. Figure 2 As shown, the following steps are included:
[0110] S110, obtaining a face image set and definition labels of some face images in the face image set, obtaining image samples with definition labels and images to be expanded other than the image samples.
[0111] In a specific example, the clarity label can be a clarity level. For example, there are five clarity levels defined from 1 to 5, where: Level 5 means clear, the standard is that the outline and facial features of the face are clear, and the effect is good when applied to face recognition; Level 4 means relatively clear, the standard is that the outline and facial features of the face are relatively clear, and the effect is good when applied to face recognition; Level 3 means medium, the standard is that the outline of the face is relatively clear, and the facial features are not clear, and it can only be barely applied to face recognition; Level 2 means relatively blurry, the standard is that the outline of the face is not clear, and the facial features are basically not clear, and it is basically not applicable to face recognition; Level 1 means blurry, the standard is that the outline and facial features of the face are not clear, and it is definitely not applicable to face recognition.
[0112] In one possible implementation, the face image set includes multiple groups of face images, and the face images in each group contain the same target (that is, the faces in each group of face images belong to the same person); obtaining the clarity labels of some face images in the face image set includes: obtaining the clarity label of the face image with the highest clarity in each group of face images, and obtaining image samples with clarity labels.
[0113] In a specific example, for example, the neural network to be trained is a lightweight neural network, and the image samples used for training are about 2,000. Then, if the existing solution of obtaining the clarity labels of all face images by manual labeling is used, the clarity labels of about 2,000 face images need to be manually labeled. In step S110 of this embodiment, the face image set includes 40 groups of face images, each group of face images is a face image of one person, and each group of face images includes 50 face images of different clarity, constituting a face image set of 2,000 face images of different clarity. For this face image set, it is only necessary to manually select one face image with the highest or clearest clarity from each group, and label the clarity labels of the selected 40 face images as level 5, that is, 40 image samples with clarity labels are obtained, and the remaining 1,960 unlabeled face images (a total of 40 groups, 49 unlabeled face images in each group) are used as images to be expanded.
[0114] S120, extracting clarity features of at least part of the images in the image set, obtaining clarity labels of at least part of the images to be expanded according to the extracted clarity features, correcting the clarity labels of at least part of the images to be expanded to expand image samples and using the image samples to train a neural network for predicting image clarity, to obtain a trained neural network.
[0115] In a possible implementation, the correcting of the definition label of at least part of the face image in the image to be expanded in step S120 includes:
[0116] Displaying a correction interface, the correction interface including a correction control and at least a portion of the face image in the image to be expanded and a corresponding clarity label;
[0117] In response to the operation on the correction control, the clarity label of the corresponding face image in the correction interface is corrected.
[0118] Based on the correction operation interaction method provided by this implementation, the user can conveniently view the expanded facial image and the corresponding clarity label, and can conveniently and efficiently implement the correction of the clarity label.
[0119] Continuing with the above example, a computer device implementing the training method provided by this embodiment may provide a correction interface, which displays at least part of the face image in the image to be expanded and its clarity label obtained according to the extracted clarity features (i.e., the face image with the clarity label to be corrected and its clarity label to be corrected), and also displays a correction control (such as the correction control, which is five selection controls representing levels 1-5 displayed below the face image). In response to the operation of the correction control by the annotator, the corrected clarity label of the corresponding face image is obtained. Among them, the face image displayed on the correction interface cannot be too small, otherwise the annotator cannot see it clearly. For example, a correction interface displays three face images and a page turning control. In response to the operation of the page turning control by the annotator, the subsequent face image with the clarity label to be corrected is displayed.
[0120] In one possible implementation, Figure 4 As shown, step S120 includes the following sub-steps:
[0121] S1204: Detect facial feature points of each facial image in the facial image set, and perform target alignment on each facial image in each group of facial images according to the facial feature points.
[0122] Continuing with the above example, in step S1204, an existing facial feature point detector such as PFLD (A Practical Facial Landmark Detector) can be used to detect facial feature points of each of the 2000 facial images included in the facial image set. Facial feature points include, for example, the center of the left eye, the center of the right eye, the tip of the nose, the left corner of the mouth, and the right corner of the mouth. Then, based on the detected facial feature points, the 50 facial images included in each group are aligned by, for example, similarity transformation or radial transformation, so as to improve the accuracy and effectiveness of subsequent clarity feature extraction and similarity calculation. It should be noted that the above facial alignment is only for each facial image in each group, and it is not necessary to require facial alignment between groups.
[0123] S1205: Extract the clarity feature of each face image in the face image set.
[0124] Continuing with the above example, in step S1205, an existing facial feature extraction model such as a trained FaceNet network may be used to extract clarity features, such as a 512-dimensional feature vector, of each of the 2000 facial images included in the facial image set.
[0125] S1206: Calculate the similarity between the definition feature of each image sample and the definition features of other face images in the group to which the image sample belongs.
[0126] Continuing with the above example, in step S1206, a similarity algorithm based on Euclidean distance or cosine distance may be used to calculate the similarity between the clarity feature of each image sample and the clarity features of other face images in the group to which the image sample belongs. For example, for the first group of face images, the Euclidean distance between the clarity features of the image sample in the first group (which may be referred to as the reference image in the similarity calculation) and the clarity features of the remaining 49 unlabeled face images in the first group is calculated to obtain the similarity scores for the remaining 49 unlabeled face images in the first group. The same is true for the remaining 39 groups of face images.
[0127] S1207 , obtaining definition labels of other images in each group of images to be expanded according to the similarity, and correcting the definition labels of the images to be expanded to expand image samples.
[0128] Continuing with the above example, in step S1207, for example, the similarity scores of the 1960 unlabeled face images other than the 40 image samples obtained in step S1206 are values between 0 and 1, and 0 to 1 can be divided into 5 value intervals corresponding to 5 levels, thereby obtaining the clarity levels of the 1960 unlabeled face images, i.e., clarity labels. Then, the clarity labels of the 1960 unlabeled face images obtained by similarity calculation are corrected, thereby expanding the image samples to 2000, i.e., according to the extracted clarity features, the clarity labels of all images (1960) in the images to be expanded (1960) are obtained by similarity calculation, and the clarity labels of all images (1960) in the images to be expanded are corrected to expand the image samples.
[0129] S1208. Use the expanded image samples to train a neural network for predicting the clarity of facial images to obtain a trained neural network.
[0130] This implementation method, based on the face image set including multiple groups of face images, in which the face images in each group contain the same target, expands the image samples by calculating the similarity between the image samples containing the faces of the same person and the clarity features of unlabeled face images, which can effectively reduce the training cost, improve the training efficiency and improve the prediction accuracy of the trained neural network.
[0131] It should be noted that although the manual correction method will also incur training costs and affect training efficiency, compared with the method of manually annotating clarity labels for all image samples, firstly, the clarity labels obtained by similarity calculation are more accurate and require fewer corrections. Secondly, correction is obviously simpler and more efficient than annotation, because even if the predicted clarity labels are incorrect, they can still serve as a reference.
[0132] like Figure 2 As shown, another embodiment of the present invention provides a neural network training method for predicting the clarity of a face image, comprising:
[0133] S110, acquiring an image set and definition labels of some images in the image set, obtaining image samples with definition labels and images to be expanded other than the image samples.
[0134] In a specific example, the clarity label can be a clarity level. For example, there are five clarity levels defined from 1 to 5, where: Level 5 means clear, the standard is that the outline and facial features of the face are clear, and the effect is good when applied to face recognition; Level 4 means relatively clear, the standard is that the outline and facial features of the face are relatively clear, and the effect is good when applied to face recognition; Level 3 means medium, the standard is that the outline of the face is relatively clear, and the facial features are not clear, and it can only be barely applied to face recognition; Level 2 means relatively blurry, the standard is that the outline of the face is not clear, and the facial features are basically not clear, and it is basically not applicable to face recognition; Level 1 means blurry, the standard is that the outline and facial features of the face are not clear, and it is definitely not applicable to face recognition.
[0135] In one possible implementation, the face image set includes multiple groups of face images, and the face images in each group contain the same target (that is, the faces in each group of face images belong to the same person); obtaining the clarity labels of some face images in the face image set includes: obtaining the clarity label of the face image with the highest clarity in each group of face images, and obtaining image samples with clarity labels.
[0136] In a specific example, for example, the neural network to be trained is a lightweight neural network, and the image samples used for training are about 2,000. Then, if the existing solution of obtaining the clarity labels of all face images by manual labeling is used, the clarity labels of about 2,000 face images need to be manually labeled. In step S110 of this embodiment, the face image set includes 40 groups of face images, each group of face images is a face image of one person, and each group of face images includes 50 face images of different clarity, constituting a face image set of 2,000 face images of different clarity. For this face image set, it is only necessary to manually select one face image with the highest or clearest clarity from each group, and label the clarity labels of the selected 40 face images as level 5, that is, 40 image samples with clarity labels are obtained, and the remaining 1,960 unlabeled face images (a total of 40 groups, 49 unlabeled face images in each group) are used as images to be expanded.
[0137] S120, extracting clarity features of at least part of the images in the image set, obtaining clarity labels of at least part of the images to be expanded according to the extracted clarity features, correcting the clarity labels of at least part of the images to be expanded to expand image samples and using the image samples to train a neural network for predicting image clarity, to obtain a trained neural network.
[0138] In a possible implementation, the correcting of the definition label of at least part of the face image in the image to be expanded in step S120 includes:
[0139] Displaying a correction interface, the correction interface including a correction control and at least a portion of the face image in the image to be expanded and a corresponding clarity label;
[0140] In response to the operation on the correction control, the clarity label of the corresponding face image in the correction interface is corrected.
[0141] Based on the correction operation interaction method provided by this implementation, the user can conveniently view the expanded facial image and the corresponding clarity label, and can conveniently and efficiently implement the correction of the clarity label.
[0142] Continuing with the above example, a computer device implementing the training method provided by this embodiment may provide a correction interface, which displays at least part of the face image in the image to be expanded and its clarity label obtained according to the extracted clarity features (i.e., the face image with the clarity label to be corrected and its clarity label to be corrected), and also displays a correction control (such as the correction control, which is five selection controls representing levels 1-5 displayed below the face image). In response to the operation of the correction control by the annotator, the corrected clarity label of the corresponding face image is obtained. Among them, the face image displayed on the correction interface cannot be too small, otherwise the annotator cannot see it clearly. For example, a correction interface displays three face images and a page turning control. In response to the operation of the page turning control by the annotator, the subsequent face image with the clarity label to be corrected is displayed.
[0143] In one possible implementation, Figure 4 As shown, step S120 includes the following sub-steps:
[0144] S1209: Detect facial feature points of each facial image in the facial image set, and perform target alignment on each facial image in each group of facial images according to the facial feature points.
[0145] Continuing with the above example, in step S1209, an existing facial landmark detector such as PFLD (A Practical Facial Landmark Detector) can be used to detect facial landmarks of each of the 2000 facial images included in the facial image set. Facial landmarks include, for example, the center of the left eye, the center of the right eye, the tip of the nose, the left corner of the mouth, and the right corner of the mouth. Then, based on the detected facial landmarks, the 50 facial images included in each group are aligned by, for example, similarity transformation or radial transformation, so as to improve the accuracy and effectiveness of subsequent clarity feature extraction and similarity calculation. It should be noted that the above facial alignment is only for each facial image in each group, and it is not necessary to require facial alignment between groups.
[0146] S1210: Extract clarity features of each image in the image set.
[0147] Continuing with the above example, in step S1210, an existing facial feature extraction model such as a trained FaceNet network may be used to extract clarity features, such as a 512-dimensional feature vector, of each of the 2000 facial images included in the facial image set.
[0148] S1211. Calculate the similarity between the definition feature of each image sample and the definition features of other images in the group to which the image sample belongs.
[0149] Continuing with the above example, in step S1211, a similarity algorithm based on Euclidean distance or cosine distance may be used to calculate the similarity between the clarity feature of each image sample and the clarity features of other face images in the group to which the image sample belongs. For example, for the first group of face images, the Euclidean distance between the clarity feature of the image sample in the first group (which may be referred to as the reference image in the similarity calculation) and the clarity features of the remaining 49 unlabeled face images in the first group is calculated to obtain the similarity scores for the remaining 49 unlabeled face images in the first group. The same is true for the remaining 39 groups of face images.
[0150] S1212: Obtain definition labels of other images in each group of images to be expanded according to the similarity, and correct the obtained definition labels of some images in the images to be expanded to expand the image samples.
[0151] Continuing with the above example, in step S1212, for example, the similarity scores of the 1960 unlabeled face images other than the 40 image samples obtained in step S1211 are values between 0 and 1, and 0 to 1 can be divided into 5 value intervals corresponding to 5 levels, thereby obtaining the clarity levels of the 1960 unlabeled face images, that is, the clarity labels. Then, 160 face images are randomly selected from the 1960 unlabeled face images, and the clarity labels of the 160 unlabeled face images obtained by similarity calculation are corrected, so that the image samples are expanded from 40 obtained in step S110 to 200, that is, according to the extracted clarity features, the clarity labels of all face images (1960) in the images to be expanded (1960) are obtained by similarity calculation, and the clarity labels of some of the images (160) are corrected to expand the image samples.
[0152] S1213: Train the neural network according to the image samples.
[0153] Continuing with the above example, step S1212 expands the image samples to 200, and step S1213 is executed for the first time, that is, when the lightweight neural network is trained for the first time, the image samples with clarity labels expanded to 200 in step S1212 are trained.
[0154] S1214. Using the trained neural network, extract clarity features of a portion of the image to be expanded to perform clarity prediction on the portion of the image to be expanded, and obtain clarity labels of the portion of the image to be expanded.
[0155] Continuing with the above example, when step S1214 is executed for the first time, 200 face images are randomly selected from the 1800 face images other than the initial 40 face images used as image samples and the 160 face images that have undergone clarity label correction in step S1212 as images to be expanded, and the lightweight neural network obtained by the first training is input to perform clarity prediction on the 200 images to be expanded using the lightweight neural network obtained by the first training to obtain clarity labels (i.e., clarity label prediction values) of the 200 images to be expanded.
[0156] S1215. According to whether the clarity labels of the partial images in the image to be expanded obtained based on the clarity prediction are consistent with the clarity labels of the partial images in the image to be expanded obtained based on the similarity calculation, determine whether the proportion of the clarity labels of the partial images in the image to be expanded that need to be corrected is greater than a preset threshold: if greater than, perform correction and expand the image samples according to the corrected partial images in the image to be expanded, and proceed to the step of training the neural network according to the image samples; if less than or equal to, end the training to obtain the trained neural network.
[0157] Continuing with the above example, when step S1215 is executed for the first time, the clarity labels of the 200 images to be expanded obtained by executing step S1214 for the first time are compared with the clarity labels of the 200 images to be expanded obtained based on the similarity calculation when executing step S1212. If for an image to be expanded, the clarity labels obtained by the two methods are different, it is determined that the clarity label of the image to be expanded needs to be corrected. If they are the same, it is determined that no correction is required. In this way, the proportion of the clarity labels of the 200 images to be expanded that need to be corrected can be obtained, and it is determined whether it is greater than a preset threshold value, for example, set to 10%. If it is greater, the clarity label that needs to be corrected is corrected, and based on the The image samples are expanded according to the 200 images to be expanded after the clarity labels are corrected, that is, the 200 face images with clarity labels are used together with the 200 image samples expanded in step S1212 as image samples, and the image samples are expanded to 400. After the expansion, step S1213 is entered (after entering step S1213 for the first time, that is, when step S1213 is executed for the second time and the lightweight neural network is trained for the second time, the neural network is trained according to the 400 image samples; each subsequent time the training is performed after entering step S1213, the image samples will increase compared to the previous training); if it is less than or equal to, the training is terminated to obtain the trained lightweight neural network.
[0158] This implementation method, based on the face image set including multiple groups of face images, in which the face images in each group contain the same target, expands the image samples by calculating the similarity between the image samples containing the faces of the same person and the clarity features of the unlabeled face images, and expands the image samples in combination with the neural network obtained by staged training, and then further trains the neural network based on the expanded image samples, and repeats the execution in a cycle to finally achieve a training scheme for the neural network with prediction accuracy that meets the requirements, which can effectively reduce training costs, improve training efficiency and improve the prediction accuracy of the trained neural network.
[0159] Those skilled in the art should understand that, in the above embodiments, although the execution order of the steps in the process is described according to step numbers such as S110, S120, S1201, S1202, it does not mean that they must be executed in such an order as long as it does not violate logic.
[0160] Another embodiment of the present invention provides a neural network for predicting the clarity of a facial image. The neural network can be trained using the training method provided in the above embodiment.
[0161] In a possible implementation, the neural network is a lightweight neural network.
[0162] The lightweight neural network used in this implementation has the advantages of small number of parameters and small amount of computation, which is conducive to efficient training and improving prediction efficiency. It is suitable for facial image clarity prediction scenarios with high real-time requirements.
[0163] In one possible implementation, Figure 6 As shown, the lightweight neural network includes a convolution module, a first depth-separable convolution module, a second depth-separable convolution module and a third depth-separable convolution module connected in sequence, and the lightweight neural network also includes: a first adaptive average pooling layer connected to the first depth-separable convolution module, a second adaptive average pooling layer connected to the second depth-separable convolution module, a third adaptive average pooling layer connected to the third depth-separable convolution module, a splicing module connected to the first adaptive average pooling layer, the second adaptive average pooling layer, and the third adaptive average pooling layer respectively, and a classifier connected to the splicing module.
[0164] The specific network structure of the lightweight neural network adopted in this implementation method can increase the expressive power of the model by fusing features of three different scales, thereby improving the accuracy of image clarity prediction, and is conducive to efficient training and improving prediction efficiency.
[0165] In a specific example, Figure 6 The specific structure of the lightweight neural network shown is shown in Table 1.
[0166] Table 1
[0167]
[0168]
[0169] Combination Figure 6As shown in Table 1, in this example, the convolution module includes a convolution layer Conv2d, the first depthwise separable convolution module includes five bottleneck layers Bottlenect-1 to Bottlenect-5, the second depthwise separable convolution module includes two bottleneck layers Bottlenect-6 and Bottlenect-7, and the third depthwise separable convolution module includes two bottleneck layers Bottlenect-8 and Bottlenect-9. The depthwise separable convolution module can greatly reduce the amount of parameters and calculations while ensuring feature extraction. In the bottleneck layer, a 3*3 depthwise convolution operation is performed first, followed by a 1*1 pointwise convolution operation. The structure of the bottleneck layer is as follows: Figure 7 As shown, it includes a 3*3 deep convolutional layer, a BN (Batch Normalization), a ReLU (Rectified Linear Unit), a 1*1 convolutional layer, a BN (Batch Normalization) and a ReLU (Rectified Linear Unit) connected in sequence.
[0170] In this example, the first adaptive average pooling layer (AdaptiveAvgPool2d-1) outputs S1 of 1x1x64, the second adaptive average pooling layer (AdaptiveAvgPool2d-2) outputs S2 of 1x1x128, and the third adaptive average pooling layer (AdaptiveAvgPool2d-3) outputs S3 of 1x1x256. S1, S2 and S3 are spliced and fused by the concatenation module (Concat), and then sent to a classifier such as Softmax for clarity level classification to obtain a clarity prediction result. Among them, the above-mentioned bottleneck layer structure, the number of bottleneck layers contained in each depth-separable convolution module, etc. are only examples, and this embodiment does not limit this. Therefore, the three pooling layers all use adaptive average pooling layers to support the flexible adjustment of the structure of the three depth-separable convolution modules.
[0171] Another embodiment of the present invention provides a method for predicting the clarity of a face image, comprising:
[0172] The face image to be predicted is input into the neural network provided in the above embodiment or the neural network trained by the training method provided in the above embodiment to obtain the image clarity prediction value.
[0173] In a specific example, if Figure 8As shown, when the face image clarity prediction method provided by this embodiment is applied in the application scenario of face recognition, after the camera captures the face image, the face image is sent to the computer device, and the computer device inputs the face image into the neural network to predict whether it is clear: if it is clear, face recognition is performed on the face image; if it is not clear, the camera is controlled to re-capture.
[0174] like Fig. 9 As shown, a computer system suitable for executing the neural network training method for predicting image clarity provided by the above embodiment includes a central processing module (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage part into a random access memory (RAM). In the RAM, various programs and data required for the operation of the computer system are also stored. The CPU, ROM, and RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.
[0175] The following components are connected to the I / O interface: an input part including a keyboard, a mouse, etc.; an output part including a liquid crystal display (LCD), etc. and a speaker, etc.; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a LAN card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0176] In particular, according to this embodiment, the process described in the flowchart above can be implemented as a computer software program. For example, this embodiment includes a computer program product, which includes a computer program tangibly contained on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium.
[0177] The flowchart and schematic diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product of the present embodiment. In this regard, each box in the flowchart or schematic diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the schematic diagram and / or flowchart, and the combination of the boxes in the schematic diagram and / or flowchart can be implemented by a dedicated hardware-based system that performs a specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions. The modules described in the present embodiment can be implemented by software or by hardware.
[0178] A computer system and a method for predicting image clarity provided by the above embodiment Figure 4 The structure of the computer system shown is similar and will not be described again here.
[0179] As another aspect, an embodiment of the present invention further provides a non-volatile computer storage medium, which may be the non-volatile computer storage medium included in the above-mentioned device in the above-mentioned embodiment, or may be a non-volatile computer storage medium that exists independently and is not installed in a terminal.
[0180] The above-mentioned non-volatile computer storage medium stores one or more programs. When the above-mentioned one or more programs are executed by a device, the above-mentioned device: obtains an image set and clarity labels of some images in the image set, obtains image samples with clarity labels and images to be expanded other than the image samples; extracts clarity features of at least some images in the image set, obtains clarity labels of at least some images in the images to be expanded based on the extracted clarity features, corrects the clarity labels of at least some images in the images to be expanded to expand the image samples and uses the image samples to train a neural network for predicting image clarity, and obtains a trained neural network.
[0181] Alternatively, the non-volatile computer storage medium stores one or more programs, and when the one or more programs are executed by a device, the device: inputs the image to be predicted into a neural network for predicting the clarity of a facial image as provided in the above embodiment, and obtains a predicted value of image clarity.
[0182] It should be noted that, in the description of the present invention, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0183] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not limitations on the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is impossible to list all the embodiments here. All obvious changes or modifications derived from the technical solution of the present invention are still within the protection scope of the present invention.
Claims
1. A neural network training method for predicting image clarity, characterized in that: include: Obtaining an image set and clarity labels of some images in the image set, obtaining image samples with clarity labels and images to be expanded other than the image samples; Extracting clarity features of at least part of the images in the image set, obtaining clarity labels of at least part of the images to be expanded according to the extracted clarity features, correcting the clarity labels of at least part of the images to be expanded to expand image samples, and training a neural network for predicting image clarity using the image samples to obtain a trained neural network; The image set includes multiple groups of images, and the images in each group contain the same target; obtaining the clarity labels of some images in the image set includes: obtaining the clarity label of the image with the highest clarity in each group of images, and obtaining image samples with clarity labels; The extracting of definition features of at least part of the images in the image set, obtaining definition labels of at least part of the images to be expanded according to the extracted definition features, correcting the definition labels of at least part of the images to be expanded to expand image samples, and using the image samples to train a neural network for predicting image definition, and obtaining the trained neural network includes: Extracting a definition feature of each image in the image set; Calculate the similarity between the definition feature of each image sample and the definition features of other images in the group to which the image sample belongs; Obtaining definition labels of other images in each group of images to be expanded according to the similarity, and correcting the definition labels of some images in the obtained images to be expanded to expand the image samples; training the neural network based on image samples; Extracting definition features of a portion of the image to be expanded using the trained neural network to perform definition prediction on the portion of the image to be expanded, and obtaining a definition label of the portion of the image to be expanded; According to whether the clarity labels of the partial images in the image to be expanded obtained based on clarity prediction are consistent with the clarity labels of the partial images in the image to be expanded obtained based on similarity calculation, it is judged whether the proportion of the number of clarity labels of the partial images in the image to be expanded that needs to be corrected is greater than a preset threshold: if greater than, correction is performed and image samples are expanded according to the corrected partial images in the image to be expanded, and the training of the neural network according to the image samples is entered; if less than or equal to, the training is terminated to obtain the trained neural network.
2. The method according to claim 1, characterized in that The extracting of definition features of at least part of the images in the image set, obtaining definition labels of at least part of the images to be expanded according to the extracted definition features, correcting the definition labels of at least part of the images to be expanded to expand image samples, and using the image samples to train a neural network for predicting image definition, and obtaining the trained neural network includes: training the neural network based on image samples; Extracting definition features of a portion of the image to be expanded using the trained neural network to perform definition prediction on the portion of the image to be expanded, and obtaining a definition label of the portion of the image to be expanded; Determine whether the proportion of the number of clarity labels that need to be corrected in the partial image in the image to be expanded is greater than a preset threshold: if greater than, perform correction and expand the image sample according to the corrected partial image in the image to be expanded, and enter the training of the neural network according to the image sample; if less than or equal to, end the training to obtain the trained neural network.
3. The method according to claim 2, characterized in that Each time, the number of images for which the clarity prediction is performed using the trained neural network increases.
4. The method according to claim 1, characterized in that: The extracting of definition features of at least part of the images in the image set, obtaining definition labels of at least part of the images to be expanded according to the extracted definition features, correcting the definition labels of at least part of the images to be expanded to expand image samples, and using the image samples to train a neural network for predicting image definition, and obtaining the trained neural network includes: Extracting a definition feature of each image in the image set; Calculate the similarity between the definition feature of each image sample and the definition features of other images in the group to which the image sample belongs; Obtaining definition labels of other images in each group of images to be expanded according to the similarity, and correcting the definition labels of the images to be expanded to expand image samples; The expanded image samples are used to train a neural network for predicting image clarity to obtain a trained neural network.
5. The method according to claim 4, characterized in that Before extracting the definition feature of each image in the image set, the method further includes: Detect target feature points of each image in the image set, and perform target alignment on each image in each group of images according to the target feature points.
6. The method according to claim 1, characterized in that The correcting the clarity labels of at least part of the images to be expanded comprises: Displaying a correction interface, the correction interface including a correction control and at least a portion of the image to be expanded and a corresponding definition label; In response to the operation on the correction control, the clarity label of the corresponding image in the correction interface is corrected.
7. The method according to claim 1, characterized in that The image set is a face image set.
8. A neural network for predicting image clarity, characterized in that: The method is obtained by training according to any one of claims 1 to 7.
9. The neural network according to claim 8, characterized in that The neural network is a lightweight neural network.
10. The neural network according to claim 9, characterized in that The lightweight neural network includes a convolution module, a first depth-separable convolution module, a second depth-separable convolution module and a third depth-separable convolution module connected in sequence, and also includes: a first adaptive average pooling layer connected to the first depth-separable convolution module, a second adaptive average pooling layer connected to the second depth-separable convolution module, a third adaptive average pooling layer connected to the third depth-separable convolution module, a splicing module respectively connected to the first adaptive average pooling layer, the second adaptive average pooling layer and the third adaptive average pooling layer, and a classifier connected to the splicing module.
11. A method for predicting image clarity, characterized in that: include: The image to be predicted is input into the neural network as described in any one of claims 8 to 10 to obtain a predicted value of image clarity.
12. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements: the training method according to any one of claims 1 to 7, or the prediction method according to claim 11.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it implements: the training method according to any one of claims 1 to 7, or the prediction method according to claim 11.
