A method and device for processing face images

By combining image encoding and decoding models in the face repair model, using the image encoding model to generate feature vectors for face image repair, the problem of difficult to apply image decoding models to face repair in the face generation direction in the prior art is solved, and the problem is realized. Efficient facial image quality improvement.

CN112102191BActive Publication Date: 2024-11-22BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202010967993.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-15
Publication Date
2024-11-22
Estimated Expiration
2040-09-15

AI Technical Summary

Technical Problem

The prior art is difficult to effectively apply an image decoding model to face repair in the face generation direction, and the application range of the image decoding model is limited.

Method used

By introducing an image encoding model into the face repair model, using the image encoding model to encode low-quality face images, generate feature vectors, and input them to the image decoding model for decoding, improving the quality of face images, thereby achieving low-quality face images Repair of quality face images.

Benefits of technology

It effectively improves the face repair effect, expands the application scope of image decoding models in the field of face repair, and realizes efficient repair of low-quality face images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112102191B_ABST
    Figure CN112102191B_ABST
Patent Text Reader

Abstract

The present application provides a facial image processing method and device, which obtains a facial image to be repaired; inputs the facial image to be repaired into a facial repair model, calls an image encoding model in the facial repair model to encode the facial image to be repaired, and obtains a feature vector corresponding to the facial image to be repaired; calls an image decoding model in the facial repair model to decode the feature vector, and obtains a target facial image corresponding to the facial image to be repaired. The image encoding model is obtained by training an initial image encoding model in an initial face repair model based on the difference information of a second feature vector corresponding to a second facial image relative to a first feature vector corresponding to a first facial image, and the second facial image is obtained by reducing the image quality of the first facial image, thereby applying the image decoding model that currently has a significant effect in the direction of face generation to the face repair model, thereby improving the face repair effect while expanding the application scope of the image decoding model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and in particular, relates to a method and device for processing facial images. Background Art

[0002] In related technologies, image decoding models can take feature vectors as input and output high-definition face images. For example, the StyleGan network model is a high-definition face restoration model launched by NVIDIA. The StyleGan network model can be used as an image decoding model. The StyleGan network model takes random feature vectors as input and can output up to 1024*1024 high-definition face images. With the significant results achieved by image decoding models in the direction of face generation, how to use image decoding models in the field of face restoration, which is close to face generation, is an urgent problem to be solved. Summary of the invention

[0003] In view of this, the purpose of the present application is to provide a facial image processing method and device for improving the restoration effect of facial images.

[0004] On the one hand, the present application provides a method for processing a face image, the method comprising:

[0005] Obtain the face image to be restored;

[0006] Inputting the face image to be repaired into a face repair model, the face repair model comprising an image coding model and an image decoding model, the image coding model being obtained by training an initial image coding model in an initial face repair model based on difference information between a second feature vector corresponding to a second face image and a first feature vector corresponding to a first face image, wherein the second face image is obtained by reducing the image quality of the first face image;

[0007] Calling the image coding model to encode the face image to be restored, and obtaining a feature vector corresponding to the face image to be restored;

[0008] The image decoding model is called to decode the feature vector to obtain a target face image corresponding to the face image to be repaired.

[0009] On the other hand, the present application also provides a face image processing device, the device comprising:

[0010] An acquisition unit, used for acquiring a face image to be restored;

[0011] an input unit, configured to input the face image to be restored into a face restoration model, wherein the face restoration model includes an image encoding model and an image decoding model, wherein the image encoding model is obtained by training an initial image encoding model in an initial face restoration model based on difference information between a second feature vector corresponding to a second face image and a first feature vector corresponding to a first face image, wherein the second face image is obtained by reducing the image quality of the first face image;

[0012] An encoding unit, used for calling the image encoding model to encode the face image to be restored, and obtaining a feature vector corresponding to the face image to be restored;

[0013] A decoding unit is used to call the image decoding model to decode the feature vector to obtain a target face image corresponding to the face image to be repaired.

[0014] In another aspect, the present application further provides an electronic device, the electronic device comprising:

[0015] processor;

[0016] a memory for storing instructions executable by the processor;

[0017] Wherein, the processor is configured to execute the instructions to implement the above-mentioned face image processing method.

[0018] On the other hand, the present application also provides a storage medium, in which instructions are stored, and when the instructions in the storage medium are executed, the above-mentioned face image processing method is implemented.

[0019] It can be known from the above technical solution that the facial image to be repaired is obtained; the facial image to be repaired is input into the face repair model, and the image encoding model in the face repair model is called to encode the facial image to be repaired to obtain the feature vector corresponding to the facial image to be repaired; the image decoding model in the face repair model is called to decode the feature vector to obtain the target facial image corresponding to the facial image to be repaired. The image encoding model is trained on the initial image encoding model in the initial face repair model based on the difference information of the second feature vector corresponding to the second facial image relative to the first feature vector corresponding to the first facial image, and the second facial image is obtained by reducing the image quality of the first facial image.

[0020] Because the second face image is obtained by reducing the image quality of the first face image, it means that the image quality of the second face image input by the image coding model is lower than the image quality of the first face image output by the image decoding model. Therefore, in the process of face restoration using the face restoration model, the image coding model can access a face image with lower image quality, provide a feature vector to the image decoding model, and the image decoding model can output a face image with improved image quality to achieve restoration of the face image with lower image quality. In this way, the image decoding model, which currently has significant effects in the direction of face generation, can be applied to the face restoration model, thereby improving the face restoration effect and expanding the application scope of the image decoding model. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 is a flow chart of a face image processing method provided by an embodiment of the present application;

[0023] Figure 2 is a schematic diagram of a training initial image coding model provided in an embodiment of the present application;

[0024] Figure 3 is a flowchart of training an initial image coding model provided by an embodiment of the present application;

[0025] Figures 4 to 6 It is a schematic diagram of the network structure of the initial discrimination model, the initial image encoding model and the initial image decoding model provided in the embodiment of the present application;

[0026] Figure 7 is a schematic diagram of an image decoding model provided in an embodiment of the present application;

[0027] Figure 8 is a flowchart of obtaining an image decoding model provided by an embodiment of the present application;

[0028] Fig. 9 is a flowchart of adjusting an image decoding model and a discrimination model provided by an embodiment of the present application;

[0029] Fig.10 is a schematic diagram of adjusting an image decoding model and a discrimination model provided in an embodiment of the present application;

[0030] Fig.11It is a schematic diagram of simultaneously adjusting an image encoding model, an image decoding model, and a discrimination model provided by an embodiment of the present application;

[0031] Fig.12 It is a schematic diagram of simultaneously adjusting an image encoding model, an image decoding model, and a discrimination model provided by an embodiment of the present application;

[0032] Fig.13 It is a schematic diagram comparing the effects of repairing a low-definition face image provided by an embodiment of the present application;

[0033] Fig.14 It is a schematic diagram comparing the effects of repairing a noisy face image provided by an embodiment of the present application;

[0034] Fig.15 It is a structural schematic diagram of a face image processing device provided in an embodiment of the present application;

[0035] Fig.16 is a structural schematic diagram of another face image processing device provided in an embodiment of the present application;

[0036] Fig.17 It is a structural schematic diagram of another face image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0038] See also Figure 1 , which shows a flow chart of a face image processing method provided by an embodiment of the present application, which may include the following steps:

