A face restoration model training method and device

The quality of the high-definition face images output by the image decoding model is reduced, and the image coding model is used for coding training to form an image coding model, which solves the problem of the limited application scope of the image decoding model in the field of face restoration and achieves high-quality face images. Repair effect.

CN112102194BActive Publication Date: 2024-08-23BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010969607.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-15
Publication Date
2024-08-23
Estimated Expiration
2040-09-15

AI Technical Summary

Technical Problem

In the existing technology, the image decoding model has achieved remarkable results in the direction of face generation, but its application scope in the field of face restoration is limited and it is difficult to be close to face generation.

Method used

By obtaining the high-definition face image output by the image decoding model, reducing its image quality, using the image encoding model to encode the low-quality image, and training the initial image encoding model based on the difference information to form an image encoding model, thereby achieving face restoration.

Benefits of technology

It expands the application scope of the image decoding model, improves the face repair effect, enables the image decoding model to output high-quality face images, and realizes the repair of low-quality face images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112102194B
    Figure CN112102194B
Patent Text Reader

Abstract

The present application provides a face restoration model training method and device, which obtain a first face image, which is obtained after an image decoding model decodes an input first feature vector; obtains a second face image by reducing the image quality of the first face image; calls an initial image coding model to encode the second face image to obtain a second feature vector corresponding to the second face image; trains the initial image coding model based on difference information of the second feature vector relative to the first feature vector to obtain an image coding model, thereby allowing the image coding model to access a face image with lower image quality, provide feature vectors to an image decoding model, and output a face image with improved image quality from the image decoding model, so as to apply the current image decoding model with significant effects to the face restoration model, thereby improving the face restoration 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 model technology, and in particular, relates to a method and device for training a face restoration model. 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 generation 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 face restoration training method and device, which are used to improve the face restoration effect while expanding the application scope of the image decoding model.

[0004] On the one hand, the present application provides a face restoration model training method, the face restoration model includes an image encoding model and an image decoding model, and the method includes:

[0005] Acquire a first face image, where the first face image is obtained after the image decoding model decodes the input first feature vector;

[0006] Obtaining a second facial image by reducing the image quality of the first facial image;

[0007] Calling the initial image coding model to encode the second facial image to obtain a second feature vector corresponding to the second facial image;

[0008] 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.

[0009] Optionally, the image decoding model is obtained by pre-training an initial image decoding model with a feature vector generated by random numbers.

[0010] Optionally, the process of pre-training the initial image decoding model with a feature vector generated by a random number includes:

[0011] generating a third eigenvector according to the first random number;

[0012] Calling the initial image decoding model to decode the third feature vector to obtain a third face image;

[0013] Calling an 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;

[0014] 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;

[0015] 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.

[0016] Optionally, also include:

[0017] 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;

[0018] Calling the image coding model to encode the fourth face image to obtain a fourth feature vector;

[0019] Calling the image decoding model to decode the fourth feature vector to obtain a sixth face image;

[0020] 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;

[0021] 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.

[0022] Optionally, calling the image coding model to encode the fourth face image to obtain a fourth feature vector includes: calling the image coding model to encode the fourth face image to obtain a fourth feature vector while maintaining model parameters of the image coding model unchanged;

[0023] 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:

[0024] 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 model parameters of the image decoding model using a first adjustment step size, the first adjustment step size being smaller than the adjustment step size used when training the initial image decoding model;

[0025] 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.

[0026] Optionally, also include:

[0027] 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;

[0028] Calling the image coding model to encode the seventh face image to obtain a fifth feature vector;

[0029] Calling the adjusted image decoding model to decode the fifth feature vector to obtain a ninth face image;

[0030] 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;

[0031] 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.

[0032] On the other hand, the present application also provides a face restoration model training device, the face restoration model includes an image encoding model and an image decoding model, and the device includes:

[0033] An acquisition unit, configured to acquire a first face image, wherein the first face image is obtained after the image decoding model decodes the input first feature vector;

[0034] An image processing unit, configured to obtain a second face image by reducing the image quality of the first face image;

[0035] an encoding unit, configured to call an initial image encoding model to encode the second facial image to obtain a second feature vector corresponding to the second facial image;

