Two-stage image recovery method based on coding and decoding structure
Through the two-stage network structure and weighted feature fusion mechanism, the limitations of feature extraction and fusion process in the image recovery method are solved, the image recovery effect and model performance are improved, and effective capture and integration of feature information at different levels is achieved.
Patent Information
- Application Number
- CN202410897622.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-11-01
AI Technical Summary
The existing deep learning-based image recovery method has limitations in the process of feature extraction and fusion, resulting in lack of detail and clarity in image recovery, and the model decoding structure lacks weight adjustment flexibility, making it difficult to make full use of different levels of feature information in the image.
Using a two-stage image recovery method based on the codec structure, the two-stage network structure is constructed, including the encoding module, the decoding module, the feature fusion module and the mixed attention module, and the weighted feature fusion method and the mixed attention mechanism are used to capture different levels of features. Information and adjust feature weights to improve image recovery effect.
The detailed information is extracted through the dual-stage network structure to improve the image recovery effect, and the weighted feature fusion and mixed attention mechanism are adopted to enhance the performance and adaptability of the model, reduce redundant information, and improve the expression and learning ability of complex data.
Smart Images

Figure CN118887139A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image restoration, and in particular to a dual-stage image restoration method based on a codec structure. Background Art
[0002] With the continuous development of deep learning technology, many researchers have proposed different image restoration networks to solve the problem of low image quality. However, the current image restoration methods and deblurring methods based on deep learning also have certain limitations.
[0003] Single-stage networks usually complete all feature extraction and image restoration processing in one stage, which may cause the network to fail to fully utilize the feature information at different levels in the image, thus affecting the restoration effect. It is difficult to capture subtle image details, especially when processing high-resolution images. This may cause the restored image to lack details and be unclear. In addition, the general codec structure of the image restoration network usually adopts a direct addition feature fusion method, which may cause the loss of some information, especially when the features fused from different levels essentially contain different types of information. The addition operation gives the same weight to the importance of the features, which ignores the fact that different features may contribute differently to the final task. In practical applications, some features may be more important than others, and the direct addition method lacks the flexibility to adjust these weights. Summary of the invention
[0004] In order to solve the problems of lack of details in existing image restoration, unclear restored images and lack of flexibility in weight adjustment in model decoding, the present invention proposes a two-stage image restoration method based on a codec structure to solve the above problems.
[0005] The present application discloses a two-stage image restoration method based on a codec structure, comprising the following steps:
[0006] S1. Create a data set using real text archive images and manually repair images with missing text;
[0007] S2. constructing an image restoration model, wherein the image restoration model adopts a two-stage network structure based on a codec structure, including an encoding module, a decoding module, a feature fusion module, and a hybrid attention module;
[0008] S3, training the image restoration model, iterating until the network converges, and obtaining a trained image restoration model;
[0009] S4. The archive text image is used as the input of the trained image restoration model, and a clear restored image is obtained after model inference.
[0010] Preferably, the data set includes a training set, a validation set and a test set, and the images that need to be manually restored are used as the training set.
[0011] Preferably, the two-stage network structure includes a first-stage network structure and a second-stage network structure;
[0012] The first-stage network structure includes a 3×3 convolution kernel and a hybrid attention module. The 3×3 convolution kernel is used to extract the shallow features of the first stage, and then the deep features of the first stage are output through multiple hybrid attention modules. The shallow features of the first stage and the deep features of the first stage are fused, and then the output of the first stage is obtained through the 3×3 convolution kernel.
[0013] Preferably, the second stage network structure includes a 3×3 convolution kernel, a feature fusion module, a hybrid attention module, an encoding module and a decoding module, the encoding module includes a first encoding module, a second encoding module and a third encoding module, and the decoding module includes a first decoding module, a second decoding module and a third decoding module.
[0014] Through the 3×3 convolution kernel, the shallow features of the second stage are extracted, and then the deep features of the first stage are fused with the shallow features of the second stage through the feature fusion module, and then through the mixed attention module, the input of the encoding module is obtained, the output of the third encoding module is used as the input of the first decoding module, the output of the second encoding module is fused with the output of the first decoding module through the feature fusion module as the input of the second decoding module, the output of the first encoding module is fused with the output of the second decoding module through the feature fusion module as the input of the third decoding module, the input of the encoding module and the output of the third decoding module are fused through the feature fusion module, and then through the 3×3 convolution kernel, the output of the second stage is obtained.
[0015] Preferably, the encoding module uses layer normalization to improve the training efficiency and convergence speed of the model, and then uses a 1×1 convolution kernel to increase the size of the number of channels. The 1×1 convolution kernel is connected to three branches, and the three branches include three different sizes of convolution kernels for capturing features of different scales and complexities. The convolution kernels of the three branches are all connected to a Simple Gate module and a channel attention module. The Simple Gate module is used to introduce nonlinearity, and the channel attention module is used to process the relationship and importance between different channels in the feature map. After the three branches are merged, the stability of the model is improved by layer normalization, and the dimension is increased by a 1×1 convolution kernel. Residual connections are used to alleviate the problems of gradient vanishing and gradient exploding that occur with the increase of network depth. Then, a 2×2 pooling module is used to downsample the features to eliminate redundant information in the features. Finally, a hybrid attention module is used to establish long-distance dependencies and relationships between channels.
[0016] Preferably, the decoding module uses a 1×1 convolution kernel for dimensionality reduction after layer normalization, uses a 3×3 convolution kernel for feature extraction, the 3×3 convolution kernel is connected with an activation function module and a channel attention module, and then uses a 1×1 convolution kernel for dimensionality increase and residual connection, then performs layer normalization and uses a Pixel Shuffle module for upsampling, and finally passes through a hybrid attention module.
[0017] Preferably, the feature fusion module adopts a weighted feature fusion method to perform feature fusion, multiplying two features and using a sigmoid function to increase the nonlinearity of the model, and finally generating a weighted parameter to guide feature fusion. The output formula of the feature fusion module is as follows:
[0018] out = c·a+(1-c)·b;
[0019] Among them, c = σ(a·b), σ represents the sigmoid function, a and b are input features, c is the weight, weight c can control the importance of feature a, and weight (1-c) controls the importance of feature b.
[0020] Preferably, the hybrid attention module first performs layer normalization on the input features, then uses a multi-head self-attention module and a channel attention module to capture information in the features, uses a residual connection to fuse the output of the channel self-attention module with the input features of the hybrid self-attention module as the output of the first part, normalizes the output of the first part, and then inputs it into a multi-layer perceptron to obtain the output of the second part, and fuses the output of the first part with the output of the second part using a residual link to obtain the output of the hybrid attention module.
[0021] Preferably, S3 comprises the following steps:
[0022] The L1 and MSE mixed loss functions are used in training. For the real high-quality image I of size m×n and the image K output by the model, the expression of the MSE loss function is:
[0023]
[0024] The expression of L1 loss function is:
[0025]
[0026] Where i, j are the pixel coordinates of the image;
[0027] The mixed loss function is:
[0028]
[0029] The reference indicators used in training are peak signal-to-noise ratio and structural similarity. The calculation formula of peak signal-to-noise ratio is:
[0030]
[0031] in, is the possible maximum pixel value of the image;
[0032] Structural similarity includes information about the brightness, contrast, and structure of the image. The brightness measurement formula is:
[0033]
[0034] The contrast ratio measurement formula is:
[0035]
[0036] The structural measurement formula is:
[0037]
[0038] Among them, x and y are samples, μ x is the mean of x, μ y is the mean of y, is the variance of x, is the variance of y, σ x is the standard deviation of x, σ y is the standard deviation of y, σ xy is the covariance of x and y, c1=(K1L) 2 and c2=(K2L) 2 are two constants, c3=c2 / 2, L is the range of pixel values, K1=0.01, K2=0.03;
[0039] The formula for calculating structural similarity is:
[0040] SSIM(x,y)=l(x,y) α c(x, y) β s(x, y) γ ;
[0041] Let α=1,β=1,γ=1 in the above formula, then:
[0042]
[0043] Each time the structural similarity is calculated, an N×N window is taken from the image, and then it is continuously slid for calculation, and finally the average value is calculated as the global structural similarity.
[0044] Beneficial effects of the present invention:
[0045] (1) The invention proposes to extract feature information of different levels through a two-stage network structure to capture detail information, thereby improving the effect of image restoration.
[0046] (2) The present invention proposes a weighted feature fusion method. Weighted fusion can effectively integrate multi-source information and improve the performance and adaptability of the model by assigning appropriate weights to different features or feature groups.
[0047] (3) In view of the fact that there are many channels in the network structure, the present invention adopts a hybrid attention mechanism that combines channel attention and self-attention mechanism. It can simultaneously consider the relationship between channels and the global dependency within features, realize the comprehensive utilization of fine-grained and global information of features, and enable the model to focus on important information more effectively and reduce redundancy, thereby enhancing the model's ability to express and learn complex data. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flow chart of a two-stage image restoration method based on a codec structure according to an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of a two-stage network structure based on a codec structure according to an embodiment of the present invention;
[0050] Figure 3 Schematic diagram of an encoding module according to an embodiment of the present invention;
[0051] Figure 4 A schematic diagram of a decoding module according to an embodiment of the present invention;
[0052] Figure 5 Schematic diagram of a feature fusion module according to an embodiment of the present invention;
[0053] Figure 6 Schematic diagram of a hybrid attention module according to an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and examples.
[0055] The embodiment of the present application discloses a two-stage image restoration method based on a codec structure, the process is as follows: Figure 1 As shown, the following steps are included:
[0056] S1. Create a data set, use real text archive images, and manually repair the images with missing text. In this embodiment, use computer and tablet drawing software to manually fill in the missing parts of the text in the image. The data set includes 1000 images with a size of 1650×2340, of which 800 are training sets, which are images that need to be manually repaired, 100 are verification sets, and 100 are test sets. The data set is real text archive images.
[0057] S2. Construct an image restoration model, which adopts a two-stage network structure based on a codec structure, including an encoding module, a decoding module, a feature fusion module and a hybrid attention module.
[0058] like Figure 2 As shown in the figure, the two-stage network structure includes the first-stage network structure and the second-stage network structure. The first-stage network structure includes a 3×3 convolution kernel and a hybrid attention module. The 3×3 convolution kernel is used to extract the shallow features of the first stage, and then the deep features of the first stage are output through multiple hybrid attention modules. The shallow features of the first stage and the deep features of the first stage are fused, and then the output of the first stage is obtained through the 3×3 convolution kernel.
[0059] The network structure of the second stage includes a 3×3 convolution kernel, a feature fusion module, a hybrid attention module, an encoding module and a decoding module. The encoding module includes the first encoding module, the second encoding module and the third encoding module, and the decoding module includes the first decoding module, the second decoding module and the third decoding module. Through the 3×3 convolution kernel, the shallow features of the second stage are extracted, and then the deep features of the first stage and the shallow features of the second stage are fused through the feature fusion module, and then through the hybrid attention module, the input of the encoding module is obtained, the output of the third encoding module is used as the input of the first decoding module, the output of the second encoding module is fused with the output of the first decoding module through the feature fusion module, and used as the input of the second decoding module, the output of the first encoding module and the output of the second decoding module are fused through the feature fusion module, and used as the input of the third decoding module, the input of the encoding module and the output of the third decoding module are fused through the feature fusion module, and then through the 3×3 convolution kernel, the output of the second stage is obtained.
[0060] like Figure 3As shown, the encoding module first uses layer normalization, which is a regularization technique for neural networks. It normalizes each feature dimension of each sample to improve the training efficiency and convergence speed of the model. Since the resolution of the input image is large, the size of the batch has a greater impact on batch normalization, so layer normalization is used here. Then a 1×1 convolution kernel is used to increase the size of the number of channels to reduce the number of parameters and reduce the risk of overfitting of the model. The 1×1 convolution kernel is connected to three branches, and the three branches include three different sizes of convolution kernels for capturing features of different scales and complexities. In this embodiment, 3×3 convolution kernels, 5×5 convolution kernels and 7×7 convolution kernels are used respectively. The convolution kernels of the three branches are connected to the Simple Gate module (SG) and the channel attention module (CA). The Simple Gate module is used to introduce nonlinearity without using an activation function to reduce the amount of calculation, and the channel attention module is used to process the relationship and importance between different channels in the feature map. After the three branches converge, the stability of the model is improved through layer normalization, and the dimension is increased through the 1×1 convolution kernel to enhance the model's expressiveness and learn complex feature representation. The residual connection is used to alleviate the gradient vanishing and gradient explosion problems that occur as the network depth increases, and the residual connection allows the network to directly skip some layers of transformation and directly pass shallower features to the deep layer. This mechanism helps to propagate information more effectively, avoiding information loss and confusion caused by multi-layer stacking, thereby improving the network's ability to express input data. Then, a 2×2 pooling module is used to downsample the features (step size s=2) to eliminate redundant information in the features, and finally a hybrid attention module is used to establish long-distance dependencies and relationships between channels.
[0061] The above encoding structure enables the network to learn and represent features at different levels, thereby improving the quality of image restoration. Since traditional activation functions are usually nonlinear functions, such as ReLU, Sigmoid, etc. These functions may introduce greater complexity and computational overhead in calculation, while Simple Gate is simple and efficient in calculation. At the same time, some traditional activation functions are prone to gradient vanishing or gradient exploding problems in deep networks, resulting in training difficulties. The design of Simple Gate makes it easier for information to flow in the network, which helps to alleviate the gradient vanishing problem and improve the training effect of the network. This interpretability is very valuable for understanding and debugging neural networks. In each case, the number of channels will increase due to the encoding and decoding structure. As the number of channels increases, the representation ability of the network is also enhanced accordingly, but there will also be channel information redundancy. Through the channel attention mechanism, the weights of different channels in the feature map can be dynamically adjusted according to the importance of each channel, thereby increasing the network's attention to important information and further improving the performance of the network. The channel attention mechanism can help the network learn more discriminative feature representations. By adaptively learning the correlation and weights between channels, the network can better capture the key features in the input data and improve the ability to express features. Therefore, a channel attention mechanism is added to each branch to capture the correlation between channels, and then the features extracted at different scales are fused. Since batch normalization is based on the relationship between samples in a batch, the normalization effect may be different for different batches of data in training and inference. Layer normalization normalizes each sample independently and is not affected by the batch size of the data, making the normalization result more stable and consistent. Therefore, we finally use layer normalization to normalize the output.
[0062] like Figure 4 As shown in the figure, the decoding module is similar to the encoding module. First, the layer is normalized and then a 1×1 convolution kernel is used for dimensionality reduction. Unlike the encoding module, in order to reduce the amount of calculation and the complexity of the model, the decoding module does not use different convolution kernels to extract features. It only uses a 3×3 convolution kernel for feature extraction. The 3×3 convolution kernel is connected with an activation function module and a channel attention module. Since the complexity of the decoding module is low, an activation function is used to replace the Simple Gate module. Then, a 1×1 convolution kernel is used for dimensionality increase and residual connection, followed by layer normalization and upsampling using the PixelShuffle module, and finally a hybrid attention module.
[0063] The activation function introduced by each decoding module increases the nonlinearity of the network and helps to learn complex mapping relationships. By stacking decoding modules, the network structure is deeper, which is conducive to learning more abstract and complex feature representations. Multiple upsampling and decoding can fuse features of different levels and scales, and improve the model's ability to capture image details and global information. Due to the upsampling operation in the decoding module, in order to ensure the performance of the model, this implementation does not use multi-scale feature extraction similar to the encoding structure. In the decoding structure, a 1×1 convolution kernel is used to change the number of channels to reduce the number of parameters, a 3×3 convolution kernel is used to extract features, and the depth of the model is deepened. Then, an activation function is used to increase the nonlinear ability of the model, and a channel attention mechanism is used to capture the correlation between channels. Then, cross-links are used to allow information to be transmitted in the network in a shorter path, avoiding the problem of information being lost or attenuated in deep networks. By directly connecting the output of the previous layer to the subsequent layer, more original information can be retained and transmitted, which helps to quickly transmit and share information. Then, layer normalization is also used to normalize the output, and finally Pixel Shuffle is used for upsampling. Pixel Shuffle is an operation used in neural networks for image processing tasks, especially for implementing efficient sub-pixel convolutions. Specifically, it rearranges the elements of a tensor of shape (B, C×r2, H, W) to obtain a tensor of shape (B, C, H×r, W×r), where r is the upsampling factor.
[0064] like Figure 5 As shown in the figure, since the direct addition fusion method does not take into account the scale difference between features, if the value ranges of the two features are very different, direct addition may cause one of the features to contribute too much to the result, affecting the balance of the fused features. There may be some redundancy or noise between the features, and direct addition may accumulate these irrelevant information, resulting in a decrease in the quality of the fused features. Therefore, the feature fusion module uses a weighted feature fusion method for feature fusion. By introducing a learnable weight parameter, the weighted feature fusion method can dynamically adjust the weight of each feature according to the actual situation of the data, thereby better reflecting the importance of different features in the task. This can improve the expressiveness and generalization ability of the model, and in order to maintain the performance of the model, no parameters are added. The nonlinearity of the model is increased by multiplying two features and using the sigmoid function, and finally a weighted parameter is generated to guide the fusion of features. The output formula of the feature fusion module is as follows:
[0065] out = c·a+(1-c)·b;
[0066] Among them, c = σ (a·b), σ represents the sigmoid function, which can map the input to a range between 0 and 1, making the output more robust, a and b are input features, c is the weight, weight c can control the importance of feature a, and weight (1-c) controls the importance of feature b. This allows the contribution of each feature to be adjusted during the fusion process, so as to adapt to different situations more flexibly. The formula of the Sigmoid function is:
[0067]
[0068] Among them, X (i,j) Represents the value of an element in a matrix.
[0069] like Figure 6 As shown in the figure, the hybrid attention module first performs layer normalization on the input features, and then uses the multi-head self-attention module and the channel attention module to capture the important information in the features. The output of the channel attention module is fused with the input features of the hybrid self-attention module using the residual connection as the output of the first part. The output of the first part is layer normalized and then input into the multi-layer perceptron to obtain the output of the second part. The output of the first part is fused with the output of the second part using the residual link to obtain the output of the hybrid attention module.
[0070] Combining the two attention mechanisms allows the model to learn features at different levels. The self-attention mechanism (the swin transformer structure used in this example) helps capture long-range dependencies within the sequence, while the channel attention mechanism helps capture the relationship between different channels within the feature map. The hybrid attention mechanism can provide richer representation capabilities, allowing the model to better capture complex structures and patterns in the input data.
[0071] S3, train the image restoration model, iterate until the network converges, and obtain a trained image restoration model. The device used in this embodiment is a single NVIDIA A100 40G graphics card, and the deep learning framework used is PyTorch. The L1 and MSE mixed loss functions are used in the training. For a real high-quality image I of size m×n and an image K output by the model, the expression of the MSE loss function is:
[0072]
[0073] The expression of L1 loss function is:
[0074]
[0075] Where i, j are the pixel coordinates of the image;
[0076] The mixed loss function is:
[0077]
[0078] The optimizer is trained using Adam, with the learning rate set to 2×10-4 and the number of iterations to 500000. Then, when the learning rate reaches the specified number of iterations [300000, 400000, 450000, 475000], it decays to 1 / 2.
[0079] In this embodiment, the reference indicators used in training are Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity (SSIM). During the training process, the training status of the model is observed through the peak signal-to-noise ratio and structural similarity when the model is verified.
[0080] The peak signal-to-noise ratio is calculated as:
[0081]
[0082] in, is the possible maximum pixel value of the image. If each pixel value is represented by B bits of binary, then MAX I =2 B -1. If it is a color image, the PSNR of the three channels of RGB can be calculated separately, and then the average value can be taken.
[0083] Structural similarity is a full-reference metric that takes into account the brightness, contrast, and structure of an image to assess the degree of structural distortion of an image. The closer SSIM is to 1, the better the image quality. The SSIM formula is based on three comparisons between samples x and y: brightness, contrast, and structure.
[0084] The brightness measurement formula is:
[0085]
[0086] The contrast ratio measurement formula is:
[0087]
[0088] The structural measurement formula is:
[0089]
[0090] Among them, x and y are samples, μ x is the mean of x, μ y is the mean of y, is the variance of x, is the variance of y, σx is the standard deviation of x, σ y is the standard deviation of y, σ xy is the covariance of x and y, c1=(L1L) 2 and c2=(K2L) 2 are two constants, c3=c2 / 2, L is the range of pixel values, that is, K=2 B -1, K1=0.01, K2=0.03.
[0091] The formula for calculating structural similarity is:
[0092] SSIM(x,y)=l(x,y) α c(x, y) β s(x, y) γ ;
[0093] Let α=1,β=1,γ=1 in the above formula, then:
[0094]
[0095] Each time the structural similarity is calculated, an N×N window is taken from the image, and then it is continuously slid for calculation, and finally the average value is calculated as the global structural similarity.
[0096] S4. The archive text image is used as the input of the trained image restoration model, and a clear restored image is obtained after model inference.
[0097] In this example, low-quality images are used as the input of the model, and the output is obtained after inference by the trained image restoration model. The image restoration model can make low-quality images with unclear text clear and restore the text. The effectiveness of the method of this application is proved by the evaluation indicators of peak signal-to-noise ratio (PSNR) and structural similarity (SSIM). The method of this application is compared with the mainstream text deblurring method, and the results are all trained under the same experimental conditions (single Tesla A100 GPU). The comparison results are shown in Table 1:
[0098] Table 1 Comparison of objective evaluation indicators of experimental results of text datasets
[0099] method PSNR SSIM Parameter(M) DMPHN 35.814 0.9932 21.7 MPRNet 36.136 0.9952 20.1 HINet 36.293 0.9954 88.7 This application method 36.692 0.9958 83.6
[0100] Parameter in Table 1 is the parameter quantity, indicating the size of the final model file. As can be seen from Table 1, compared with the mainstream method, the present invention has improved PSNR and SSIM indicators, proving the effectiveness of the method disclosed in this application.
[0101] The above shows and describes the basic principles, main features and advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A two-stage image restoration method based on a codec structure, characterized in that: The following steps are involved: S1. Create a data set using real text archive images and manually repair images with missing text; S2. constructing an image restoration model, wherein the image restoration model adopts a two-stage network structure based on a codec structure, including an encoding module, a decoding module, a feature fusion module, and a hybrid attention module; S3, training the image restoration model, iterating until the network converges, and obtaining a trained image restoration model; S4. The archive text image is used as the input of the trained image restoration model, and a clear restored image is obtained after model inference.
2. The two-stage image restoration method based on the codec structure according to claim 1, characterized in that: The data set includes a training set, a validation set and a test set, and the images that need to be manually repaired are used as the training set.
3. The two-stage image restoration method based on coding structure according to claim 2, characterized in that: The two-stage network structure includes a first-stage network structure and a second-stage network structure; The first-stage network structure includes a 3×3 convolution kernel and a hybrid attention module. The 3×3 convolution kernel is used to extract the shallow features of the first stage, and then the deep features of the first stage are output through multiple hybrid attention modules. The shallow features of the first stage and the deep features of the first stage are fused, and then the output of the first stage is obtained through the 3×3 convolution kernel.
4. The two-stage image restoration method based on coding structure according to claim 3 is characterized in that: The second-stage network structure includes a 3×3 convolution kernel, a feature fusion module, a hybrid attention module, an encoding module and a decoding module, the encoding module includes a first encoding module, a second encoding module and a third encoding module, and the decoding module includes a first decoding module, a second decoding module and a third decoding module; Through the 3×3 convolution kernel, the shallow features of the second stage are extracted, and then the deep features of the first stage are fused with the shallow features of the second stage through the feature fusion module, and then through the mixed attention module, the input of the encoding module is obtained, the output of the third encoding module is used as the input of the first decoding module, the output of the second encoding module is fused with the output of the first decoding module through the feature fusion module as the input of the second decoding module, the output of the first encoding module is fused with the output of the second decoding module through the feature fusion module as the input of the third decoding module, the input of the encoding module and the output of the third decoding module are fused through the feature fusion module, and then through the 3×3 convolution kernel, the output of the second stage is obtained.
5. The two-stage image restoration method based on the codec structure according to claim 4 is characterized in that: The encoding module uses layer normalization to improve the training efficiency and convergence speed of the model, and then uses a 1×1 convolution kernel to increase the size of the number of channels. The 1×1 convolution kernel is connected to three branches, and the three branches include three different sizes of convolution kernels for capturing features of different scales and complexities. The convolution kernels of the three branches are all connected to a Simple Gate module and a channel attention module. The Simple Gate module is used to introduce nonlinearity, and the channel attention module is used to process the relationship and importance between different channels in the feature map. After the three branches are merged, the stability of the model is improved by layer normalization, and the dimension is increased by a 1×1 convolution kernel. The residual connection is used to alleviate the gradient vanishing and gradient exploding problems that occur with the increase of network depth. Then, a 2×2 pooling module is used to downsample the features to eliminate redundant information in the features. Finally, a hybrid attention module is used to establish the relationship between long-distance dependencies and channels.
6. The two-stage image restoration method based on the codec structure according to claim 5, characterized in that: The decoding module performs layer normalization and then uses a 1×1 convolution kernel for dimensionality reduction, uses a 3×3 convolution kernel for feature extraction, the 3×3 convolution kernel is connected with an activation function module and a channel attention module, and then uses a 1×1 convolution kernel for dimensionality increase and residual connection, then performs layer normalization and uses a Pixel Shuffle module for upsampling, and finally passes through a hybrid attention module.
7. The two-stage image restoration method based on the codec structure according to claim 6 is characterized in that: The feature fusion module adopts weighted feature fusion to perform feature fusion. It multiplies two features and uses the sigmoid function to increase the nonlinearity of the model. Finally, a weighted parameter is generated to guide the fusion of features. The output formula of the feature fusion module is as follows: out = c·a+(1-c)·b; Among them, c = σ(a·b), σ represents the sigmoid function, a and b are input features, c is the weight, weight c can control the importance of feature a, and weight (1-c) controls the importance of feature b.
8. The two-stage image restoration method based on the codec structure according to claim 7, characterized in that: The hybrid attention module first performs layer normalization on the input features, then uses a multi-head self-attention module and a channel attention module to capture information in the features, uses a residual connection to fuse the output of the channel self-attention module with the input features of the hybrid self-attention module as the output of the first part, normalizes the output of the first part, and then inputs it into a multi-layer perceptron to obtain the output of the second part, and fuses the output of the first part with the output of the second part using a residual link to obtain the output of the hybrid attention module.
9. The two-stage image restoration method based on the codec structure according to claim 8, characterized in that: The S3 comprises the following steps: The L1 and MSE mixed loss functions are used in training. For the real high-quality image I of size m×n and the image K output by the model, the expression of the MSE loss function is: The expression of L1 loss function is: Where i, j are the pixel coordinates of the image; The mixed loss function is: The reference indicators used in training are peak signal-to-noise ratio and structural similarity. The calculation formula of peak signal-to-noise ratio is: in, is the possible maximum pixel value of the image; The formula for calculating structural similarity is: Among them, x and y are samples, μ x is the mean of x, μ y is the mean of y, is the variance of x, is the variance of y, σ xy is the covariance of x and y, c1=(K1L) 2 and c2=(K2L) 2 are two constants, L is the range of pixel values, K1=0.01, K2=0.03; Each time the structural similarity is calculated, an N×N window is taken from the image, and then it is continuously slid for calculation, and finally the average value is calculated as the global structural similarity.
Citation Information
Cited By
SAR interference intelligent reconstruction method and system based on complex signal domain coding and decoding network
CN119620073A
Medical image restoration method and device, computer equipment and storage medium
CN120707437A