[0039] 101: Acquire a facial image to be repaired. It can be understood that: the facial image to be repaired is a facial image whose image quality is lower than the first image quality, such as the resolution of the facial image to be repaired is lower than the resolution corresponding to the first image quality and / or the noise data of the facial image to be repaired is more than the noise data corresponding to the first image quality, such as the facial image to be repaired is at least one of a low-definition facial image and a facial image with noise, and the first image quality indicates that the facial image is a real high-definition facial image, and the real high-definition facial image represents a high-definition facial image and a facial image whose real value is greater than a preset real threshold value, so as to distinguish it from a fictitious high-definition facial image, so that the facial image decoded by the image decoding model can achieve a fake-real effect, thereby improving the repair effect.

[0040] 102: Input the face image to be repaired into the face repair model, the face repair model includes an image coding model and an image decoding model, the image coding model is based on the difference information between the second feature vector corresponding to the second face image and the first feature vector corresponding to the first face image, and the initial image coding model in the initial face repair model is trained, and the second face image is obtained by reducing the image quality of the first face image.

[0041] If the first facial image has a first image quality and the second facial image has a second image quality, for example, the resolution corresponding to the first image quality is greater than the resolution of the second image quality and / or the noise data corresponding to the first image quality is less than the noise data corresponding to the second image quality, if the second facial image is at least one of a low-definition facial image and a noisy facial image, and the first facial image is a real high-definition facial image, it means that the image coding model obtained by training the initial image coding model has the ability to: input a facial image with the second image quality, and output a feature vector corresponding to the facial image with the first image quality.

[0042] 103: Calling the image coding model to encode the face image to be repaired, and obtaining a feature vector corresponding to the face image to be repaired.

[0043] 104: Calling the image decoding model to decode the feature vector to obtain a target face image corresponding to the face image to be repaired.

[0044] The image coding model obtained by training the initial image coding model has the ability to: input a facial image with a second image quality and output a feature vector corresponding to the facial image with a first image quality. Then, the facial image to be repaired input into the image coding model is a facial image with the second image quality. The image coding model is called for encoding to obtain a feature vector corresponding to the facial image with the first image quality, so that the image decoding model can restore the facial image with the first image quality. The facial image with the first image quality is the target facial image corresponding to the facial image to be repaired. The facial image to be repaired with the second image quality is repaired into the target facial image with the first image quality, thereby improving the image quality of the facial image and realizing the repair of the facial image to be repaired with the second image quality.

[0045] The idea of ​​the image coding model in the face restoration model is as follows Figure 2As shown, after obtaining the image decoding model in the face restoration model, and the image decoding model is able to decode the feature vector to output the face image corresponding to the feature vector, the image decoding model is used to train the initial image coding model. During the training process, the initial image coding model is connected after the image decoding model, that is, the output of the image decoding model is used as the input of the initial image coding model. While maintaining the model parameters of the image decoding model unchanged, the initial image coding model is trained using the difference information between the second feature vector output by the initial image coding model and the first feature vector input by the image decoding model to obtain the image coding model. The process is as follows Figure 3 As shown, the following steps may be included:

[0046] 201: Obtain a first face image, where the first face image is obtained after an image decoding model decodes an input first feature vector.

[0047] The image decoding model has the function of generating a face image. The image decoding model can take a feature vector as input, decode the input feature vector, and generate a face image corresponding to the feature vector. For example, the first feature vector is input into the image decoding model, and the image decoding model is called to decode the first feature vector to obtain the first face image corresponding to the first feature vector.

[0048] In this embodiment, the first feature vector input to the image decoding model can be a feature vector generated according to random numbers, such as the first feature vector is but not limited to a 512*512 feature vector, a 512*512 feature vector composed of 512*512 random numbers, and a preset number of random numbers in all the random numbers constituting the first feature vector can be the same, for example, the value of the preset number of random numbers is 0, and this embodiment does not limit the preset number.

[0049] 202: Obtain a second facial image by reducing the image quality of the first facial image, so that the image quality of the second facial image is lower than the image quality of the first facial image.

[0050] For example, the first facial image has a first image quality, and the second facial image has a second image quality, for example, the resolution corresponding to the first image quality is greater than the resolution of the second image quality and / or the noise data corresponding to the first image quality is less than the noise data corresponding to the second image quality, and the second facial image is at least one of a low-definition facial image and a noisy facial image, and the first facial image is a high-definition facial image, and the true value of the first facial image is greater than a preset true threshold, that is, the first facial image can be a real high-definition facial image to distinguish it from a fictitious high-definition facial image, so that the first facial image decoded by the image decoding model can achieve a realistic effect.

[0051] The method of reducing the image quality of the first facial image may be, but is not limited to, performing degradation processing on the first facial image, such as performing at least one of noise loading, blurring, compression and clarity reduction processing on the first facial image, so as to reduce the image quality of the first facial image by at least one of these methods. The detailed processes of these methods will not be elaborated in this embodiment.

[0052] 203: Calling the initial image coding model to encode the second facial image to obtain a second feature vector corresponding to the second facial image.

[0053] The initial image coding model has the function of generating a feature vector. The initial image coding model can take a face image as input, encode the input face image, and generate a feature vector corresponding to the face image. For example, a second face image is input into the initial image coding model, and the initial image coding model is called to encode the second face image to obtain a second feature vector corresponding to the second face image.

[0054] 204: Based on the difference information between the second eigenvector and the first eigenvector, train the initial image coding model to obtain an image coding model.

[0055] Based on the difference information of the second eigenvector relative to the first eigenvector, the purpose of training the initial image coding model is to train the initial image coding model to have the ability to encode the first eigenvector corresponding to the first facial image, so that when a facial image with the second image quality is input, the image coding model obtained by training the initial image coding model can output the eigenvector corresponding to the facial image with the first image quality, and then the image decoding model can use the eigenvector output by the image coding model to restore the facial image with the first image quality.

[0056] In this embodiment, based on the difference information of the second eigenvector relative to the first eigenvector, the initial image coding model is trained mainly by: adjusting the model parameters of the initial image coding model based on the difference information of the second eigenvector relative to the first eigenvector. The process of adjusting the model parameters of the initial image coding model can be adjusted by a preset adjustment step. Of course, the model parameters can also be randomly adjusted according to the difference information of the second eigenvector relative to the first eigenvector, and the adjustment step of the model parameters does not need to be restricted.

[0057] The difference information of the second eigenvector relative to the first eigenvector is obtained by comparing the second eigenvector with the first eigenvector, such as calculating the similarity between the second eigenvector and the first eigenvector, and determining the similarity between the second eigenvector and the first eigenvector as the difference information.

[0058] If it is determined based on the difference information of the second eigenvector relative to the first eigenvector that the initial image coding model does not meet the preset training conditions, the model parameters of the initial image coding model are adjusted, and the preset training conditions indicate that the second eigenvector matches the first eigenvector and the number of matches is greater than the preset number.

[0059] In the process of adjusting the initial image coding model, the second facial image can be maintained unchanged, and the adjusted initial image coding model can be called to encode the second facial image to re-output the second feature vector, and then determine whether it does not meet the preset training conditions based on the difference information between the second feature vector and the re-output first feature vector. Alternatively, in the process of adjusting the initial image coding model, the second facial image is changed, and the adjusted initial image coding model is called to encode the changed second facial image to re-output the second feature vector, and then determine whether it does not meet the preset training conditions based on the difference information between the second feature vector and the re-output first feature vector. The method of changing the second facial image includes but is not limited to: changing the first facial image corresponding to the image decoding model, and changing at least one of the processing methods that reduce the image quality of the first facial image while maintaining the first facial image unchanged.