[0036] A training unit is used to train the initial image coding model based on difference information between the second feature vector and the first feature vector to obtain the image coding model.

[0037] Optionally, the image decoding model is obtained by pre-training an initial image decoding model with a feature vector generated by a random number;

[0038] The device also includes:

[0039] A generating unit, configured to generate a third feature vector according to the first random number;

[0040] A decoding unit, used for calling the initial image decoding model to decode the third feature vector to obtain a third face image;

[0041] a discriminant unit, configured to call an initial discriminant model, discriminate the image quality of the third face image and the preset face image, obtain 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;

[0042] The training unit 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.

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

[0044] processor;

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

[0046] Wherein, the processor is configured to execute the instructions to implement the above-mentioned face restoration model training method.

[0047] On the other hand, 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 restoration model training method is implemented.

[0048] The above-mentioned face restoration model training method and device obtain a first face image, which is obtained after the image decoding model decodes the input first feature vector; obtains a second face image by reducing the image quality of the first face image; calls the initial image coding model to encode the second face image to obtain a second feature vector corresponding to the second face image; and trains the initial image coding model based on the difference information of the second feature vector relative to the first feature vector to obtain an image coding model.

[0049] 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

[0050] 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.

[0051] Figure 1 is a flow chart of a face restoration model training method provided in an embodiment of the present application;

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

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

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

[0055] Figure 5 is a flowchart of another face restoration model training method provided in an embodiment of the present application;

[0056] Figure 6 is a schematic diagram of adjusting an image decoding model and a discrimination model provided in an embodiment of the present application;

[0057] Figure 7 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;

[0058] Figure 8 is a flowchart of another face restoration model training method provided in an embodiment of the present application;

[0059] Fig. 9 is a schematic diagram of the restoration effect of the trained face restoration model provided in an embodiment of the present application;

[0060] Fig.10 It is a structural schematic diagram of a face restoration model training device provided in an embodiment of the present application;

[0061] Fig.11 It is a structural schematic diagram of another face restoration model training device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0062] 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.

[0063] See also Figure 1 , which shows a flow chart of a face restoration model training method provided by an embodiment of the present application, wherein the face restoration model includes an image encoding model and an image decoding model, so as to restore the face image through the image encoding model and the image decoding model, Figure 1 The face restoration model training method shown may include the following steps:

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

[0065] 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.

[0066] 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.

[0067] 102: 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.

[0068] 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.

[0069] 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.

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

[0071] 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.

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

[0073] 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.

[0074] 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.

[0075] 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.

[0076] 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.

[0077] 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.

[0078] 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.

[0079] Based on the above Figure 1 The training method of the face restoration model shown in FIG. 1 shows that the idea of ​​obtaining the image encoding model in the face restoration model is as follows: Figure 2 As shown, when the image decoding model in the face restoration model is obtained 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.

[0080] 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.

[0081] 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.

[0082] In this embodiment, the image decoding model in the face restoration model can adopt a model that is currently capable of outputting high-definition face images, such as the image decoding model can adopt a StyleGan network model. Of course, the image decoding model in the face restoration model may also be different from the model that is currently capable of outputting high-definition face images, such as a customized initial image decoding model, which is obtained by pre-training the initial image decoding model with a feature vector generated by random numbers.

[0083] The initial image decoding model is pre-trained with a feature vector generated by random numbers, such as Figure 3 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 4 As shown, the following steps may be included:

[0084] 201: 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.

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

[0086] 203: 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.

[0087] 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.

[0088] 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.

[0089] 204: 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.

[0090] 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.

[0091] 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.

[0092] 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.

[0093] 205: 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.

[0094] 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.

[0095] 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.

[0096] 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.

[0097] 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.

[0098] 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.

[0099] 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: Figure 5 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:

[0100] 105: 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.

[0101] 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.

[0102] 106: Calling the image coding model to encode the fourth face image to obtain a fourth feature vector.

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

[0104] 108: calling the discriminant model obtained by training the initial discriminant model, discriminating 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.

[0105] 109: 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.

[0106] 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.

[0107] 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.

[0108] 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:

[0109] 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.

[0110] 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.

