Face blind restoration method and device, equipment and medium
By combining the diffusion model, high-dimensional manifold mapping and large model fine-tuning technology, the problem of complex degradation patterns and occlusion scenes in blind face restoration is solved, and the restoration and detail processing of high-quality face images are achieved.
Patent Information
- Application Number
- CN202410522635.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2024-08-23
AI Technical Summary
Existing face blind restoration technology is difficult to deal with complex degradation patterns such as blur, low resolution, noise and JPEG compression in low-quality face images, especially in occlusion and non-mathematically simulated degradation scenes.
Using a method that combines the first-order diffusion model and the second-order diffusion model, through high-dimensional manifold mapping, feature compression and illusion correction, the model parameters are gradually optimized to restore high-quality face images, and the loss function is used to iteratively optimize the model to achieve the preset Convergence conditions.
Effectively restore high-resolution facial texture details, filter degradation patterns and handle complex occlusion and semantic missing scenes, significantly improving the quality and effect of blind face restoration.
Smart Images

Figure CN118537265A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning technology, and in particular to a method, device, equipment and medium for repairing blind faces. Background Art
[0002] Blind face restoration technology needs to resist many unknown and complex image degradation patterns and generate clear and high-quality restoration images. Traditional face restoration technology mainly targets face images in weakly degraded scenes. However, with the improvement of large model fine-tuning technology, face restoration technology in strongly degraded scenes has received widespread attention.
[0003] The main difficulties of face blindness repair technology are:
[0004] 1. The low-quality faces and high-quality faces in the database are generally not matched, making it difficult to conduct paired data training.
[0005] Second, low-quality faces may contain multiple random combinations of degradation patterns such as blur, low resolution, noise, and JPEG (Joint Photographic Experts Group) compression. This uncertainty greatly increases the difficulty of face restoration.
[0006] 3. Blind face restoration has poor effect in the face of occlusion and degraded scenes that cannot be simulated mathematically. Summary of the invention
[0007] The present invention provides a method, device, equipment and medium for blind face restoration, which are used to solve the defects of the blind face restoration analysis method in the prior art.
[0008] The present invention provides a method for repairing face blindness, the method comprising:
[0009] Obtain a low-quality face image to be repaired;
[0010] Inputting the low-quality face image to be repaired into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model;
[0011] Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
[0012] According to a method for face blindness restoration provided by the present invention, the target face blindness restoration model is trained in the following way:
[0013] Inputting the low-quality face training image into the first-order diffusion model to obtain an initial face restoration image;
[0014] Performing high-dimensional manifold mapping on the initial face restoration image to obtain high-dimensional features;
[0015] Based on the information bottleneck, feature compression is performed on the high-dimensional feature to obtain a compressed feature;
[0016] Performing hallucination correction on the compressed features based on the identity information of the initial face restoration image to obtain hallucination correction features;
[0017] Inputting the hallucination correction feature into the second-order diffusion model to obtain a high-quality face prediction image;
[0018] Obtaining a loss function between the low-quality face training image and the high-quality face prediction image;
[0019] The model parameters are iteratively optimized based on the loss function until a preset convergence condition is reached to obtain a target face blind restoration model.
[0020] According to a blind face restoration method provided by the present invention, the step of obtaining a loss function between the low-quality face training image and the high-quality face prediction image includes:
[0021] Based on the high-quality face training image and the initial face restoration image, obtaining a first diffusion loss function of the first-order diffusion model;
[0022] Based on the high-quality face training image and the high-quality face prediction image, obtaining a second diffusion loss function of the second-order diffusion model;
[0023] Based on the high-quality face training image and the hallucination correction feature, a third loss function is obtained;
[0024] Based on the initial face restoration image and the hallucination correction manifold, obtaining a fourth loss function;
[0025] Based on the first diffusion loss function, the second diffusion loss function, the third loss function and the fourth loss function, a loss function between the low-quality face training image and the high-quality face prediction image is obtained.
[0026] According to a method for blind face restoration provided by the present invention, the low-quality face training image matched with the high-quality face training image is obtained by the following method:
[0027] Performing image blur processing on the high-quality face training image to obtain a first blurred image;
[0028] Down-sampling, Gaussian noise addition, and compression are sequentially performed on the first blurred image to obtain a second blurred image;
[0029] The second blurred image is upsampled to a resolution equal to that of the high-quality face training image to obtain a low-quality face training image that matches the high-quality face training image.
[0030] According to a method for blind face restoration provided by the present invention, before blurring the high-quality face training image, the method further comprises:
[0031] An original high-quality face image is obtained, and face detection, cropping and alignment processing are performed on the original high-quality face image to obtain a high-quality face training image.
[0032] According to a method for blind face restoration provided by the present invention, the image blurring process is performed on the high-quality face training image, comprising:
[0033] Performing Gaussian blur processing on the high-quality face training image; or,
[0034] Perform motion blur processing on the high-quality face training image.
[0035] The present invention also provides a face blindness repair device, the device comprising:
[0036] A first face restoration module, used to obtain a low-quality face image to be restored;
[0037] A second face restoration module is used to input the low-quality face image to be restored into a target face blind restoration model to obtain a high-quality face image output by the target face blind restoration model;
[0038] Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
[0039] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a method for repairing blind faces as described above is implemented.
[0040] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for repairing face blindness as described in any one of the above is implemented.
[0041] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned face blindness repair methods.
[0042] The face blind restoration method, device, equipment and medium provided by the present invention obtain a low-quality face image to be restored; input the low-quality face image to be restored into a target face blind restoration model to obtain a high-quality face image output by the target face blind restoration model; wherein the target face blind restoration model is a low-quality face training image that matches a high-quality face training image with a high-quality face training image, first undergoes a first restoration, high-dimensional manifold mapping, feature compression and hallucination correction in sequence through a first-order diffusion model, and then undergoes a second restoration through a second-order diffusion model to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the parameters of the second-order diffusion model are iteratively optimized until a preset convergence condition is reached. The present invention realizes a face blind restoration method that can effectively restore high-resolution face texture details, filter degradation patterns and handle complex occlusion and semantic loss scenes by combining diffusion models, high-dimensional manifold mapping and large model fine-tuning technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 It is a flow chart of the face blindness repair method provided by the present invention;
[0045] Figure 2 It is a structural schematic diagram of the face blindness repair device provided by the present invention;
[0046] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] The invention provides a method for repairing blind faces. Figure 1 : is a flow chart of the face blindness repair method provided by the present invention, such as Figure 1 As shown, the method includes:
[0049] Step 110, obtaining a low-quality face image to be repaired;
[0050] Here, the low-quality face images to be repaired refer to those face images whose quality has been degraded due to various reasons (such as poor shooting conditions, loss during image transmission, compression of image storage format, etc.). These images may have quality problems such as blur, high noise, low resolution, color distortion, and loss of details.
[0051] The goal of repairing low-quality facial images is to restore or improve the quality of the image through image processing techniques, such as blind repair models, so that it is closer to or reaches the standard of high-quality facial images.
[0052] Step 120, inputting the low-quality face image to be repaired into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model;
[0053] Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
[0054] It should be noted that the diffusion model is a probabilistic model based on Markov chains. The core idea is to gradually introduce noise to disturb the original data, and then learn how to reverse this diffusion process to recover the required data samples from the noise. The essence of this process is that the model gradually learns how to generate images that are closer and closer to the real data given the noisy input through multiple iterations over a period of time.
[0055] The working mechanism of the diffusion model is based on learning the information decay pattern caused by noise. By gradually adding noise, the model is able to capture how the data changes under the influence of noise and use these learned patterns to generate new images. The same principle applies to the treatment of latent variables, because the diffusion model tries to learn the distribution of noise rather than the direct distribution of data. This noise distribution is modeled through the concept of Markov chains, which gives the diffusion model a probabilistic nature.
[0056] Here, the first-order diffusion model and the second-order diffusion model are two different diffusion models defined according to the complexity of the model. The first-order diffusion model is used to describe relatively simple diffusion phenomena. Its structure is relatively direct and suitable for basic application scenarios. The second-order diffusion model is an extension and deepening of the first-order model, which is used to deal with more complex and sophisticated diffusion processes. Further fine-tuning the first-order diffusion model to obtain a second-order diffusion model usually involves fine-tuning the model parameters or structure to further improve the model's expressiveness and generation quality. In other words, the second-order diffusion model is a diffusion model obtained by fine-tuning the first-order diffusion model.
[0057] In this embodiment, the low-quality face image is initially repaired by the first-order diffusion model to reduce adverse effects such as noise and blur. The initially repaired image data is then mapped to a high-dimensional manifold to better capture the intrinsic structure and relationship between the data. Feature compression is then used to reduce the dimension and complexity of the data, and hallucination correction is used as the repair information compensation. After the above processing, the second-order diffusion model is used for further repair to obtain a high-quality face prediction image.
[0058] Based on the loss function between low-quality face training images and high-quality face prediction images, the model parameters are iteratively optimized. The loss function measures the difference between the predicted image and the real high-quality image, and the optimization goal is to minimize this difference. Through iterative optimization, the target face blind restoration model can gradually learn how to restore high-quality face images from low-quality images. When the preset convergence condition is reached, the training of the target face blind restoration model is completed.
[0059] Once the model training is completed, the low-quality face image to be repaired can be input into the target face blind repair model. It can be understood here that when the low-quality face image to be repaired is input into the target face blind repair model, the low-quality face image to be repaired first passes through the first-order diffusion model for the first repair, high-dimensional manifold mapping, feature compression and hallucination correction, and then passes through the second-order diffusion model for the second repair, and a repaired high-quality face image is obtained.
[0060] In this embodiment, a low-quality face image to be repaired is obtained; the low-quality face image to be repaired is input into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model; wherein the target face blind repair model is a low-quality face training image that matches a high-quality face training image with a high-quality face training image, which is first repaired by a first-order diffusion model, high-dimensional manifold mapping, feature compression and hallucination correction, and then repaired by a second-order diffusion model to obtain a high-quality face prediction image; the parameters of the second-order diffusion model are iteratively optimized based on the loss function between the low-quality face training image and the high-quality face prediction image until the preset convergence condition is reached. The present invention combines diffusion model, high-dimensional manifold mapping and large model fine-tuning techniques to achieve a face blind repair method that can effectively restore high-resolution face texture details, filter degradation patterns and handle complex occlusion and semantic loss scenes.
[0061] Based on the above embodiments, the target face blindness restoration model is trained in the following way:
[0062] Inputting the low-quality face training image into the first-order diffusion model to obtain an initial face restoration image;
[0063] Performing high-dimensional manifold mapping on the initial face restoration image to obtain high-dimensional features;
[0064] Based on the information bottleneck, feature compression is performed on the high-dimensional feature to obtain a compressed feature;
[0065] Performing hallucination correction on the compressed features based on the identity information of the initial face restoration image to obtain hallucination correction features;
[0066] Inputting the hallucination correction feature into the second-order diffusion model to obtain a high-quality face prediction image;
[0067] Obtaining a loss function between the low-quality face training image and the high-quality face prediction image;
[0068] The model parameters are iteratively optimized based on the loss function until a preset convergence condition is reached to obtain a target face blind restoration model.
[0069] In this embodiment, the low-quality face training image is first input into the first-order diffusion model to obtain the initial face restoration image, and then the initial face restoration image is mapped from the original space to a high-dimensional manifold. The obtained high-dimensional features are actually a high-dimensional representation of the initial face restoration image. This representation method can better capture the global and local features of the data and provide a basis for subsequent data analysis and processing.
[0070] Here, the core idea of the information bottleneck theory is to reduce the redundancy of data while maintaining sufficient information. In this embodiment, during the feature compression of high-dimensional features based on the information bottleneck, noise and other unimportant information will be filtered out, leaving only the features that are critical to image restoration.
[0071] On the basis of the compressed features, the identity information of the initial face restoration image obtained by injecting the first-order diffusion model is used as restoration information compensation to perform hallucination correction and obtain the hallucination correction manifold.
[0072] Here, identity information may refer to some key features of the face, such as the shape of the facial features, skin texture, etc. By injecting this information, the image can be restored more accurately and avoid hallucination effects that are inconsistent with the original image.
[0073] In image restoration tasks, especially when the restoration area is large or severely damaged, the generated restoration results may contain some "hallucination" elements that do not conform to the original image content. These hallucinations may be caused by the introduction of inappropriate information or over-generalization by the model during the restoration process. Hallucination correction is a technique used to identify and correct these unrealistic elements to improve the visual quality and authenticity of the restoration results.
[0074] Finally, the hallucination correction features are input into the second-order diffusion model to obtain a high-quality face prediction image. Using the loss function between the high-quality face training image and the high-quality face prediction image, the parameters in the model are adjusted through gradient back propagation, and the above training process is iterated until convergence to obtain a trained target face blind restoration model.
[0075] In this embodiment, by combining diffusion models, high-dimensional manifold mapping, and large model fine-tuning techniques, a face blind restoration method is implemented that can effectively restore high-resolution facial texture details, filter degradation patterns, and handle complex occlusion and semantic missing scenes.
[0076] Based on the above embodiment, the step of obtaining the loss function from the low-quality face training image to the high-quality face prediction image includes:
[0077] Based on the high-quality face training image and the initial face restoration image, obtaining a first diffusion loss function of the first-order diffusion model;
[0078] Based on the high-quality face training image and the high-quality face prediction image, obtaining a second diffusion loss function of the second-order diffusion model;
[0079] Based on the high-quality face training image and the hallucination correction feature, a third loss function is obtained;
[0080] Based on the initial face restoration image and the hallucination correction manifold, obtaining a fourth loss function;
[0081] Based on the first diffusion loss function, the second diffusion loss function, the third loss function and the fourth loss function, a loss function between the low-quality face training image and the high-quality face prediction image is obtained.
[0082] In this embodiment, the loss function used for gradient back propagation includes four parts: the first part is the first diffusion loss function between the initial face restoration image obtained by the first-order diffusion model and the high-quality face training image matched with the input low-quality face training image; the second part is the second diffusion loss function between the high-quality face prediction image obtained by the second-order diffusion model and the high-quality face training image matched with the input low-quality face training image; the third part is the third loss function at the pixel level between the illusion correction feature obtained by the illusion correction and the high-quality face training image matched with the input low-quality face training image; the fourth part is the fourth loss function of compressed sensing between the illusion correction feature obtained by the illusion correction and the initial face restoration image obtained by the first-order diffusion model.
[0083] Specifically, based on the above first diffusion loss function, the second diffusion loss function, the third diffusion loss function and the fourth diffusion loss function, the loss function L between the low-quality face training image and the high-quality face prediction image is obtained. loss as follows:
[0084]
[0085] Among them, the first diffusion loss function It is obtained by the following formula:
[0086]
[0087] Among them, the second diffusion loss function It is obtained by the following formula:
[0088]
[0089] Among them, the third loss function L rec It is obtained by the following formula:
[0090] L rec =E[||M(X HQ )-Z||2];
[0091] Among them, the fourth loss function L ib It is obtained by the following formula:
[0092] L ib =I[M(X D1 )-Z];
[0093] Here, X HQ A high-quality face training image that matches the input low-quality face training image; X D1 is the initial face restoration image obtained by the first-order diffusion model; X D2 is the high-quality face prediction image obtained by the second-order diffusion model; E(.) is the expectation; ||.||2 is the l2 norm of the matrix; ε(x) represents the predicted noise diffusion image; Z is the hallucination correction feature obtained by hallucination correction; M(x) is the high-dimensional feature manifold obtained after decoding; I is the mutual information extractor of the feature; λ ib is the weight of the loss.
[0094] In this embodiment, the loss functions of the above four parts are used to achieve precise tuning of the model, thereby ensuring that the subsequent face blindness repair can effectively restore high-resolution facial texture details, filter degradation patterns, and handle complex occlusion and semantic missing scenes.
[0095] Based on the above embodiment, the low-quality face training image matched with the high-quality face training image is obtained by:
[0096] Performing image blur processing on the high-quality face training image to obtain a first blurred image;
[0097] Down-sampling, Gaussian noise addition, and compression are sequentially performed on the first blurred image to obtain a second blurred image;
[0098] The second blurred image is upsampled to a resolution equal to that of the high-quality face training image to obtain a low-quality face training image that matches the high-quality face training image.
[0099] In this embodiment, the high-quality face training image can be first subjected to image blurring, and then the first blurred image can be downsampled at a random rate in sequence to reduce the resolution of the image. Add random noise with Gaussian distribution to the downsampled image. Use the JPEG algorithm to add JPEG compression with a random compression rate to the image after Gaussian noise is added to obtain a second blurred image. Finally, the second blurred image is re-enlarged to the resolution of the high-quality face training image, and a low-quality face training image that can be used for model training can be obtained.
[0100] Before the high-quality face training image is subjected to image blurring processing, the method further includes obtaining an original high-quality face image, performing face detection, cropping and alignment processing on the original high-quality face image, and obtaining a high-quality face training image.
[0101] In this embodiment, after the original high-quality face image is collected, the face part can be cropped from the original high-quality face image according to the face position detected in the original high-quality face image, and the background or other irrelevant content can be removed. Then, the cropped face images are aligned to ensure that the cropped face images are at the same angle and position, thereby constructing a high-quality face training image.
[0102] The image blurring process is performed on the high-quality face training image, including: performing Gaussian blurring process on the high-quality face training image; or performing motion blurring process on the high-quality face training image.
[0103] Here, Gaussian blur refers to blurring an image using a Gaussian filter to simulate the blurring effect caused by lens defocus or depth of field. Motion blur refers to the blurring effect caused by the movement of the simulated camera during shooting. In this embodiment, the high-quality face training image can be blurred by the above two blurring methods.
[0104] In this embodiment, a series of low-quality face training images with different degradation levels and types are generated in the above manner. These images can be used as training data for training the model, so that the model can learn to restore high-quality face images from low-quality images.
[0105] Based on any of the above embodiments, the present invention further provides a face blindness restoration device that fuses feature trajectories. Figure 2 : is a schematic diagram of the structure of the face blindness repair device provided by the present invention, such as Figure 2 As shown, the device comprises:
[0106] A first face restoration module 210, used to obtain a low-quality face image to be restored;
[0107] The second face restoration module 220 is used to input the low-quality face image to be restored into a target face blind restoration model to obtain a high-quality face image output by the target face blind restoration model;
[0108] Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
[0109] The device provided by the embodiment of the present invention obtains a low-quality face image to be repaired; inputs the low-quality face image to be repaired into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model; wherein the target face blind repair model is a low-quality face training image that matches a high-quality face training image with a high-quality face training image, first undergoes a first-order diffusion model for the first repair, high-dimensional manifold mapping, feature compression and hallucination correction, and then undergoes a second-order diffusion model for the second repair to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the parameters of the second-order diffusion model are iteratively optimized until the preset convergence condition is reached. The present invention realizes a face blind repair method that can effectively restore high-resolution face texture details, filter degradation patterns, and handle complex occlusion and semantic loss scenes by combining diffusion models, high-dimensional manifold mapping, and large model fine-tuning technologies.
[0110] The device for blind face restoration by fusing feature trajectories described in this embodiment and the method for blind face restoration provided by the present invention described above can refer to each other, and will not be described in detail here.
[0111] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the face blindness repair method, which includes:
[0112] Obtain a low-quality face image to be repaired;
[0113] Inputting the low-quality face image to be repaired into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model;
[0114] Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
[0115] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0116] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the face blindness repair method provided by the above methods, the method comprising:
[0117] Obtain a low-quality face image to be repaired;
[0118] Inputting the low-quality face image to be repaired into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model;
[0119] Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
[0120] On the other hand, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the face blindness restoration method provided by the above methods, the method comprising:
[0121] Obtain a low-quality face image to be repaired;
[0122] Inputting the low-quality face image to be repaired into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model;
[0123] Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
[0124] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0125] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for repairing face blindness, characterized in that: The method comprises: Obtain a low-quality face image to be repaired; Inputting the low-quality face image to be repaired into a target face blind repair model to obtain a high-quality face image output by the target face blind repair model; Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
2. The method for face blindness repair according to claim 1, characterized in that: The target face blindness restoration model is trained in the following way: Inputting the low-quality face training image into the first-order diffusion model to obtain an initial face restoration image; Performing high-dimensional manifold mapping on the initial face restoration image to obtain high-dimensional features; Based on the information bottleneck, feature compression is performed on the high-dimensional feature to obtain a compressed feature; Performing hallucination correction on the compressed features based on the identity information of the initial face restoration image to obtain hallucination correction features; Inputting the hallucination correction feature into the second-order diffusion model to obtain a high-quality face prediction image; Obtaining a loss function between the low-quality face training image and the high-quality face prediction image; The model parameters are iteratively optimized based on the loss function until a preset convergence condition is reached to obtain a target face blind restoration model.
3. The method for face blindness repair according to claim 2, characterized in that: The acquiring of the loss function between the low-quality face training image and the high-quality face prediction image comprises: Based on the high-quality face training image and the initial face restoration image, obtaining a first diffusion loss function of the first-order diffusion model; Based on the high-quality face training image and the high-quality face prediction image, obtaining a second diffusion loss function of the second-order diffusion model; Based on the high-quality face training image and the hallucination correction feature, a third loss function is obtained; Based on the initial face restoration image and the hallucination correction manifold, obtaining a fourth loss function; Based on the first diffusion loss function, the second diffusion loss function, the third loss function and the fourth loss function, a loss function between the low-quality face training image and the high-quality face prediction image is obtained.
4. The method for face blindness restoration according to any one of claims 1 to 3, characterized in that: The low-quality face training image matched with the high-quality face training image is obtained in the following manner: Performing image blur processing on the high-quality face training image to obtain a first blurred image; Down-sampling, Gaussian noise addition, and compression are sequentially performed on the first blurred image to obtain a second blurred image; The second blurred image is upsampled to a resolution equal to that of the high-quality face training image to obtain a low-quality face training image that matches the high-quality face training image.
5. The method for face blindness repair according to claim 4, characterized in that: Before the image blurring process is performed on the high-quality face training image, the method further includes: An original high-quality face image is obtained, and face detection, cropping and alignment processing are performed on the original high-quality face image to obtain a high-quality face training image.
6. The method for face blindness repair according to claim 4, characterized in that: The performing image blurring processing on the high-quality face training image comprises: Performing Gaussian blur processing on the high-quality face training image; or, Perform motion blur processing on the high-quality face training image.
7. A face blindness repair device, characterized in that: The device comprises: A first face restoration module, used to obtain a low-quality face image to be restored; A second face restoration module is used to input the low-quality face image to be restored into a target face blind restoration model to obtain a high-quality face image output by the target face blind restoration model; Among them, the target face blind restoration model is obtained by passing a high-quality face training image and a low-quality face training image that matches the high-quality face training image, first through a first-order diffusion model for the first restoration, high-dimensional manifold mapping, feature compression and hallucination correction, and then through a second-order diffusion model for the second restoration to obtain a high-quality face prediction image; based on the loss function between the low-quality face training image and the high-quality face prediction image, the model parameters are iteratively optimized until the preset convergence conditions are reached.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for blind face repair as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for blind face repair as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for blind face repair as described in any one of claims 1 to 6 is implemented.
Citation Information
Cited By
High-quality face restoration method and device, equipment and storage medium
CN118710559A
High-quality face restoration method, device, equipment, and storage medium
CN118710559B