[0060] If it is determined based on the difference information of the second eigenvector relative to the first eigenvector that the initial image coding model meets the preset training conditions, it means that the second eigenvector encoded by the initial image coding model matches the first eigenvector, and through training, the initial image coding model can output a eigenvector corresponding to a facial image with the first image quality, thereby the trained initial image coding model can be determined as the image coding model.

[0061] It can be known from the above technical solution that the facial image to be repaired is obtained; the facial image to be repaired is input into the face repair model, and the image encoding model in the face repair model is called to encode the facial image to be repaired to obtain the feature vector corresponding to the facial image to be repaired; the image decoding model in the face repair model is called to decode the feature vector to obtain the target facial image corresponding to the facial image to be repaired. The image encoding model is trained on the initial image encoding model in the initial face repair model based on the difference information of the second feature vector corresponding to the second facial image relative to the first feature vector corresponding to the first facial image, and the second facial image is obtained by reducing the image quality of the first facial image.

[0062] Because the second face image is obtained by reducing the image quality of the first face image, it means that the image quality of the second face image input by the image coding model is lower than the image quality of the first face image output by the image decoding model. Therefore, in the process of face restoration using the face restoration model, the image coding model can access a face image with lower image quality, provide a feature vector to the image decoding model, and the image decoding model can output a face image with improved image quality to achieve restoration of the face image with lower image quality. In this way, the image decoding model, which currently has significant effects in the direction of face generation, can be applied to the face restoration model, thereby improving the face restoration effect and expanding the application scope of the image decoding model.

[0063] In this embodiment, the initial face restoration model also includes an initial image decoding model and an initial discriminant model. The relationship among the initial image encoding model, the initial image decoding model and the initial discriminant model is as follows: the initial image encoding model outputs a feature vector corresponding to a face image, the initial image decoding model can decode the face image with reference to the feature vector, and the initial discriminant model is used to discriminate the image quality of the face image. A feasible network structure of the three models is as follows:

[0064] The initial discriminant model includes an input layer, an output layer and at least one image processing sublayer. Each image processing sublayer is used to process the face image and the size of the face image tends to decrease after being processed by each image processing sublayer. The output layer outputs the discrimination result of the image quality of the face image.

[0065] The initial image coding model includes an input layer, an output layer and at least one image processing sublayer. Each image processing sublayer is used to process the face image and the size of the face image tends to decrease after being processed by each image processing sublayer. The output layer outputs the feature vector of the face image. The network structure of the initial image decoding model is opposite to that of the initial image coding model.

[0066] like Figures 4 to 6 , showing the network structure of the initial discrimination model, the initial image encoding model and the initial image decoding model provided by this embodiment, Figure 4In the initial discriminant model shown, the input layer of the initial discriminant model inputs a face image, such as the face image output by the image decoding model and a real face image, such as a face image obtained from a face image library; the input face image is interpolated to a certain size through the first image processing sublayer, such as interpolating to obtain but not limited to a 512*512 face image, the 512*512 face image is convolved by the second image processing sublayer to obtain a 256*256 face image, ..., and so on. After being processed by multiple layers of image processing sublayers, a 4*4 face image is obtained, and then the output layer outputs the probability representing the image quality through the last image processing sublayer, such as outputting a decimal of 0-1.

[0067] from Figure 4 From the initial discriminant model shown, it can be seen that the size of the face image is reduced by half after being processed by the image processing sublayer, so that the size of the face image shows a decreasing trend after being processed by each image processing sublayer. Of course, the size of the face image can be reduced further after being processed by the image processing sublayer, but it will lead to an increase in the amount of lost image data, affecting the discrimination result.

[0068] Figure 5 A network structure of the initial image coding model in this embodiment is shown. The input layer of the initial image coding model inputs a face image, and the input face image is interpolated to a certain size through the first image processing sublayer, such as interpolating to obtain but not limited to a 512*512 face image, and the 512*512 face image is convolved by the second image processing sublayer to obtain a 256*256 face image, ..., and so on. After being processed by multiple layers of image processing sublayers, a 16*16 face image is obtained, and then the feature vector corresponding to the face image output by the output layer is obtained through the last image processing sublayer.

[0069] from Figure 5 From the initial image coding model shown, it can be seen that the size of the face image is reduced by half after being processed by the image processing sublayer, so that the size of the face image shows a decreasing trend after being processed by each image processing sublayer. Of course, the size of the face image can be reduced further after being processed by the image processing sublayer, but it will lead to an increase in the amount of lost image data, affecting the accuracy of the feature vector.

[0070] The initial image decoding model restores the feature vector to a face image, which is opposite to the processing of the initial image encoding model. Therefore, the network structure of the initial image decoding model in this embodiment is opposite to that of the initial image encoding model. Figure 6 The network structure of the initial image decoding model shown is not elaborated in this embodiment.

[0071] And from the network structures of the above-mentioned initial discriminant model and the initial image coding model, it can be seen that the network structure of the initial image coding model from the input layer to the last image processing sublayer is the network structure of the initial discriminant model from the input layer to the image processing sublayer outputting a 16*16 face image, indicating that the first N layers of the network architecture of the initial image coding model are the same as the first N layers of the network structure of the initial discriminant model, for example: the network structure from the input layer of the initial image coding model to the N-1th image processing sublayer of the initial image coding model is the same as the network structure from the input layer of the initial discriminant model to the Nth image processing sublayer of the initial discriminant model, N is a natural number greater than 1, and N can be the total number of image processing sublayers.

[0072] Based on this, the present embodiment can obtain the initial image coding model according to the network structure of the initial discriminant model, so that the first N layers of the network architecture of the initial image coding model are the same as the first N layers of the network structure of the initial discriminant model, and obtain the initial image decoding model according to the network structure of the initial image coding model, and the network structure of the initial image decoding model is opposite to the network structure of the initial image coding model. The reason why the initial image coding model is obtained according to the network structure of the initial discriminant model is that: the purpose of the initial discriminant model is to judge the image quality of the face image, which means that the initial discriminant model needs to obtain the feature vector corresponding to the face image during the processing of the face image, which is consistent with the purpose of the initial image coding model to obtain the feature vector corresponding to the face image, so the initial image coding model can be obtained according to the network structure of the initial discriminant model, reducing the difficulty of constructing the initial image coding model.

[0073] A feasible way to obtain an image coding model based on the network structure of a discriminant model is to construct a network structure of an image coding model based on the relationship between the input layer of the discriminant model and the image processing sublayer of the discriminant model and the relationship between the image processing sublayers of the discriminant model to obtain the image coding model.

[0074] For example, the relationship between the input layer of the initial discriminant model and the image processing sublayer of the initial discriminant model, as well as the relationship between the image processing sublayers of the initial discriminant model, are used as the relationship between the input layer and the image processing sublayer, as well as the relationship between the image processing sublayers in the initial image coding model. That is, the structure of the initial image coding model from the input layer to the last image processing sublayer is the same as the structure of the initial discriminant model from the input layer to the last image processing sublayer, the difference lies in the structure from the last image processing sublayer to the output layer.

[0075] After obtaining the initial image encoding model, the initial image decoding model and the initial discriminant model, the image decoding model in this embodiment can be obtained by pre-training the initial image decoding model with a feature vector generated by random numbers, so that the image decoding model in the face restoration model is different from the current model that can output high-definition face images.

