Image Restoration Method Based on High-Order Gradient Constraint and Diffusion Generation Model
By introducing a high-order gradient restoration module and an image restoration method that corrects the LogCosh loss function, the problem of structure and detail retention in image restoration is solved, image quality and model adaptability are improved, and it is suitable for a variety of image restoration tasks.
Patent Information
- Application Number
- CN202411609721.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2044-11-12
AI Technical Summary
The existing image restoration algorithms are not effective when processing complex degraded images, making it difficult to retain the structure and details of the image, and traditional methods lead to excessive smoothing of the image.
The image restoration method based on high-order gradient constraints and diffusion generation models is adopted. By introducing a high-order gradient restoration module and correcting LogCosh loss function, combining the pre-trained diffusion generation model, an image restoration network is constructed, and the model parameters are optimized using the anisotropic diffusion equation and improved loss function.
It significantly improves the retention ability of image structure and edges, enhances image details and texture quality, and enhances the generalization ability of the model to adapt to different types and degrees of image degradation.
Smart Images

Figure CN119494802B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image restoration based on artificial intelligence and machine vision, and specifically relates to an image restoration method based on high-order gradient constraint and diffusion generative model. Background Art
[0002] With the rapid development of modern information technology, digital image processing technology has developed rapidly and is widely used in daily life and work. Digital image restoration is an important branch in the field of digital image processing technology and plays an important role in many fields such as medicine, remote sensing, agriculture, and image recognition.
[0003] Image restoration aims to recover high-quality images from low-quality observed images. Typical tasks include denoising, deblurring, defogging, deraining, and super-resolution reconstruction, etc. In traditional image restoration research, the degradation process is usually known and relatively simple, such as Gaussian noise and bicubic downsampling, etc. Based on this, many image restoration algorithms have been proposed. However, the generalization ability of these algorithms is relatively limited and it is difficult to handle complex image degradation problems in real scenes. And traditional image restoration methods usually only focus on pixel-level errors and adopt low-order gradient constraints or simple loss functions, such as mean square error MSE. These methods can restore images to a certain extent, but often lead to over-smoothing of the images, lacking clear details and textures, especially when dealing with complex degraded images, the effect is not ideal, resulting in poor image restoration effect. Summary of the Invention
[0004] In order to solve the technical problem of poor image restoration effect, the present invention proposes an image restoration method based on high-order gradient constraint and diffusion generative model.
[0005] The present invention provides an image restoration method based on high-order gradient constraint and diffusion generative model, which can better retain the structural and detailed information of the image and can obtain excellent restoration effect when dealing with different types of degraded images. The method includes:
[0006] Obtain the image to be restored;
[0007] Restore the image to be restored through a pre-trained image restoration network, wherein the image restoration network includes: a shallow feature extraction module, a deep feature extraction module, a high-definition image reconstruction module, a high-order gradient restoration module, and a diffusion generative model;
[0008] The training process of the image restoration network includes:
[0009] Obtain natural high-definition dataset images, preprocess them to generate degraded low-quality images;
[0010] Based on the SwinIR network, the modified LogCosh loss function, the high-order gradient restoration module, and the pre-trained diffusion generation model, an image restoration network is constructed. Among them, the modified LogCosh loss function is the LogCosh loss function with a penalty term added. The SwinIR network includes: a shallow feature extraction module, a deep feature extraction module, and a high-definition image reconstruction module;
[0011] Using the degraded low-quality image as the training sample, the natural high-definition dataset image as the training label, and the modified LogCosh loss function as the loss function during the training process, the constructed image restoration network is trained to obtain the trained image restoration network.
[0012] Optionally, the construction of the image restoration network based on the SwinIR network, the modified LogCosh loss function, the high-order gradient restoration module, and the pre-trained diffusion generation model includes:
[0013] The constructed high-order gradient restoration module is introduced after the high-definition image reconstruction module included in the SwinIR network, where the high-order gradient restoration module is used to extract the high-order gradient information of the image;
[0014] The MSE loss function of the SwinIR network structure is replaced with the modified LogCosh loss function;
[0015] The pre-trained diffusion generation model is introduced, and the finally obtained network is determined as the image restoration network.
[0016] Optionally, the steps implemented by the high-order gradient restoration module include:
[0017] The high-order gradient information of two images is extracted through gradient operation as:
[0018]
[0019] Among them, represents the k-th order gradient operation, I gt represents the natural high-definition dataset image, I RM represents the intermediate restored image obtained through the high-definition image reconstruction module;
[0020] The anisotropic diffusion equation is introduced to construct the formula corresponding to the high-order gradient constraint loss:
[0021]
[0022] Among them, I gd-loss represents the high-order gradient constraint loss function;
[0023] denotes the gradient operation, and I denotes the grayscale image. denotes the modulus of the image gradient, and g(x) is the improved diffusion coefficient function. I RM is the intermediate restored image obtained after the image reconstruction module, and I gt is the real image; and denote the partial derivatives of the function in the parentheses with respect to x and y respectively; w x and w y denote the gradients of w in the x-direction and y-direction respectively.
[0024] Optionally, the formula corresponding to the modified LogCosh loss function is:
[0025]
[0026] where I RM = RM(I lq ), RM is the high-definition image reconstruction module, and I RM is the intermediate restored image obtained through the high-definition image reconstruction module, I lq is the low-quality image, I gt is the original high-definition image, ε is the stabilization term, and ε is set to 10 -3 ; F() is the high-order gradient restoration module constructed based on the anisotropic diffusion equation. denotes the gradient operation, and I denotes the grayscale image. denotes the modulus of the image gradient, and g(x) is the improved diffusion coefficient function. λ is used to balance the weights between the high-order gradient constraint and the LogCosh loss based on pixel differences, and λ is set to 0.1; and denote the partial derivatives of the function in the parentheses with respect to x and y respectively; w x and w y denote the gradients of w in the x-direction and y-direction respectively.
[0027] Optionally, the final goal is to find the formula for the parameter θ that can minimize the entire loss function:
[0028]
[0029] The model parameters are adjusted through iterative training, and the loss function is repeatedly calculated and the parameters are updated until the loss function converges.
[0030] The present invention has the following beneficial effects:
[0031] First, it can improve the ability to preserve image structure and edges. Specifically, the constructed high-order gradient restoration module can better capture and retain the structural information and edge features of the image. During the restoration process of the present invention, the image contour and boundary can be more accurately reconstructed, significantly reducing the problems of edge blurring and structural distortion. This enables the present invention to exhibit strong adaptability to various image degradation situations.
[0032] Second, it can enhance image details and texture quality. Specifically, the modified LogCosh loss function of the present invention enhances the robustness of the model to image outliers. For example, image outliers can be extreme pixel values. It behaves similarly to the MAE loss when dealing with large errors and similar to the MSE loss when dealing with small errors, which enables the model to better adapt to different types and degrees of image degradation. In the image restoration task with noise or artifacts, the combined use of the modified LogCosh loss function and the diffusion generative model can generate smoother and more natural restoration results.
[0033] Third, it provides new ideas for other image processing tasks. Specifically, the high-order gradient restoration module proposed in the present invention integrates the anisotropic diffusion equation, enhancing the generalization ability of the deep learning model in image processing tasks. This not only provides a new method for improving image restoration algorithms but also opens up a new perspective for theoretical research in related fields.
[0034] In summary, by cleverly integrating the improved anisotropic diffusion equation into the deep learning framework, the present invention constructs a high-order gradient restoration module, which not only improves the image quality and visual effect in various image restoration tasks but also enhances the generalization ability of the model. At the same time, the modified LogCosh loss function enhances the robustness of the model. This comprehensive consideration combining low-level pixel information and high-level structural information is expected to promote the further development of image restoration technology. Brief Description of the Drawings
[0035] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0036] Figure 1 It is a flowchart of the image restoration method based on high-order gradient constraint and diffusion generative model of the present invention;
[0037] Figure 2 It is a flowchart of the training process of the image restoration network of the present invention;
[0038] Figure 3Schematic diagram of the image restoration network based on high-order gradient constraint and diffusion generation model of the present invention;
[0039] Figure 4 Schematic diagram of the comparison of the restoration results of a low-quality image of the present invention;
[0040] Figure 5 Schematic diagram of the comparison of the restoration results of another low-quality image of the present invention. Detailed implementation manners
[0041] In order to further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following specifically describes the detailed implementation manners, structures, features and effects of the technical solutions proposed according to the present invention in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs.
[0043] The present invention proposes an image restoration method based on high-order gradient constraint and diffusion generation model. By cleverly integrating the improved anisotropic diffusion equation into the deep learning framework, a high-order gradient restoration module is constructed. At the same time, a modified LogCosh loss function is proposed. Then, the intermediate restored image constrained by the high-order gradient restoration module is processed by a pre-trained diffusion generation model to obtain the final restored image.
[0044] Refer to Figure 1 , which shows the flow of some embodiments of the image restoration method based on high-order gradient constraint and diffusion generation model according to the present invention. The image restoration method based on high-order gradient constraint and diffusion generation model includes the following steps:
[0045] Step S1, obtaining the image to be restored.
[0046] Among them, the image to be restored can be a low-quality image to be subjected to image restoration.
[0047] Step S2, restoring the image to be restored through a pre-trained image restoration network.
[0048] Among them, the image restoration network can include: a shallow feature extraction module, a deep feature extraction module, a high-definition image reconstruction module, a high-order gradient restoration module and a diffusion generation model.
[0049] Refer to Figure 2, which shows the process corresponding to the training process of the image restoration network, may include the following steps:
[0050] Step 201, obtain natural high-definition dataset images, preprocess them, and generate degraded low-quality images.
[0051] In some embodiments, publicly available natural high-definition dataset images I gt can be obtained, preprocessed, and degraded low-quality images I lq are generated to form a high-definition - low-quality image pair (I gt - I lq ). Then, the dataset is divided into a training set and a validation set according to a certain ratio. Among them, the preprocessing can be achieved by randomly adding noise, blurring, and resizing.
[0052] As an example, this step may include the following steps:
[0053] The first step is to perform three steps of processing on the publicly available natural high-definition dataset images I gt in sequence: blurring, noise addition, and image size readjustment, and finally obtain degraded low-quality images I lq . The specific process is as follows:
[0054] First, in the blurring stage, set the size of the blur kernel, and use two types of blur kernels, isotropic (iso) and anisotropic (aniso), with a 50% probability for each. The standard deviation range of the blur is set to 0.1 to 15.
[0055] Second, in the noise addition stage, set the noise intensity range to 0 to 15, and randomly add Gaussian noise, Poisson noise, and JPEG compression noise, where the quality range of the JPEG compression noise is set to 30 to 100.
[0056] Finally, in the image size adjustment stage, set the downsampling range to 1 to 15, use bilinear interpolation or bicubic interpolation for resizing, and fix the output image size to 512×512 pixels by means of central cropping.
[0057] The second step is to randomly divide the high-definition - low-quality image pair (I gt - I lq ) generated through the above process into a training set and a validation set according to a ratio of 7:3, and generate train.txt and val.txt files containing the picture addresses of the training set and the validation set.
[0058] Step 202, construct an image restoration network based on the SwinIR network, the modified LogCosh loss function, the high-order gradient restoration module, and a pre-trained diffusion generation model.
[0059] Among them, the modified LogCosh loss function is the LogCosh loss function with a penalty term added. The existing SwinIR (image restoration based on Swin Transformer) network includes: a shallow feature extraction module, a deep feature extraction module, and a high-definition image reconstruction module.
[0060] It should be noted that the existing SwinIR (image restoration based on Swin Transformer) network structure mainly consists of three parts: a shallow feature extraction module, a deep feature extraction module, and a high-definition image reconstruction module. The shallow feature extraction module is composed of a single 3×3 convolutional layer; the deep feature extraction module contains 6 residual Swin Transformer blocks (RSTB) and 1 3×3 convolutional layer. Each RSTB consists of 6 Swin Transformer layers (STL), and every two STLs form a pair. In each pair of STLs, a single STL is sequentially composed of a normalization layer, a multi-head self-attention mechanism (MSA), a normalization layer, and a multi-layer perceptron (MLP), and there are residual connections after both the MSA and the MLP. The MSA of the first STL is window self-attention (W-MSA), and the MSA of the second STL is shifted window self-attention (SW-MSA). A 3×3 convolutional layer is also added after each RSTB. Finally, through cross-layer connection, the shallow and deep features are fed into the high-definition image reconstruction module, which is composed of multiple 3×3 convolutional layers.
[0061] In some embodiments, the present invention improves based on the SwinIR network structure. First, on the basis of the SwinIR network structure, a high-order gradient restoration module is introduced to better retain important structural information such as image texture; secondly, the MSE loss function in the SwinIR network structure is replaced with a modified logarithmic hyperbolic cosine (LogCosh) loss function, so that the network pays more attention to the detail processing of the image during the restoration process; through continuous iterative optimization until the loss function converges, an intermediate restored image is obtained, and the weight parameters of the image restoration model are saved; finally, combined with a pre-trained diffusion generation model, the real detail performance of the restored image is further enhanced. Load the weights of the trained model, use the image restoration model to restore the degraded image, and complete the image restoration task.
[0062] As an example, this step may include the following steps:
[0063] In the first step, the shallow feature extraction module is used to input the low-quality image I lq , and obtain a shallow feature map through a single 3×3 convolution operation. The corresponding formula can be:
[0064] F shallow = fshallow (I lq )
[0065] where I lq ∈R H×W×C is the input low-quality image, and f shallow () is the shallow feature extraction function, i.e., a 3×3 convolutional layer. F shallow ∈R H×W×C is the extracted shallow feature.
[0066] In the second step, the deep feature extraction module is used to further extract features from the extracted shallow feature F shallow . The deep feature extraction module consists of K RSTBs and a 3×3 convolutional layer. Specifically, the deep feature extraction module is used to implement the following steps:
[0067] F deep = f deep (F shallow )
[0068] where f deep () is the deep feature extraction function, which includes K RSTBs and a 3×3 convolutional layer, and F deep ∈R H ×W×C is the extracted deep feature. Specifically:
[0069]
[0070] where F mid is the intermediate layer feature, f RSTBi () is the i-th RSTB, and f CONV () is the last convolutional layer. By combining the STL module and the convolutional layer (CON), the inductive bias of convolution is introduced into the Transformer-based network, laying the foundation for the subsequent fusion of shallow and deep features. Each RSTB module consists of L Swin Transformer layers (STL) and a residual block of a convolutional layer. First, calculate the intermediate feature passing through L STLs:
[0071]
[0072] where F in is the input feature of the i-th RSTB, F mid is the intermediate feature extracted by each STL in the L STL modules, is the L-th Swin Transformer layer in the i-th RSTB. Then, before the residual connection, add a convolutional layer:
[0073]
[0074] Among them, is the output feature of the i-th RSTB, and f convi () is the convolutional layer of the i-th RSTB. Feature aggregation at different levels can be achieved through residual connections.
[0075] In the third step, the high-definition image reconstruction module is used for different restoration tasks, and there are personalized differences in the high-definition image reconstruction module.
[0076] It should be noted that for the classical super-resolution task, first perform 3×3 convolution processing, then perform PixelShuffle upsampling operation, and finally output the convolutional layer; for real image super-resolution, first perform multiple 3×3 convolution processing on the input features, then perform two nearest neighbor interpolation upsampling, then perform convolution operation on the upsampled image, and finally output the convolutional layer. For image denoising and JPEG compression artifact removal tasks, direct convolution processing is performed.
[0077] In the fourth step, a constructed high-order gradient restoration module is introduced after the high-definition image reconstruction module included in the SwinIR network.
[0078] Among them, the high-order gradient restoration module is used to extract the high-order gradient information of the image.
[0079] It should be noted that in order to further improve the texture and detail restoration ability of the image in the high-definition image reconstruction module of the SwinIR network, the present invention is based on the anisotropic diffusion equation, and a constructed high-order gradient restoration module is introduced after the high-definition image reconstruction module to extract and restore the high-order gradient information of the image. Specifically, this module calculates the high-order gradient residual value between the original high-definition image I gt and the intermediate restored image I RM and uses it as a constraint term to describe the high-order gradient difference between the restored and original images, so as to impose more strict boundary and texture constraints on the restoration process of the model, effectively restore the details and contour information in the image, and adjust the model parameters through iterative loops, thereby improving the quality of image restoration.
[0080] Specifically, the steps implemented by the high-order gradient restoration module may include the following sub-steps:
[0081] The first sub-step is to extract the high-order gradient information of the two images through gradient operation as:
[0082]
[0083] Among them, represents the k-th order gradient operation, I gt represents the image of the natural high-definition dataset, and I RMDenotes the intermediate restored image obtained by the high-definition image reconstruction module.
[0084] The second sub-step is to introduce the anisotropic diffusion equation and construct the formula corresponding to the high-order gradient constraint loss:
[0085]
[0086] where, I gd-loss denotes the high-order gradient constraint loss function; is the MSE loss function, which is in the form of the square of the 2-norm;
[0087] denotes the gradient operation, I denotes the grayscale image, denotes the magnitude of the image gradient. g(x) is the improved diffusion coefficient function, which is a monotonically decreasing function, and I RM is the intermediate restored image obtained after the image reconstruction module, and I gt is the real image; and denote taking the partial derivatives of the function inside the parentheses with respect to x and y respectively; w x and w y denote the gradients of w in the x-direction and y-direction respectively.
[0088] By characterizing the high-order gradient contour information between the intermediate restored image and the original high-definition image, the details, textures and other structures in the restored image are guaranteed.
[0089] The fifth step is to replace the MSE loss function of the SwinIR network structure with the modified LogCosh loss function.
[0090] Among them, the modified LogCosh loss function, also known as the LogCosh loss function based on high-order gradient constraint and pixel difference, consists of two parts: the high-order gradient constraint loss and the pixel difference logCosh loss; it is equivalent to adding the penalty term "high-order gradient constraint loss" to the original LogCosh loss function based on pixel difference, so it can be called the modified LogCosh loss function. The pixel difference logCosh loss, also known as the pixel-level loss function or the LogCosh loss function of pixel-level difference.
[0091] It should be noted that compared with the MSE loss function, the LogCosh loss function is smoother when dealing with large pixel errors. Specifically, the MSE loss function for image restoration in the original SwinIR model is corrected to the LogCosh loss function, and in order to ensure numerical stability, a penalty term is added. The LogCosh loss function is similar to the MSE loss when the pixel deviation is small and similar to the MAE loss when the pixel deviation is large, and the LogCosh loss function is second-order differentiable everywhere. The corrected loss function is more suitable for dealing with scenarios with more outliers, enabling the network to better focus on the detailed information of the image during the restoration process.
[0092] Secondly, through setting the number of steps for training and continuously iterating and optimizing until the loss function converges, the weight parameters of the image restoration model are saved. Specifically, the constructed corrected LogCosh loss function (LogCosh loss based on high-order gradient constraint and pixel difference) can be used to continuously iterate and optimize through dynamic adjustment and the gradient descent algorithm to reach the convergence state.
[0093] The constructed improved pixel-level loss function is:
[0094] I pix-loss = log(cosh((I RM -I gt ) + ε))
[0095] where I pix-loss is the pixel-level loss, log is the logarithmic operation, I RM is the intermediate restored image obtained after the image reconstruction module, I gt is the original high-definition image. ε is the stability term, set to ε = 10 -3 .
[0096] For example, using the constructed high-order gradient restoration module and the corrected LogCosh loss, the final loss function is obtained. The final corrected LogCosh loss function is divided into two parts, including the LogCosh loss based on high-order gradient constraint and the LogCosh loss based on pixel difference. The formula corresponding to the corrected LogCosh loss function is:
[0097]
[0098] where I RM = RM(I lq ), RM is the high-definition image reconstruction module, I RM is the intermediate restored image obtained through the high-definition image reconstruction module, I lq is the low-quality image, I gtis the original high - definition image, ε is the stabilization term, and ε is set to 10 -3 ; F() is a high - order gradient restoration module constructed based on the anisotropic diffusion equation, represents the gradient operation, I represents the grayscale image, represents the magnitude of the image gradient, g(x) is the improved diffusion coefficient function, λ is used to balance the weights between the high - order gradient constraint and the LogCosh loss based on pixel differences, and λ is set to 0.1; and represents the partial derivatives of the function inside the parentheses with respect to x and y respectively; w x and w y represent the gradients of w in the x - direction and y - direction respectively.
[0099] The ultimate goal is to find the parameters θ that can minimize the entire loss function, and the corresponding formula is:
[0100]
[0101] The model parameters are trained and adjusted through iterative loops, and the loss function is repeatedly calculated and the parameters are updated until the loss function converges.
[0102] By constructing an image high - order gradient restoration module, the image structure and detail information are better retained. Comparing with the form of the existing loss function, the MSE loss function is improved, and the quality and robustness of the restored image are enhanced.
[0103] In the sixth step, a pre - trained diffusion generation model is introduced to make the restored image generate more realistic details, and the finally obtained network is determined as the image restoration network.
[0104] It should be noted that a pre - trained text - to - image diffusion generation model is used to generate smooth and natural images to complete the image restoration process. Specifically, the intermediate restored image I RM uses the large - scale text - to - image latent diffusion model (Sable Diffusion) to achieve the final image restoration; in the above process, IR ControlNet is used to guide the final restored image I final to have the same local pixel information as the original high - definition image I gt , so as to output the final restored image I final .
[0105] In step 203, the degraded low - quality image is used as the training sample, the natural high - definition dataset image is used as the training label, and the modified LogCosh loss function is used as the loss function during the training process to train the constructed image restoration network to obtain the trained image restoration network.
[0106] It should be noted that the image restoration network based on the high-order gradient constraint and diffusion generation model can be as follows Figure 3 shown. The comparison of the low-quality image restoration results can be as follows Figure 4 and Figure 5 shown. It can be clearly seen that in the degradation restoration task, the present invention can better retain the structural and detailed information of the image and achieve good restoration results.
[0107] In summary, the present invention cleverly integrates the improved anisotropic diffusion equation into the deep learning framework to construct a high-order gradient restoration module, which not only improves the image quality and visual effect in various image restoration tasks, but also enhances the generalization ability of the model. At the same time, the modified LogCosh loss function enables the model to better adapt to various image degradation situations and enhances the robustness of the model. This comprehensive consideration of combining low-level pixel information with high-level structural information is expected to promote the further development of image restoration technology.
[0108] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the various embodiments of the present invention and should all be included in the protection scope of the present invention.
Claims
1. An image restoration method based on high-order gradient constraints and diffusion generative models, characterized in that Including the following steps: Obtain the image to be restored; Restore the image to be restored through a pre-trained image restoration network, where the image restoration network includes: a shallow feature extraction module, a deep feature extraction module, a high-definition image reconstruction module, a high-order gradient restoration module, and a diffusion generation model; The training process of the image restoration network includes: Obtain natural high-definition dataset images, preprocess them, and generate degraded low-quality images; Based on the SwinIR network, the modified LogCosh loss function, the high-order gradient restoration module, and a pre-trained diffusion generation model, construct an image restoration network, where the modified LogCosh loss function is the LogCosh loss function with a penalty term added, and the SwinIR network includes: a shallow feature extraction module, a deep feature extraction module, and a high-definition image reconstruction module; Use the degraded low-quality images as training samples, the natural high-definition dataset images as training labels, and the modified LogCosh loss function as the loss function during the training process to train the constructed image restoration network to obtain a trained image restoration network; The constructing of the image restoration network based on the SwinIR network, the modified LogCosh loss function, the high-order gradient restoration module, and a pre-trained diffusion generation model includes: Introduce the constructed high-order gradient restoration module after the high-definition image reconstruction module included in the SwinIR network, where the high-order gradient restoration module is used to extract the high-order gradient information of the image; Replace the MSE loss function of the SwinIR network structure with the modified LogCosh loss function; Introduce a pre-trained diffusion generation model and determine the finally obtained network as the image restoration network; The steps implemented by the high-order gradient restoration module include: Extract the high-order gradient information of two images through gradient operations as: , Among them, represents the k-th order gradient operation, represents the natural high-definition dataset image, represents the intermediate restored image obtained by the high-definition image reconstruction module; Introduce the anisotropic diffusion equation and construct the formula corresponding to the high-order gradient constraint loss: , Among them, represents the high-order gradient constraint loss function; , , represents the gradient operation, represents the grayscale image, represents the magnitude of the image gradient, is the improved diffusion coefficient function, , is the intermediate restored image obtained after the image reconstruction module, is the real image; and represent taking the partial derivatives of the function inside the parentheses with respect to and respectively; and represent respectively in the direction and direction of the gradient; The formula corresponding to the modified LogCosh loss function is: , Among them, , , RM is a high-definition image reconstruction module, is the intermediate restored image obtained by the high-definition image reconstruction module, is the low-quality image, is the original high-definition image, is the stability term, set ; is a high-order gradient restoration module constructed based on the anisotropic diffusion equation, , , represents gradient operation, represents the grayscale image, represents the image gradient magnitude, is the improved diffusion coefficient function, ; is used to balance the weights between the high-order gradient constraint and the LogCosh loss based on pixel difference, set ; and represent the partial derivatives of the function inside the parentheses with respect to and respectively; and respectively represent in the direction and direction gradients.
2. The image restoration method based on high-order gradient constraint and diffusion generation model according to claim 1, wherein The ultimate goal is to find the parameters that can minimize the entire loss function The corresponding formula is: , Iteratively train and adjust the model parameters through loops, repeatedly calculate the loss function and update the parameters until the loss function converges.
Citation Information
Patent Citations
Image super-resolution reconstruction method and device, model training method and device and electronic equipment
CN116805282A
Image restoration method and device, electronic equipment and storage medium
CN116934615A