[0111] 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.

[0112] 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.

[0113] 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.

[0114] The schematic diagram of adjusting the model parameters of the image decoding model and the discriminant model is as follows: Figure 6 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.

[0115] 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. Figure 7The corresponding flow chart is shown in Figure 8 As shown, the following steps may be included:

[0116] 110: 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.

[0117] 111: Calling the image coding model to encode the seventh face image to obtain the fifth eigenvector.

[0118] 112: calling the adjusted image decoding model to decode the fifth eigenvector to obtain a ninth face image.

[0119] 113: 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.

[0120] 114: 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.

[0121] 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.

[0122] 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. 9 As shown, it shows the restoration effect of the face restoration model provided by this embodiment, which can complete a good restoration of a low-definition face image.

[0123] Corresponding to the above method embodiment, the embodiment of the present application also provides a face restoration model training device, the face restoration model includes an image encoding model and an image decoding model, an optional structure of the face restoration model training device is as follows Fig.10 As shown, it may include: an acquisition unit 100, an image processing unit 200, an encoding unit 300 and a training unit 400.

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

[0125] 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.

[0126] 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.

[0127] The image processing unit 200 is used to 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 that of the first facial 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 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 400 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.

[0134] 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.

[0135] In this embodiment, the image decoding model is 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 restoration model training device is as follows: Fig.11 As shown, it may also include: a generating unit 500, a decoding unit 600 and a determining unit 700.

[0136] The generating unit 500 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.

[0137] The decoding unit 600 is used to call the initial image decoding model to decode the third feature vector to obtain a third face image.

[0138] The discrimination unit 700 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.

[0139] 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.

[0140] 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.

[0141] The training unit 400 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 400, please refer to the above-mentioned method embodiment, which will not be repeated here.

[0142] 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.

[0143] 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:

[0144] 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.

[0145] The encoding unit 200 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.

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

[0147] The discrimination unit 700 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.

[0148] The training unit 400 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:

[0149] 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.

[0150] 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:

[0151] 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.

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

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

[0154] The discrimination unit 700 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.

[0155] The training unit 400 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.

[0156] 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.

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

[0158] processor.

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

[0160] Among them, the processor is configured to execute instructions to implement the above-mentioned face restoration model training method.

[0161] The 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 restoration model training method is implemented.

[0162] 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.

[0163] 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.

[0164] 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.

[0165] 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 face restoration model training method, characterized in that: The face restoration model includes an image encoding model and an image decoding model, and the method includes: 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; Calling the initial image coding model to encode the second facial image to obtain a second feature vector corresponding to the second facial image; Based on difference information between the second feature vector and the first feature vector, training the initial image coding model to obtain the image coding model; The image decoding model is obtained by pre-training an initial image decoding model with a feature vector generated by a random number; 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 an 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.

2. 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.

3. The method according to claim 2, 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 model parameters of the image decoding model using a first adjustment step size, the first adjustment step size being smaller than the 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.

4. The method according to claim 3, 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.

5. A face restoration model training device, characterized in that: The face restoration model includes an image encoding model and an image decoding model, and the device includes: An acquisition unit, configured to acquire a first face image, wherein the first face image is obtained after the image decoding model decodes the input first feature vector; An image processing unit, configured to obtain a second face image by reducing the image quality of the first face image; an encoding unit, configured to call an initial image encoding model to encode the second facial image to obtain a second feature vector corresponding to the second facial image; a training unit, configured to train the initial image coding model based on difference information between the second feature vector and the first feature vector to obtain the image coding model; The image decoding model is obtained by pre-training an initial image decoding model with a feature vector generated by a random number; The device also includes: A generating unit, configured to generate a third feature vector according to the first random number; A decoding unit, used for calling the initial image decoding model to decode the third feature vector to obtain a third face image; a discriminant unit, configured to call an initial discriminant model, discriminate the image quality of the third face image and the preset face image, obtain 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; The training unit 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.

6. 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 face restoration model training method as described in any one of claims 1 to 4.

7. A storage medium, characterized in that: The storage medium stores instructions, and when the instructions in the storage medium are executed, the face restoration model training method according to any one of claims 1 to 4 is implemented.