[0076] The initial image decoding model is pre-trained with a feature vector generated by random numbers. Figure 7 As shown in , the idea is to generate a feature vector with a random number, call the initial image decoding model to decode the feature vector, generate a face image corresponding to the feature vector, and then call the initial discriminant model to at least discriminate the image quality of the face image corresponding to the feature vector, so as to train the initial image decoding model through the adversarial model composed of the initial image decoding model and the initial discriminant model. The corresponding flowchart is shown in Figure 8 As shown, the following steps may be included:

[0077] 301: Generate a third feature vector according to the first random number. The form of the third feature vector can be set by the initial image decoding model. For example, if the feature vector input by the initial image decoding model is a 512*512 feature vector, a 512*512 feature vector needs to be generated according to the first random number as the third feature vector. The relationship between the random numbers in the third feature vector is not limited in this embodiment. For example, the first random number can be selected from 0 to 255, and a preset number of first random numbers in all the first random numbers constituting the first feature vector can be the same, for example, the value of the preset number of first random numbers is 0. The preset number is not limited in this embodiment.

[0078] 302: Calling the initial image decoding model to decode the third feature vector to obtain a third face image.

[0079] 303: Calling the initial discrimination model to discriminate the image quality of the third face image and the preset face image, obtaining a first discrimination result for the third face image and a second discrimination result for the preset face image, wherein the preset face image has the same first image quality as the first face image.

[0080] If the preset face image and the first face image are both real high-definition face images, the initial discriminant model can be used to determine whether the third face image and the preset face image are both real high-definition face images, so that the trained image decoding model can output real high-definition face images with the help of the judgment of the initial discriminant model, and the initial discriminant model can be constrained by the preset face image, so that the initial discriminant model has high requirements for real high-definition face images.

[0081] Among them, the first discrimination result for the third face image is used to characterize whether the third face image has the first image quality. For example, the initial discrimination model output indicates the probability of whether the third face image has the first image quality. If the probability output by the initial discrimination model is greater than the preset threshold, the first discrimination result characterizes that the third face image has the first image quality; if the probability output by the initial discrimination model is less than or equal to the preset threshold, the first discrimination result characterizes that the third face image does not have the first image quality. The preset threshold is used as the threshold for determining whether the third face image has the first image quality. This embodiment does not limit the preset threshold. The second discrimination result for the preset face image is used to characterize whether the preset face image has the first image quality. For the description of the second discrimination result, please refer to the description of the first discrimination result, which will not be elaborated here.

[0082] 304: If it is determined according to the first discrimination result that the third facial image does not have the first image quality, the initial image decoding model is trained based on the first discrimination result.

[0083] If it is determined according to the first discrimination result that the third face image does not have the first image quality, it means that the initial image decoding model does not have the ability to output a face image with the first image quality, and it is necessary to continue to train the initial image decoding model, such as continuing to adjust the model parameters of the initial image decoding model. The process of adjusting the model parameters of the initial image decoding model can be adjusted by a preset adjustment step size, and of course, the model parameters can also be randomly adjusted according to the first discrimination result, and the adjustment step size of the model parameters does not need to be limited.

[0084] In the process of adjusting the initial image decoding model, the third facial image can be kept unchanged, and the adjusted initial image decoding model can be called to decode the third feature vector to re-output the third facial image, and then the image quality of the third facial image can be judged to obtain the first judgment result for the third facial image again. Alternatively, in the process of adjusting the initial image decoding model, the third feature vector is changed, and the adjusted initial image decoding model is called to decode the changed third feature vector to re-output the third facial image, and then the image quality of the third facial image can be judged to obtain the first judgment result for the third facial image again. The way to change the third feature vector includes but is not limited to: changing the first random number, keeping the first random number unchanged but changing at least one of the positions of the first random number in the third feature vector.

[0085] Because the initial image decoding model and the initial discrimination model form an adversarial model, in the process of adjusting the model parameters of the initial image decoding model, the model parameters of the initial discrimination model can also be adjusted. The adjustment of the model parameters of the initial discrimination model can be adjusted according to the first discrimination result, which is similar to the adjustment of the model parameters of the initial image decoding model, and will not be elaborated in detail in this embodiment.

[0086] 305: If it is determined according to the second discrimination result that the preset face image does not have the first image quality, the initial discrimination model is trained based on the second discrimination result.

[0087] If it is determined according to the second discrimination result that the preset face image does not have the first image quality, it means that the initial discrimination model has a recognition error problem. This problem may be caused by the initial discrimination model having too high requirements for the first image quality. Therefore, if it is determined according to the second discrimination result that the preset face image does not have the first image quality, the initial discrimination model is trained based on the second discrimination result, such as continuing to adjust the model parameters of the initial discrimination model. The process of adjusting the model parameters of the initial discrimination model can be adjusted by a preset adjustment step. Of course, the model parameters can also be randomly adjusted according to the first discrimination result, and the adjustment step of the model parameters does not need to be limited.

[0088] In the process of adjusting the initial discriminant model, the preset face image and / or the third face image can be kept unchanged, and the adjusted initial discriminant model is called to discriminate the image quality of the third face image and the preset face image. Alternatively, in the process of adjusting the initial discriminant model, the preset face image and / or the third face image is changed, and the adjusted initial discriminant model is called to discriminate the image quality of the third face image and the preset face image. The change of the third face image can be achieved by, but not limited to, changing the third feature vector, which will not be described in detail here.

[0089] Similarly, in the process of adjusting the model parameters of the initial discrimination model, the model parameters of the initial image decoding model can also be adjusted. The adjustment of the model parameters of the initial image decoding model can be adjusted according to the second discrimination result, which will not be elaborated in this embodiment.

[0090] In this embodiment, the training termination conditions corresponding to the initial image decoding model and the initial discrimination model may be, but are not limited to, any one of: adjusting the model parameters of at least one of the initial image decoding model and the initial discrimination model for a first preset number of times, the initial discrimination model determining that the third face image and the preset face image both have the first image quality for a second preset number of times, and the user giving a termination training instruction based on the third face image. The first preset number of times is used to indicate the total number of times the initial image decoding model and the initial discrimination model are trained, and the second preset number of times is used to indicate the total number of times the third face image and the preset face image both have the first image quality. The first preset number of times is greater than the second preset number of times, but the values ​​of the first preset number of times and the second preset number of times are not limited in this embodiment.

[0091] By means of the above technical scheme, a third feature vector is generated according to a first random number, an initial image decoding model is called to decode the third feature vector to obtain a third face image, and an initial discrimination model is called to discriminate the image quality of the third face image and a preset face image to obtain a first discrimination result for the third face image and a second discrimination result for the preset face image, wherein the preset face image and the first face image have the same first image quality; if it is determined according to the first discrimination result that the third face image does not have the first image quality, the initial image decoding model is trained based on the first discrimination result; if it is determined according to the second discrimination result that the preset face image does not have the first image quality, the initial discrimination model is trained based on the second discrimination result, thereby obtaining an image decoding model in a face restoration model by training the initial image decoding model, so that the use of the face restoration model will not be restricted by the existing image decoding model.

[0092] The image decoding model can be obtained by training the initial image decoding model. Although the image quality of the third face image output by the initial image decoding model is judged by the initial discrimination model during the training process, the discrimination result of the initial discrimination model may be deceptive, so that the image quality of the face image output by the image decoding model is different from the quality of the first image. Therefore, after obtaining the image decoding model, the model parameters of the image decoding model can be adjusted with reference to the difference information between the face images. The process is as follows: Fig. 9 As shown, the process of adjusting the model parameters of the image decoding model in the face restoration model is described, which may include the following steps:

