Image restoration methods based on linear attention and knowledge distillation
By employing an image restoration method based on linear attention and knowledge distillation, and using a teacher network to train a student network through knowledge distillation, the problems of high computational complexity and low training efficiency in the image restoration process are solved, achieving high-efficiency image restoration results and saving computational resources.
Patent Information
- Application Number
- CN202510714980.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2045-05-30
AI Technical Summary
Existing image restoration methods suffer from high computational complexity and low model training efficiency. In particular, the computational cost is too high when running on resource-limited devices, making it difficult to meet the actual needs of large-scale image restoration tasks.
An image restoration method based on linear attention and knowledge distillation is adopted. The teacher network is obtained by iteratively training a sample image dataset. The teacher network is then used to perform knowledge distillation to adjust the parameters of the student network until the preset conditions are met, thus obtaining a trained student network for image restoration.
While maintaining low computational complexity, we can improve image restoration quality, reduce computational resource consumption, and enhance the applicability and efficiency of the model.
Smart Images

Figure CN120563348B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and more specifically to an image restoration method based on linear attention and knowledge distillation. Background Technology
[0002] Currently, image restoration methods primarily rely on deep learning models, especially convolutional neural networks and Transformer models, which have achieved significant results in improving image restoration quality. However, with increasing image resolution and data scale, these models often face problems of high computational complexity and low training efficiency, especially when running on resource-constrained devices, where computational costs become excessively high. While increasing network size and depth can improve restoration results, this leads to a significant increase in the number of model parameters and computational overhead, making it difficult to meet the practical needs of large-scale image restoration tasks. Despite the application of optimization algorithms, the efficiency problem has not been effectively solved. Therefore, how to reduce the computational complexity of image restoration models while maintaining image restoration quality has become an urgent problem to be solved in current technology. Summary of the Invention
[0003] This application provides an image restoration method based on linear attention and knowledge distillation, which aims to address the technical problems of high computational complexity and low model training efficiency in the image restoration process in the prior art.
[0004] In view of the above problems, this application provides an image restoration method based on linear attention and knowledge distillation.
[0005] This application provides an image restoration method based on linear attention and knowledge distillation, the method comprising:
[0006] A sample image dataset is obtained, and iterative training is performed based on the sample image dataset to obtain a trained teacher network. The teacher network includes a teacher network input layer, a first image preprocessing module, multiple visual Transformer modules, a first image postprocessing module, and a teacher network output layer connected in sequence. The trained teacher network is used to perform knowledge distillation on the student network, and the parameters of the student network are adjusted using the student network training loss function until preset conditions are met to obtain a trained student network. The student network is then used to reconstruct the image.
[0007] One or more technical solutions provided in this application have at least the following technical effects or advantages:
[0008] This application obtains a sample image dataset, performs iterative training based on the dataset to obtain a trained teacher network. The teacher network includes a teacher network input layer, a first image preprocessing module, multiple visual Transformer modules, a first image post-processing module, and a teacher network output layer, all connected sequentially. The trained teacher network is used to perform knowledge distillation on a student network, and the parameters of the student network are adjusted using the student network training loss function until preset conditions are met, resulting in a trained student network. This student network is then used to reconstruct images. This invention addresses the technical problems of high computational complexity and low model training efficiency in image reconstruction in existing technologies. By utilizing the teacher network for knowledge distillation, the student network can mimic the feature representations of the teacher network while maintaining low computational complexity, thus improving image reconstruction quality, reducing computational resource consumption, and enhancing the applicability and efficiency of the model. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 A schematic diagram of the image restoration method based on linear attention and knowledge distillation provided in this application embodiment;
[0011] Figure 2 This is a schematic diagram illustrating the process of obtaining a trained teacher network in the image restoration method based on linear attention and knowledge distillation provided in the embodiments of this application. Detailed Implementation
[0012] This application provides an image restoration method based on linear attention and knowledge distillation, which addresses the technical problems of high computational complexity and low model training efficiency in the image restoration process in the prior art. By utilizing the teacher network for knowledge distillation, the student network can imitate the feature representation of the teacher network while maintaining low computational complexity, thereby improving the image restoration effect. This achieves the technical effect of improving image restoration quality, reducing computational resource consumption, and enhancing the applicability and efficiency of the model.
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0014] It should be noted that any variation of the terms "comprising" and "having" is intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0015] Examples, such as Figure 1 As shown, this application provides an image restoration method based on linear attention and knowledge distillation, the method comprising:
[0016] Step S100: Obtain a sample image dataset, perform iterative training based on the sample image dataset, and obtain a trained teacher network. The teacher network includes a teacher network input layer, a first image preprocessing module, multiple visual Transformer modules, a first image postprocessing module, and a teacher network output layer connected in sequence.
[0017] In this embodiment, a sample image dataset is first obtained, that is, the image data to be restored is obtained from a preset dataset. The sample image dataset contains multiple images with noise, blur, or other distortions, and each image has a corresponding real image to be restored (target image). Then, these image data are repeatedly input into the teacher network for learning through iterative training.
[0018] Specifically, during training, a single training sample set is first extracted, that is, a predetermined number of images are selected from the sample image dataset as input for each training iteration. Each training sample set includes multiple images to be restored and their corresponding restored image data. The number of images in a single training sample set is a positive integer. Next, the single training sample set is input to the input layer of the teacher network, which is responsible for receiving image data. The input image data undergoes preliminary processing by the first image preprocessing module. The images are subjected to denoising, enhancement, or other processing methods such as convolution operations to obtain preliminary feature output, where W represents the image width, H represents the height, and C represents the number of convolution channels.
[0019] The processed feature data is then input into multiple visual Transformer modules. These Transformer modules are responsible for deep analysis of image features using a self-attention mechanism. Each visual Transformer module processes the image at different levels during feature extraction, thus the data input to each module gradually becomes more complex. The output of each visual Transformer module is passed to subsequent modules for processing.
[0020] Finally, the outputs of all the visual Transformer modules are input into the first image post-processing module. The function of this module is to further refine the features processed by the Transformer modules, and ultimately recover clear image data.
[0021] Based on the single training sample set from each training session, and combined with the training loss function of the teacher network, the difference between the teacher network output and the target reconstructed image is calculated. Gradient descent is then used for optimization, progressively adjusting the parameters of the teacher network to obtain the final trained teacher network.
[0022] Furthermore, such as Figure 2 As shown, the method provided in the application embodiment, which involves obtaining a sample image dataset, performing iterative training based on the sample image dataset to obtain a trained teacher network, further includes:
[0023] A preset amount of sample image data for a single training session is extracted from the sample image dataset as a single training sample set. ,in, For the first One image data to be recovered, In order to be with the first The recovered image data corresponding to each image data to be recovered The number of sample image data in a single training sample set. The value is a positive integer; the single training sample set is... The image is preprocessed using the first image preprocessing module after being input into the teacher network input layer to obtain output features. Where W and H are the width and height of the image, respectively, and C represents the number of convolution channels; the output features Input the first of the multiple visual Transformer modules The analysis is performed in a visual Transformer module, and the output is... ,in, It is a positive integer; it represents the output of multiple visual Transformer modules. The first image post-processing module is input to obtain the restored image data. Based on a single training sample set The parameters of the teacher network are adjusted by combining the teacher network training loss function, and the model is updated using the gradient descent algorithm to obtain the trained teacher network.
[0024] In this embodiment, sample image data of a predetermined single training data volume is first extracted from the sample image dataset as a single training sample set. Each sample set contains multiple image pairs, wherein each image data to be recovered ( ) is an input image to be recovered, and its corresponding recovered image data ( The image to be restored is the ideal image, which is the target of network training. The image to be restored usually contains distortions such as noise and blur, and the goal is to use the network to restore a near-realistic and clear image. The size of a single training sample set is a positive integer. , representing the number of images used in each training iteration. The extracted training sample data is sequentially input into the teacher network for training. The teacher network is trained iteratively, meaning that the network parameters are adjusted with each training iteration until the desired training effect is achieved.
[0025] Next, each image data to be recovered from the single training sample set ( The image data is input to the input layer of the teacher network. After receiving the image data, the input layer of the teacher network first processes it through a first image preprocessing module. The purpose of preprocessing is to denoise, enhance, or otherwise transform the image so that the network can process image information more effectively. Image preprocessing uses convolutional layers in a convolutional neural network (CNN) for feature extraction. Specifically, a 3×3 convolutional kernel is used to process the input image, and the size of the output feature is... , where W and H are the width and height of the image, respectively, C represents the number of channels after the convolution operation, and represents the depth of the output features.
[0026] The processed feature data is input into multiple visual Transformer modules for deep analysis. Each visual Transformer module uses a self-attention mechanism to capture global information in the image, thereby improving image restoration performance. Within each visual Transformer module, the input features are first normalized, then extracted through 1×1 and 3×3 convolutions. After these convolutions, the input features are averaged across channels, and an attention map is calculated. This process helps capture long-range dependencies in the image, enabling the network to model the connections between different regions, thus improving the quality of image restoration. The output of each visual Transformer module is then passed to the next module for further feature extraction. Multiple visual Transformer modules are stacked layer by layer, progressively extracting more complex image features.
[0027] After multiple visual Transformer modules complete feature extraction, the output is fed into the first image post-processing module for final image restoration. Image post-processing typically uses convolution operations to refine the extracted image features, transforming them into a clear restored image. Specifically, the post-processing module uses 1×1 and 3×3 convolution operations to further process the features, recovering the detailed information in the image and generating the restored image data. These output restored image data represent the prediction results of the teacher network, indicating the network's success in restoring the image to be restored.
[0028] Then, based on the restored image output by the teacher network ( ) and the real restored image ( The difference between the predicted and target images is used to calculate the training loss function. The calculated loss value guides the update of the network parameters. Specifically, using the error calculated by the loss function, the parameters of the teacher network are optimized using a gradient descent algorithm (such as the Adam optimizer). In each training iteration, the network calculates gradients and updates its parameters through backpropagation to gradually reduce the difference between the predicted and target images. This process is repeated across multiple training iterations, eventually resulting in a trained teacher network capable of efficiently reconstructing images. Through these steps, the teacher network can progressively optimize its parameters to meet the requirements of the image reconstruction task, ultimately reconstructing the image to be reconstructed using the learned features.
[0029] Furthermore, in the method provided in the application embodiments, the teacher network training loss function is: ;in, The number of sample image data in a single training sample set. For the amount of network loss for teachers, The first output for teachers' network The output is the recovered image data. For a single training sample set One image data recovery.
[0030] In this embodiment of the application, the teacher network training loss function is: ;in The number of sample image data in a single training sample set. For the amount of network loss for teachers, The first output for teachers' network The output is the recovered image data. For a single training sample set One image data recovery.
[0031] The loss function calculates the predicted image ( ) and real images ( The difference between the predicted and actual images is used to quantify the network's performance, thus providing a basis for network optimization. During training, the network's goal is to minimize this loss function, making the predicted image as close as possible to the real image. Through this loss function, the teacher network can understand the gap between its output and the expected result, and thus update the network parameters using the gradient descent algorithm. The gradient descent algorithm calculates the gradient of the error through backpropagation and updates the network parameters based on the gradient to minimize the value of the loss function, continuously reducing the difference between the network output and the real image. As training progresses, the network gradually learns better image restoration strategies and ultimately achieves accurate restoration of the image to be restored.
[0032] Furthermore, in the method provided in the application embodiments, the output features are... Input the first of the multiple visual Transformer modules The analysis is performed in a visual Transformer module, and the output is... It also includes:
[0033] Output features After layer standardization, the result is... ; After a 1×1 convolution, the output features are obtained. ; After a 3×3 convolution, the output features are obtained. ;Will Divide into equal sections according to the channel , and Calculate attention Output attention map ; The output is obtained after processing through one 1×1 convolution, one 3×3 convolution, and one 1×1 convolution. .
[0034] In this embodiment of the application, the features are first output. After standardization, the following is obtained: Where W and H are the width and height of the image, and C is the number of feature channels. Then, after a 1×1 convolution, the output features are obtained. .
[0035] Then, After further processing with a 3×3 convolution layer, we obtain Through this convolution operation, the model can capture more complex local spatial features in the image, thereby improving the quality of image restoration. Divide the channel into equal parts to obtain
[0036] Next, features , and Then, attention weights are calculated. This is used to weight these segmented features. Attention calculation is based on a formula. The calculation is performed. Here, q and k are the query and key vectors, and v is the value vector. The softmax function normalizes the weights, thereby adjusting the focus on features and allowing the model to concentrate more on the important parts.
[0037] Finally, the attention weights are calculated. Used to weight feature v, to obtain the weighted output feature. ,Right now Then, these weighted features The image will undergo a series of convolutional processes, including 1×1 convolution, 3×3 convolution, and 1×1 convolution, to finally obtain the restored output image features. .
[0038] Step S200: Use the trained teacher network to perform knowledge distillation on the student network, and use the student network training loss function to adjust the parameters of the student network until the preset conditions are met, thereby obtaining the trained student network, and use the student network to restore the image.
[0039] In this embodiment, a single training sample set is first input into the already trained teacher network, which generates image reconstruction features through its multiple visual Transformer modules. These features are extracted during the generation process and used as target features for the student network to learn. Next, the single training sample set is also input into the input layer of the student network, where image preprocessing is performed by a second image preprocessing module to obtain the output features of the student network. The student network then passes these output features to multiple linear Transformer modules for analysis, generating corresponding output results. In this way, the student network gradually imitates the features of the teacher network during the learning process.
[0040] Then, the output of the student network is processed by the second image post-processing module to obtain the restored image data. This restored image data is compared with the target image data in the single training sample set, and the error is calculated using the training loss function of the student network, taking into account the output features of the teacher network during the generation process. This loss function considers the difference between the student network output and the real image, as well as the difference between the student network output and the teacher network output.
[0041] Using the gradient descent algorithm, the parameters of the student network are adjusted based on the feedback from the loss function, optimizing the model's performance until a preset stopping condition or loss threshold is met. Finally, after multiple rounds of iterative training, the student network completes the knowledge distillation process, resulting in a trained student network model capable of independently reconstructing images.
[0042] Furthermore, in the method provided in the application embodiments, knowledge distillation is performed on the student network using the trained teacher network, and the parameters of the student network are adjusted using the student network training loss function until preset conditions are met to obtain the trained student network. The method also includes:
[0043] The single training sample set By inputting the trained teacher network, we obtain the output features of multiple visual Transformer modules of the teacher network during the generation process. The single training sample set The input layer of the student network is used for image preprocessing, and the second image preprocessing module is used to output features. ,in and These are the width and height of the image, respectively. Indicates the number of convolution channels; the output features Input multiple linear Transformer modules The analysis is performed in a linear Transformer module, and the output is... ,in, It is a positive integer. The total number of linear Transformer modules; the output results of multiple linear Transformer modules. The second image post-processing module inputs the student network data to obtain the restored image data. Based on the output image data Single training sample set Output features of multiple visual Transformer modules in the teacher network during the generation process The parameters of the student network are adjusted by combining the student network training loss function, and the network parameters are updated using the gradient descent algorithm to obtain the trained student network.
[0044] In this embodiment of the application, the single training sample set is first... By inputting the trained teacher network, we obtain the output features of multiple visual Transformer modules of the teacher network during the generation process. These features represent the deep-seated characteristics of the teacher network in the image restoration process.
[0045] Next, we will use the single training sample set. The input layer of the student network processes the input image through a second image preprocessing module to obtain output features. ,in and These are the width and height of the image, respectively. This indicates the number of convolution channels. The second image preprocessing module performs denoising, enhancement, and other processing on the input image through convolution operations and other image processing techniques, providing more suitable feature representations for subsequent image restoration.
[0046] These processed features The results are then fed into multiple linear Transformer modules for further analysis. The output of each linear Transformer module is... ,in, It is a positive integer. This represents the total number of linear Transformer modules. Unlike traditional visual Transformer modules, linear Transformer modules reduce computational complexity through a simplified self-attention mechanism while still effectively extracting global information and important features from the image. Through the analysis of multiple linear Transformer modules, the student network gradually transforms the complex information of the image into a low-dimensional feature representation.
[0047] The output of these linear Transformer modules The second image post-processing module of the student network finally generates the restored image data. The first image is the output of the image restoration. The second image post-processing module further adjusts the features through a series of convolution operations and activation functions, making the restored image closer to the real image.
[0048] Based on the restored image With real images The difference between the student network's output and the real image is used to calculate the training loss function. This loss function considers not only the difference between the student network's output and the real image, but also the difference between the student network's output and the teacher network's output. Through this multi-loss mechanism, the student network gradually adjusts its parameters to mimic the behavior of the teacher network and optimize the image restoration quality. Using the gradient descent algorithm, the student network's parameters are updated based on the feedback from the loss function until preset training conditions are met, such as the loss function value reaching a certain threshold or a predetermined number of iterations. After multiple training and parameter updates, the student network gradually approximates the performance of the teacher network and demonstrates high performance in image restoration tasks.
[0049] Ultimately, the trained student network can independently perform image restoration tasks and restore near-realistic images with low computational complexity, thus obtaining a fully trained student network.
[0050] Furthermore, in the method provided in the application embodiment, the student network training loss function is: ;in, For the amount of network loss for students, Output the network and the truth loss function to the student network. The loss function is defined for the student network output and the teacher network output. Let the loss function be the feature output of the student network and the feature output of the teacher network. and It is used for regulation and The weight parameters.
[0051] In this embodiment, during the training of the student network, a loss function is used to measure the difference between the student network output and the target (including the real image, the teacher network output, and the teacher network feature output). Specifically, the loss function of the student network... Defined as .in, It is the total loss function of the student network, which includes , and . The student network output and ground truth loss function measures the difference between the student network output image and the real image. It is calculated using an image recovery loss function (such as mean squared error or cross-entropy loss) to ensure that the image recovered by the student network is as close to the real image as possible. This is the loss function between the student network output and the teacher network output. This loss function helps the student network learn the behavior and characteristics of the teacher network by measuring the difference between the image recovered by the student network and the image output by the teacher network, thereby enhancing the student network's recovery ability through knowledge distillation techniques. The loss function is the feature output of the student network and the feature output of the teacher network. Similarly, this part of the loss function calculates the difference between the student network and the teacher network in extracting image features. By matching the feature outputs, the student network can more accurately simulate the feature extraction process of the teacher network.
[0052] and It is used for regulation and The weight parameters are used to balance the learning of image restoration by the student network with its ability to effectively mimic the output characteristics of the teacher network. By adjusting these weights, the influence of various parts of the loss function can be flexibly controlled, thereby achieving optimal student network training.
[0053] Furthermore, the method provided in the application embodiments also includes:
[0054] Output features After layer standardization, the result is... ;Will Linear mapping to Where A represents the weight parameter and b represents the bias term; calculate This indicates extracting the diagonal elements of the matrix; calculating... ;calculate ,in, Represents element-wise product; The output is obtained after processing through one 1×1 convolution, one 3×3 convolution, and one 1×1 convolution. .
[0055] In this embodiment of the application, firstly, the output features are... After layer standardization, we obtain Next, we will discuss the features. Linear transformation, i.e., through matrix multiplication , where A represents the weight parameter and b represents the bias term.
[0056] Subsequent features After processing, we obtain ,in, This step extracts the diagonal elements of the matrix, highlighting the most important features and assigning them higher weights. The softmax function transforms the input feature values into a probability distribution, thus assigning different levels of attention to different features.
[0057] Next, calculate This step calculates a scalar value through a dot product operation. This value reflects the importance of the feature in the current step. The attention weights are then calculated using a formula. ,in It shows element-wise product. The feature is scaled as a scalar value, thus adjusting the contribution of each element. Ultimately, through this operation, the model weights different parts according to the relative importance of the features.
[0058] Finally, the calculated attention The input is then passed to a convolutional layer for further processing. First, the input undergoes 1×1 convolutions, 3×3 convolutions, and a final 1×1 convolution to progressively extract image features and ultimately generate the restored image features. Complete the image restoration task.
[0059] In summary, the embodiments of this application have at least the following technical effects:
[0060] This application obtains a sample image dataset, performs iterative training based on the dataset to obtain a trained teacher network. The teacher network includes a teacher network input layer, a first image preprocessing module, multiple visual Transformer modules, a first image post-processing module, and a teacher network output layer, all connected sequentially. The trained teacher network is used to perform knowledge distillation on a student network, and the parameters of the student network are adjusted using the student network training loss function until preset conditions are met, resulting in a trained student network. This student network is then used to reconstruct images. This invention addresses the technical problems of high computational complexity and low model training efficiency in image reconstruction in existing technologies. By utilizing the teacher network for knowledge distillation, the student network can mimic the feature representations of the teacher network while maintaining low computational complexity, thus improving image reconstruction quality, reducing computational resource consumption, and enhancing the applicability and efficiency of the model.
[0061] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are possible or may be advantageous.
[0062] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0063] This specification and accompanying drawings are merely illustrative examples of this application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from its scope. Therefore, if such modifications and modifications fall within the scope of this application and its equivalents, this application intends to include such modifications and modifications.
Claims
1. An image restoration method based on linear attention and knowledge distillation, characterized in that, The method comprises: obtaining a sample image data set, iteratively training based on the sample image data set to obtain a trained teacher network, wherein the teacher network comprises a teacher network input layer, a first image preprocessing module, a plurality of visual Transformer modules, a first image post-processing module and a teacher network output layer connected in sequence; using the trained teacher network to perform knowledge distillation on a student network, and adjusting the parameters of the student network using a student network training loss function until a preset condition is met to obtain a trained student network, and using the student network to restore an image, comprising: obtaining a plurality of visual Transformer modules of the teacher network inputting the trained teacher network to obtain output features of the plurality of visual Transformer modules of the teacher network in a generation process ; The single training sample set is input into the student network input layer An image preprocessing module is used to preprocess the image, and the feature is output Wherein And Width and height of the image, respectively Indicates the number of convolution channels outputting the output feature analyzing in a qth linear Transformer module of the plurality of linear Transformer modules, outputting wherein, is a positive integer, is a total number of linear Transformer modules; output results of a plurality of linear transformer modules inputting a second image post-processing module of the student network to obtain output recovered image data ; Recovering image data according to output , single training sample set And the output features of the multiple visual Transformer modules of the teacher network in the generation process The parameters of the student network are adjusted in combination with the student network training loss function, and the network parameter is updated by using a gradient descent algorithm to obtain a trained student network. Output features After layer normalization ; will be described below. linear mapping to = where A represents a weight parameter and b represents a bias term. Computing , denotes the diagonal elements of the extraction matrix; Computing wherein, is a scalar value; Computing wherein, denotes an element-wise product, is an attention weight; Will The output is obtained after processing through one 1×1 convolution, one 3×3 convolution, and one 1×1 convolution. .
2. The image restoration method based on linear attention and knowledge distillation according to claim 1, wherein, obtaining a sample image data set, iteratively training based on the sample image data set to obtain a trained teacher network, comprising: extracting sample image data of a preset single training data amount from the sample image data set as a single training sample set wherein, is the i-th to-be-restored image data, is the i-th to-be-restored image data, is the i-th to-be-restored image data, is the i-th to-be-restored image data, is the number of sample image data in the single training sample set, is a positive integer; The single training sample set is obtained The input layer of the teacher network is input, and image preprocessing is performed on the first image preprocessing module to obtain an output feature Wherein W and H are the width and height of the image respectively, and C represents the number of convolution channels. outputting the output feature inputting the output feature into a jth visual Transformer module in the plurality of visual Transformer modules for analysis, and outputting wherein, is a positive integer; output results of a plurality of visual transformer modules inputting a first image post-processing module to obtain output restored image data ; According to the single training sample set The parameters of the teacher network are adjusted in combination with a teacher network training loss function, and a gradient descent algorithm is used for model updating to obtain a trained teacher network.
3. The image restoration method based on linear attention and knowledge distillation of claim 2, wherein, The teacher network training loss function is: ; Wherein, N is the number of sample image data in a single training sample set, is the teacher network loss amount, is the first output of the teacher network after recovery image data, is the first output of the teacher network after recovery image data, is the first recovery image data of the single training sample set, is the first recovery image data of the single training sample set.
4. The image restoration method based on linear attention and knowledge distillation of claim 2, wherein, outputting the output feature inputting the output feature into a jth visual Transformer module in the plurality of visual Transformer modules for analysis, and outputting comprising: output features layer normalization ; After a 1x1 convolution, the output feature ; After a 3x3 convolution, the output feature ; Will Cut into , And , calculate attention , output attention map ; The output is obtained by processing through one layer of 1x1 convolution, one layer of 3x3 convolution, and one layer of 1x1 convolution .
5. The image restoration method based on linear attention and knowledge distillation of claim 1, wherein, The student network training loss function is: ; wherein, is the loss for the student network, is the loss function for the student network output and the true value, is the loss function for the student network output and the teacher network output, is the loss function for the student network feature output and the teacher network feature output, and are weight parameters for adjusting and respectively.
Citation Information
Patent Citations
Multi-perception attention network image defogging method based on knowledge guidance
CN117557473A
SAR (Synthetic Aperture Radar) image recognition method based on mask self-distillation network and related device
CN118429825A