[0093] 401: After completing the training of the initial image coding model, a fourth facial image and a fifth facial image corresponding to the fourth facial image are obtained, the fourth facial image and the second facial image have the same second image quality, and the fifth facial image has the first image quality.

[0094] After completing the training of the initial image coding model to obtain the image coding model, the image coding model can encode a face image to obtain the corresponding feature vector. The feature vector output by the image coding model can be decoded by the image decoding model to obtain a face image. Compared with the training of the initial image decoding model, the feature vector input by the image decoding model is obtained by encoding a face image by the image coding model. In this process, two face images of the same face can be obtained, namely: a fourth face image with the second image quality and a fifth face image with the first image quality and corresponding to the same face as the fourth face image. The fifth face image can be used as a reference image for the image decoding model, such as obtaining a low-definition face image (i.e., the fourth face image) and a real high-definition face image (i.e., the fifth face image) of the same face.

[0095] 402: Calling an image coding model to encode a fourth face image to obtain a fourth feature vector.

[0096] 403: Calling the image decoding model to decode the fourth feature vector to obtain a sixth face image.

[0097] 404: calling the discriminant model obtained by training the initial discriminant model, performing image quality discrimination on the sixth face image and the preset face image, and obtaining a third discrimination result for the sixth face image and the preset face image.

[0098] 405: Based on the third discrimination result and the difference information between the sixth face image and the fifth face image, at least adjust the model parameters of the image decoding model and the discrimination model.

[0099] For example, the model parameters of the image coding model, the image decoding model and the discriminant model may be adjusted, and the adjustment step size used during the adjustment may be smaller than the adjustment step size used during the training. For example, the adjustment step size used when adjusting the image coding model may be smaller than the adjustment step size used when training the initial image coding model. As to how much smaller the adjustment step size is, this embodiment does not limit it.

[0100] In the process of adjusting the model parameters of the image decoding model, the model parameters of the image coding model can be maintained unchanged, and then the image coding model is called to encode the fourth face image to obtain the fourth feature vector. The fourth feature vector can be obtained by: while maintaining the model parameters of the image coding model unchanged, the image coding model is called to encode the fourth face image to obtain the fourth feature vector, so as to adjust the model parameters of the image decoding model and the discriminant model. Compared with adjusting the image coding model, the image decoding model and the discriminant model at the same time, the number of model adjustments is reduced, thereby improving the adjustment efficiency. In addition, in the process of adjusting the model parameters of the image decoding model and the discriminant model, the difference information of the sixth face image relative to the fifth face image is introduced, so that the difference information of the sixth face image output by the image decoding model and the fifth face image with the first image quality can be referred to for adjustment, so that the image quality of the face image output by the image decoding model is closer to the first image quality.

[0101] The process of adjusting the model parameters of the image decoding model and the discrimination model based on the third discrimination result and the difference information between the sixth face image and the fifth face image is as follows:

[0102] If it is determined according to the third discrimination result that the sixth facial image does not have the first image quality, based on the third discrimination result and the difference information of the sixth facial image relative to the fifth and sixth facial images, the model parameters of the image decoding model are adjusted using a first adjustment step, and the first adjustment step is smaller than the adjustment step used when the initial image decoding model is trained; if it is determined according to the third discrimination result that the preset facial image does not have the first image quality, the model parameters of the discrimination model are adjusted using a second adjustment step, and the second adjustment step is smaller than the adjustment step used when the initial discrimination model is trained.

[0103] The difference between the training process of the initial image decoding model and the initial discriminant model is that: the first adjustment step for adjusting the model parameters of the image decoding model is smaller than the adjustment step used when training the initial image decoding model, and the difference information between the sixth face image and the fifth and sixth images is introduced; the second adjustment step for adjusting the model parameters of the discriminant model is smaller than the adjustment step used when training the initial discriminant model.

[0104] The difference information of the sixth facial image relative to the fifth person sixth image is obtained by comparing the sixth facial image with the fifth person sixth image, such as calculating the similarity between the sixth facial image and the fifth person sixth image, and determining the similarity between the sixth facial image and the fifth person sixth image as the difference information.

[0105] If it is determined based on the difference information between the sixth facial image and the fifth and sixth facial images that the image decoding model does not meet the preset adjustment conditions, the model parameters of the image decoding model are adjusted using the first adjustment step, and the preset adjustment conditions indicate that the sixth facial image matches the fifth and sixth facial images and the number of matches is greater than the preset number of times. In the process of adjusting the model parameters of the image decoding model using the first adjustment step, the fifth facial image can be maintained unchanged or changed, and the specific details of this embodiment will not be elaborated. If it is determined based on the difference information between the sixth facial image and the fifth and sixth facial images that the image decoding model meets the preset adjustment conditions, the adjustment of the model parameters of the image decoding model using the first adjustment step is terminated. Because the adjustment of the discrimination model and the image decoding model is synchronized, the adjustment of the model parameters of the discrimination model is terminated at the same time as the adjustment of the model parameters of the image decoding model is terminated.

[0106] In addition to using the preset adjustment conditions as the conditions for ending the adjustment of the model parameters of the image decoding model and the discrimination model, other conditions may also be used for constraints, such as adjusting the model parameters of at least one of the image decoding model and the discrimination model for a third preset number of times, the discrimination model determining that the sixth face image and the preset face image both have the first image quality for a fourth preset number of times, and the user giving a termination training instruction based on the sixth face image. The third preset number of times is used to indicate the total number of times the image decoding model and the discrimination model are trained, the fourth preset number of times is used to indicate the total number of times the sixth face image and the preset face image both have the first image quality, the third preset number of times is greater than the fourth preset number of times, but the values ​​of the third preset number of times and the fourth preset number of times are not limited in this embodiment.

[0107] The schematic diagram of adjusting the model parameters of the image decoding model and the discriminant model is as follows: Fig.10 As shown, the idea of ​​adjusting the model parameters of the image decoding model and the discriminant model is shown: the image coding model is placed before the image decoding model, the model parameters of the image coding model are maintained unchanged, the output of the image coding model is used as the input of the image decoding model, the fourth eigenvector output by the image coding model is decoded to obtain a sixth face image, and the discriminant model discriminates the image quality of the sixth face image and the preset face image to determine whether the sixth face image and the preset face image have the first image quality, thereby adjusting the model parameters of the image decoding model and the discriminant model based on the third discrimination result of the discriminant model and the difference information of the sixth face image relative to the fifth face image.

[0108] After completing the adjustment of the image decoding model and the discrimination model, the model parameters of the image encoding model, the image decoding model and the discrimination model can also be adjusted to jointly adjust the three models to improve the accuracy of the face restoration model. The adjustment diagram is shown in FIG. Fig.11The corresponding flow chart is shown in Fig.12 As shown, the following steps may be included:

[0109] 501: After the adjustment of the image decoding model and the discrimination model is completed, a seventh face image with the second image quality and an eighth face image with the first image quality corresponding to the seventh face image are obtained.

[0110] 502: Calling the image coding model to encode the seventh face image to obtain a fifth eigenvector.

[0111] 503: Call the adjusted image decoding model to decode the fifth eigenvector to obtain a ninth face image.

[0112] 504: calling the adjusted discrimination model to discriminate the image quality of the ninth face image and the preset face image, and obtaining fourth discrimination results for the ninth face image and the preset face image.

[0113] 505: Based on the fourth discrimination result and the difference information between the ninth face image and the eighth face image, the model parameters of the adjusted image decoding model and the discrimination model are adjusted again, and the model parameters of the image encoding model are adjusted.

[0114] The difference from the above-mentioned adjustment of the model parameters of the image decoding model and the discriminant model is that: the adjustment step size used when re-adjusting the model parameters of the adjusted image decoding model and the discriminant model is smaller than the adjustment step size used in the first adjustment, and the adjustment step size used when adjusting the model parameters of the image coding model is smaller than the adjustment step size used when training the initial image coding model. For other processes, please refer to the above-mentioned instructions for adjusting the model parameters of the image decoding model and the discriminant model, which will not be repeated here.

[0115] By adjusting the model parameters of the image decoding model and the image encoding model, the face restoration model can restore a face image with the second image quality to obtain a face image with the first image quality, thereby restoring a face image with low image quality. Fig.13 and Fig.14 As shown, it shows a schematic diagram comparing the effects of repairing low-definition face images and noisy face images by using the face repair model provided by this embodiment and the existing GAN model, wherein Fig.13 The following is a schematic diagram showing the effect comparison of low-definition face images. Fig.14 The schematic diagram shows the effect comparison of the face image with noise. Fig.13 and Fig.14 It can be seen from the comparison of the effects shown that the face image repaired by the face repair model provided in this embodiment is clearer.

[0116] Corresponding to the above method embodiment, the present application embodiment also provides a face image processing device, whose optional structure is as follows: Fig.15 As shown, it may include: an acquisition unit 100, an input unit 200, an encoding unit 300 and a decoding unit 400.

[0117] The acquisition unit 100 is used to acquire a facial image to be repaired. It can be understood that: the facial image to be repaired is a facial image whose image quality is lower than the first image quality, such as the resolution of the facial image to be repaired is lower than the resolution corresponding to the first image quality and / or the noise data of the facial image to be repaired is more than the noise data corresponding to the first image quality, such as the facial image to be repaired is at least one of a low-definition facial image and a facial image with noise, and the first image quality indicates that the facial image is a real high-definition facial image, and the real high-definition facial image represents a high-definition facial image and a facial image whose real value is greater than a preset real threshold value, so as to distinguish it from a fictitious high-definition facial image, so that the facial image decoded by the image decoding model can achieve a fake-real effect, thereby improving the repair effect.

[0118] Input unit 200 is used to input the face image to be repaired into the face repair model, which includes an image coding model and an image decoding model. The image coding model is obtained by training an initial image coding model in the initial face repair model based on difference information between a second feature vector corresponding to the second face image and a first feature vector corresponding to the first face image. The second face image is obtained by reducing the image quality of the first face image.

[0119] If the first facial image has a first image quality and the second facial image has a second image quality, for example, the resolution corresponding to the first image quality is greater than the resolution of the second image quality and / or the noise data corresponding to the first image quality is less than the noise data corresponding to the second image quality, if the second facial image is at least one of a low-definition facial image and a noisy facial image, and the first facial image is a real high-definition facial image, it means that the image coding model obtained by training the initial image coding model has the ability to: input a facial image with the second image quality, and output a feature vector corresponding to the facial image with the first image quality.

[0120] The encoding unit 300 is used to call the image encoding model to encode the face image to be restored, and obtain a feature vector corresponding to the face image to be restored.

[0121] The decoding unit 400 is used to call the image decoding model to decode the feature vector to obtain a target face image corresponding to the face image to be repaired.

[0122] The image coding model obtained by training the initial image coding model has the ability to: input a facial image with a second image quality and output a feature vector corresponding to the facial image with a first image quality. Then, the facial image to be repaired input into the image coding model is a facial image with the second image quality. The image coding model is called for encoding to obtain a feature vector corresponding to the facial image with the first image quality, so that the image decoding model can restore the facial image with the first image quality. The facial image with the first image quality is the target facial image corresponding to the facial image to be repaired. The facial image to be repaired with the second image quality is repaired into the target facial image with the first image quality, thereby improving the image quality of the facial image and realizing the repair of the facial image to be repaired with the second image quality.

[0123] It can be known from the above technical solution that the facial image to be repaired is obtained; the facial image to be repaired is input into the face repair model, and the image encoding model in the face repair model is called to encode the facial image to be repaired to obtain the feature vector corresponding to the facial image to be repaired; the image decoding model in the face repair model is called to decode the feature vector to obtain the target facial image corresponding to the facial image to be repaired. The image encoding model is trained on the initial image encoding model in the initial face repair model based on the difference information of the second feature vector corresponding to the second facial image relative to the first feature vector corresponding to the first facial image, and the second facial image is obtained by reducing the image quality of the first facial image.

[0124] Because the second face image is obtained by reducing the image quality of the first face image, it means that the image quality of the second face image input by the image coding model is lower than the image quality of the first face image output by the image decoding model. Therefore, in the process of face restoration using the face restoration model, the image coding model can access a face image with lower image quality, provide a feature vector to the image decoding model, and the image decoding model can output a face image with improved image quality to achieve restoration of the face image with lower image quality. In this way, the image decoding model, which currently has significant effects in the direction of face generation, can be applied to the face restoration model, thereby improving the face restoration effect and expanding the application scope of the image decoding model.

[0125] In this embodiment, the face image processing device can pre-train the initial image coding model to obtain the image coding model. The corresponding alternative structure is as follows: Fig.16 As shown, it also includes: an image processing unit 500 and a training unit 600.

[0126] The acquisition unit 100 is further used to acquire a first face image, where the first face image is obtained after the image decoding model decodes the input first feature vector.

[0127] The image processing unit 500 is used to obtain a second face image by reducing the image quality of the first face image, so that the image quality of the second face image is lower than that of the first face image.

[0128] For example, the first facial image has a first image quality, and the second facial image has a second image quality, for example, the resolution corresponding to the first image quality is greater than the resolution of the second image quality and / or the noise data corresponding to the first image quality is less than the noise data corresponding to the second image quality, and the second facial image is at least one of a low-definition facial image and a noisy facial image, and the first facial image is a high-definition facial image, and the true value of the first facial image is greater than a preset true threshold, that is, the first facial image can be a real high-definition facial image to distinguish it from a fictitious high-definition facial image, so that the first facial image decoded by the image decoding model can achieve a realistic effect.

[0129] The method of reducing the image quality of the first facial image may be, but is not limited to, performing degradation processing on the first facial image, such as performing at least one of noise loading, blurring, compression and clarity reduction processing on the first facial image, so as to reduce the image quality of the first facial image by at least one of these methods. The detailed processes of these methods will not be elaborated in this embodiment.

[0130] The encoding unit 300 is further used to call the initial image encoding model to encode the second face image to obtain a second feature vector corresponding to the second face image. The initial image encoding model has the function of generating a feature vector. The initial image encoding model can take a face image as input, encode the input face image, and generate a feature vector corresponding to the face image. For example, the second face image is input into the initial image encoding model, and the initial image encoding model is called to encode the second face image to obtain a second feature vector corresponding to the second face image.

[0131] The training unit 600 is used to train the initial image coding model based on the difference information between the second eigenvector and the first eigenvector to obtain the image coding model.

[0132] Based on the difference information of the second eigenvector relative to the first eigenvector, the purpose of training the initial image coding model is to train the initial image coding model to have the ability to encode the first eigenvector corresponding to the first facial image, so that when a facial image with the second image quality is input, the image coding model obtained by training the initial image coding model can output the eigenvector corresponding to the facial image with the first image quality, and then the image decoding model can use the eigenvector output by the image coding model to restore the facial image with the first image quality. Please refer to the above method embodiment for the training process, which will not be repeated here.

[0133] It can be known from the above technical scheme that a first face image is obtained, and the first face image is obtained after an image decoding model decodes an input first feature vector; a second face image is obtained by reducing the image quality of the first face image; an initial image coding model is called to encode the second face image to obtain a second feature vector corresponding to the second face image; based on the difference information of the second feature vector relative to the first feature vector, the initial image coding model is trained to obtain an image coding model, thereby applying the current image decoding model that has a significant effect in the direction of face generation to the face restoration model, thereby improving the face restoration effect while expanding the application scope of the image decoding model.

[0134] In this embodiment, the initial face restoration model also includes an initial image decoding model and an initial discriminant model. The network structure of the first N layers of the initial image encoding model is the same as the network structure of the first N layers of the initial discriminant model. The network structure of the initial image decoding model is opposite to the network structure of the initial image encoding model. For specific descriptions, please refer to the above embodiment; the image decoding model can be obtained by pre-training the initial image decoding model with a feature vector generated by a random number. Another optional structure of the corresponding face image processing device is as follows Fig.17 As shown, it may also include: a generating unit 700 and a determining unit 800 .

[0135] The generating unit 700 is used to generate a third feature vector according to the first random number. The form of the third feature vector can be set by the initial image decoding model. For example, if the feature vector input by the initial image decoding model is a 512*512 feature vector, a 512*512 feature vector needs to be generated according to the first random number as the third feature vector. The relationship between the random numbers in the third feature vector is not limited in this embodiment. For example, the first random number can be selected from 0 to 255, and a preset number of first random numbers in all the first random numbers constituting the first feature vector can be the same, for example, the value of the preset number of first random numbers is 0, and the preset number is not limited in this embodiment.

[0136] The decoding unit 400 is further configured to call the initial image decoding model to decode the third feature vector to obtain a third face image.

[0137] The discrimination unit 800 is used to call the initial discrimination model to discriminate the image quality of the third face image and the preset face image, and obtain a first discrimination result for the third face image and a second discrimination result for the preset face image. The preset face image has the same first image quality as the first face image.

[0138] If the preset face image and the first face image are both real high-definition face images, the initial discriminant model can be used to determine whether the third face image and the preset face image are both real high-definition face images, so that the trained image decoding model can output real high-definition face images with the help of the judgment of the initial discriminant model, and the initial discriminant model can be constrained by the preset face image, so that the initial discriminant model has high requirements for real high-definition face images.

[0139] Among them, the first discrimination result for the third face image is used to characterize whether the third face image has the first image quality. For example, the initial discrimination model output indicates the probability of whether the third face image has the first image quality. If the probability output by the initial discrimination model is greater than the preset threshold, the first discrimination result characterizes that the third face image has the first image quality; if the probability output by the initial discrimination model is less than or equal to the preset threshold, the first discrimination result characterizes that the third face image does not have the first image quality. The preset threshold is used as the threshold for determining whether the third face image has the first image quality. This embodiment does not limit the preset threshold. The second discrimination result for the preset face image is used to characterize whether the preset face image has the first image quality. For the description of the second discrimination result, please refer to the description of the first discrimination result, which will not be elaborated here.

[0140] The training unit 600 is also used to train the initial image decoding model based on the first discrimination result if it is determined according to the first discrimination result that the third facial image does not have the first image quality, and is also used to train the initial discrimination model based on the second discrimination result if it is determined according to the second discrimination result that the preset facial image does not have the first image quality. For the training process of the initial image decoding model and the initial discrimination model by the training unit 600, please refer to the above-mentioned method embodiment, which will not be repeated here.

[0141] By means of the above technical scheme, a third feature vector is generated according to a first random number, an initial image decoding model is called to decode the third feature vector to obtain a third face image, and an initial discrimination model is called to discriminate the image quality of the third face image and a preset face image to obtain a first discrimination result for the third face image and a second discrimination result for the preset face image, wherein the preset face image and the first face image have the same first image quality; if it is determined according to the first discrimination result that the third face image does not have the first image quality, the initial image decoding model is trained based on the first discrimination result; if it is determined according to the second discrimination result that the preset face image does not have the first image quality, the initial discrimination model is trained based on the second discrimination result, thereby obtaining an image decoding model in a face restoration model by training the initial image decoding model, so that the use of the face restoration model will not be restricted by the existing image decoding model.

[0142] The image decoding model can be obtained by training the initial image decoding model. Although the image quality of the third face image output by the initial image decoding model is judged by the initial discriminant model during the training process, the discrimination result of the initial discriminant model may be deceptive, so that the image quality of the face image output by the image decoding model is different from the first image quality. For this reason, the face restoration model training device provided in this embodiment can also adjust at least the model parameters of the image decoding model, and the process is as follows:

[0143] The acquisition unit 100 is also used to acquire a fourth facial image and a fifth facial image corresponding to the fourth facial image after completing the training of the initial image coding model, wherein the fourth facial image has the same second image quality as the second facial image, and the fifth facial image has the first image quality.

[0144] The encoding unit 300 is further configured to call the image encoding model to encode the fourth face image to obtain a fourth feature vector. For example, when the model parameters of the image encoding model are kept unchanged, the image encoding model is called to encode the fourth face image to obtain a fourth feature vector.

[0145] The decoding unit 400 is further configured to call the image decoding model to decode the fourth feature vector to obtain a sixth face image.

[0146] The discrimination unit 800 is also used to call the discrimination model obtained through the initial discrimination model training, to discriminate the image quality of the sixth face image and the preset face image, and obtain the third discrimination result for the sixth face image and the preset face image.

[0147] The training unit 600 is further configured to adjust at least the model parameters of the image decoding model and the discrimination model based on the third discrimination result and the difference information between the sixth face image and the fifth face image. The process of adjusting the model parameters of the image decoding model and the discrimination model based on the third discrimination result and the difference information between the sixth face image and the fifth face image is as follows:

[0148] If it is determined according to the third discrimination result that the sixth facial image does not have the first image quality, based on the third discrimination result and the difference information of the sixth facial image relative to the fifth and sixth facial images, the model parameters of the image decoding model are adjusted using a first adjustment step, and the first adjustment step is smaller than the adjustment step used when the initial image decoding model is trained; if it is determined according to the third discrimination result that the preset facial image does not have the first image quality, the model parameters of the discrimination model are adjusted using a second adjustment step, and the second adjustment step is smaller than the adjustment step used when the initial discrimination model is trained.

[0149] After completing the adjustment of the image decoding model and the discriminant model, the model parameters of the image encoding model, the image decoding model and the discriminant model can also be adjusted to jointly adjust the three models to improve the accuracy of the face restoration model. The adjustment process is as follows:

[0150] The acquisition unit 100 is further used to acquire a seventh face image with the second image quality and an eighth face image with the first image quality corresponding to the seventh face image after completing the adjustment of the image decoding model and the discrimination model.

[0151] The encoding unit 300 is further configured to call the image encoding model to encode the seventh face image to obtain a fifth feature vector.

[0152] The decoding unit 400 is further configured to call the adjusted image decoding model to decode the fifth eigenvector to obtain a ninth face image.

[0153] The discrimination unit 800 is further used to call the adjusted discrimination model to discriminate the image quality of the ninth face image and the preset face image, and obtain a fourth discrimination result for the ninth face image and the preset face image.

[0154] The training unit 600 is also used to readjust the model parameters of the adjusted image decoding model and the discrimination model and to adjust the model parameters of the image encoding model based on the fourth discrimination result and the difference information between the ninth face image and the eighth face image.

[0155] For instructions on adjusting the model parameters of the image encoding model, the image decoding model and the discriminant model, please refer to the above method embodiment, which will not be repeated here.

[0156] The present application also provides an electronic device, the electronic device comprising:

[0157] processor.

[0158] Memory used to store processor-executable instructions.

[0159] The processor is configured to execute instructions to implement the above-mentioned face image processing method.

[0160] An embodiment of the present application also provides a storage medium, in which instructions are stored. When the instructions in the storage medium are executed, the above-mentioned face image processing method is implemented.

[0161] It should be noted that the various embodiments in this specification can be described in a progressive manner, and the features recorded in the various embodiments in this specification can be replaced or combined with each other. Each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0162] Finally, it should be noted that, in this article, 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 presence of other identical elements in the process, method, article or device including the elements.

[0163] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

[0164] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A facial image processing method, characterized in that: The method comprises: Obtain the face image to be restored; Inputting the face image to be repaired into a face repair model, the face repair model comprising an image coding model and an image decoding model, the image coding model being obtained by training an initial image coding model in an initial face repair model based on difference information between a second feature vector corresponding to a second face image and a first feature vector corresponding to a first face image, wherein the second face image is obtained by reducing the image quality of the first face image; Calling the image coding model to encode the face image to be restored, and obtaining a feature vector corresponding to the face image to be restored; Calling the image decoding model to decode the feature vector to obtain a target face image corresponding to the face image to be repaired; The image coding model is trained to obtain an initial image coding model in the initial face restoration model based on difference information of a second feature vector corresponding to the second face image relative to a first feature vector corresponding to the first face image, comprising: Acquire a first face image, where the first face image is obtained after the image decoding model decodes the input first feature vector; Obtaining a second facial image by reducing the image quality of the first facial image; Under the condition that the model parameters of the image decoding model are maintained unchanged, the initial image encoding model is called to encode the second face image to obtain a second feature vector corresponding to the second face image; Based on difference information between the second feature vector and the first feature vector, the initial image coding model is trained to obtain the image coding model.

2. The method according to claim 1, characterized in that The initial face restoration model further includes an initial image decoding model and an initial discriminant model, the network structure of the first N layers of the initial image encoding model is the same as the network structure of the first N layers of the initial discriminant model, and the network structure of the initial image decoding model is opposite to that of the initial image encoding model; The image decoding model is obtained by pre-training an initial image decoding model with a feature vector generated by random numbers.

3. The method according to claim 2, characterized in that The process of pre-training the initial image decoding model with a feature vector generated by a random number includes: generating a third eigenvector according to the first random number; Calling the initial image decoding model to decode the third feature vector to obtain a third face image; Calling the initial discriminant model to discriminate the image quality of the third face image and the preset face image, obtaining a first discriminant result for the third face image and a second discriminant result for the preset face image, wherein the preset face image and the first face image have the same first image quality; If it is determined according to the first discrimination result that the third face image does not have the first image quality, training the initial image decoding model based on the first discrimination result; If it is determined according to the second discrimination result that the preset facial image does not have the first image quality, the initial discrimination model is trained based on the second discrimination result.

4. The method according to claim 1, characterized in that: Also includes: After completing the training of the initial image coding model, obtaining a fourth facial image and a fifth facial image corresponding to the fourth facial image, wherein the fourth facial image and the second facial image have the same second image quality, and the fifth facial image has the first image quality; Calling the image coding model to encode the fourth face image to obtain a fourth feature vector; Calling the image decoding model to decode the fourth feature vector to obtain a sixth face image; Calling the discriminant model obtained by training the initial discriminant model to discriminate the image quality of the sixth face image and the preset face image, and obtaining a third discrimination result for the sixth face image and the preset face image; Based on the third discrimination result and the difference information between the sixth facial image and the fifth facial image, at least model parameters of the image decoding model and the discrimination model are adjusted.

5. The method according to claim 4, characterized in that The calling the image coding model to encode the fourth face image to obtain a fourth feature vector comprises: calling the image coding model to encode the fourth face image to obtain a fourth feature vector while maintaining the model parameters of the image coding model unchanged; The adjusting of at least the model parameters of the image decoding model and the discrimination model based on the third discrimination result and the difference information between the sixth face image and the fifth face image comprises: If it is determined according to the third discrimination result that the sixth facial image does not have the first image quality, based on the third discrimination result and difference information between the sixth facial image and the fifth facial image, adjusting the image decoding model using a first adjustment step size, the first adjustment step size being smaller than an adjustment step size used when training the initial image decoding model; If it is determined according to the third discrimination result that the preset face image does not have the first image quality, the model parameters of the discrimination model are adjusted using a second adjustment step size, and the second adjustment step size is smaller than the adjustment step size used when training the initial discrimination model.

6. The method according to claim 5, characterized in that Also includes: After completing the adjustment of the image decoding model and the discrimination model, obtaining a seventh face image having the second image quality and an eighth face image corresponding to the seventh face image and having the first image quality; calling the image coding model to encode the seventh face image to obtain a fifth feature vector; Calling the adjusted image decoding model to decode the fifth feature vector to obtain a ninth face image; Calling the adjusted discrimination model to discriminate the image quality of the ninth face image and the preset face image, and obtaining a fourth discrimination result for the ninth face image and the preset face image; Based on the fourth discrimination result and the difference information between the ninth face image and the eighth face image, the model parameters of the adjusted image decoding model and discrimination model are adjusted again, and the model parameters of the image encoding model are adjusted.

7. A facial image processing device, characterized in that: The device comprises: An acquisition unit, used for acquiring a face image to be restored; an input unit, configured to input the face image to be restored into a face restoration model, wherein the face restoration model includes an image encoding model and an image decoding model, wherein the image encoding model is obtained by training an initial image encoding model in an initial face restoration model based on difference information between a second feature vector corresponding to a second face image and a first feature vector corresponding to a first face image, wherein the second face image is obtained by reducing the image quality of the first face image; An encoding unit, used for calling the image encoding model to encode the face image to be restored, and obtaining a feature vector corresponding to the face image to be restored; A decoding unit, used for calling the image decoding model to decode the feature vector to obtain a target face image corresponding to the face image to be repaired; The image coding model is trained to obtain an initial image coding model in the initial face restoration model based on difference information of a second feature vector corresponding to the second face image relative to a first feature vector corresponding to the first face image, comprising: Acquire a first face image, where the first face image is obtained after the image decoding model decodes the input first feature vector; Obtaining a second facial image by reducing the image quality of the first facial image; Under the condition that the model parameters of the image decoding model are maintained unchanged, the initial image encoding model is called to encode the second face image to obtain a second feature vector corresponding to the second face image; Based on difference information between the second feature vector and the first feature vector, the initial image coding model is trained to obtain the image coding model.

8. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the facial image processing method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium stores instructions, and when the instructions in the storage medium are executed, the face image processing method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method for repairing face defect images based on auto-encoder and generative adversarial networks

    CN108520503A

  • Rendering model training method, system and device, medium and rendering method

    CN108960425A

  • Image inpainting method and system based on antagonistic generation neural network

    CN109191402A

  • A face image restoration method and device based on VAE-GAN and similar block search

    CN109903236A

  • Method and device for generating face image

    CN111523413A