Video image anti-shake method based on attention network and phase correlation

Through the hybrid spatial transformation blurred image restoration model and phase correlation technology based on the attention network, the problems of high computational resource consumption and poor noise image effects in jittery video processing are solved, and efficient video deshaking processing on miniaturized devices is achieved, improving Improve the stability and visual quality of video images.

CN118822901APending Publication Date: 2024-10-22NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410838491.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

The existing technology consumes a lot of computing resources when processing shaky videos, and the traditional phase correlation method has poor effect on noisy images, making it difficult to effectively process blurred videos on miniaturized devices.

Method used

A hybrid space transformation blurred image restoration model and discriminant model based on attention network are used for knowledge distillation, a lightweight student model is constructed, and phase correlation technology is combined to debounce video frames.

Benefits of technology

It achieves efficient processing of blurred videos on devices with limited computing resources, improves the stability and visual quality of video images, and is suitable for miniaturized embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118822901A_ABST
    Figure CN118822901A_ABST
Patent Text Reader

Abstract

The invention discloses a video image anti-shake method based on an attention network and phase correlation. The video image anti-shake method comprises the following steps: constructing a mixed attention network-based spatial transformation blurred image restoration model GT and a discrimination model DT as teacher models; carrying out distillation processing on the teacher model by utilizing a knowledge distillation model compression technology, predicting a clear image through a discrimination model DT in a distillation process, and carrying out confrontation with the discrimination model DT through a restoration model GT to enable a student model to learn distribution of the clear image so as to obtain a lightweight student model; using a student model to process a fuzzy video frame obtained by video minute hand, and restoring a fuzzy image; and sending the restored image to an image post-processing module, registering the restored image with two adjacent frames of images through a phase correlation technology, and outputting a shake-free video, thereby realizing anti-shake processing of the video image, effectively improving blurred image restoration efficiency, and enhancing stability and visual quality of the video image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer vision and digital image processing, and in particular to a video image anti-shake method based on an attention network and phase correlation. Background Art

[0002] In real-life scenarios such as daily photography, space remote sensing, and military reconnaissance, video jitter is often caused by platform instability, which is reflected in the blurring of video frames and the displacement of adjacent frames, affecting the observation of image texture details. At the same time, during the migration and deployment of algorithms, the memory and computing power of miniaturized embedded devices are limited. Therefore, it is necessary to design an effective lightweight image deblurring and image registration algorithm to process such jittery videos to improve their use value.

[0003] The network model based on the self-attention mechanism has made some progress in the field of computer vision. Compared with the previous network based on convolution operation, it can more effectively extract the feature connection between distant pixels or regions of the image. However, the current popular deep learning-based methods generally have huge redundancy in the design of neural network structures and parameters, which will lead to a sharp increase in computing resource consumption and time cost when processing high-resolution images, which has greatly hindered the deployment of blurred image restoration algorithms on computing resource-constrained devices. In recent years, the network lightweight method of knowledge distillation has made some progress in the field of computer vision. The knowledge distillation method is used to compress the blurred image restoration algorithm to speed up its operation efficiency.

[0004] The traditional phase correlation method is based on ideal conditions and has poor effects or even fails completely for real-life images with random noise and non-ideal sampling. Therefore, a video image stabilization method based on attention network and phase correlation is urgently needed to solve the above problems. Summary of the invention

[0005] The purpose of the present invention is to provide a video image stabilization method based on attention network and phase correlation, which can effectively solve the problems existing in the above-mentioned prior art.

[0006] In order to solve the above technical problems, the present invention adopts the following technical solution: A video image stabilization method based on attention network and phase correlation includes the following steps:

[0007] Train the hybrid attention network-based spatial transformation blurred image restoration model GT and the discriminant model DT as the teacher model to build the student model;

[0008] The teacher model is distilled using the model compression technology of knowledge distillation. During the distillation process, the discriminant model DT is used to predict the clear image, and the restoration model GT is used to compete with it so that the student model learns the distribution of the clear image and obtains a lightweight student model.

[0009] Use the student model to process the blurred video frames obtained by video segmentation and restore the blurred images;

[0010] The restored image is sent to the image post-processing module, and the restored image is aligned with the two adjacent frame images through phase correlation technology to output the de-shaking video.

[0011] Preferably, the method further comprises constructing a supervised fuzzy image dataset, wherein the supervised fuzzy image dataset comprises a clear image domain dataset and a fuzzy image domain dataset, and the image contents in the clear image domain dataset and the fuzzy image domain dataset correspond to each other one by one;

[0012] The corresponding images in the clear image domain dataset and the blurred image domain dataset are used for training and distillation operations.

[0013] Preferably, the teacher model training process includes:

[0014] In the framework of generative adversarial network, a spatial transformation blurred image restoration model GT based on hybrid attention network is established, and a discriminative model DT is established;

[0015] The spatial transformation blurred image restoration model GT is used to restore the blurred image to obtain the restored image, and the discriminant model DT is used to calculate the teacher model comprehensive loss between the restored image of the spatial transformation blurred image restoration model GT and the clear image;

[0016] Use the teacher model comprehensive loss value to back-propagate the gradient and update the parameter values ​​of the spatial transformation blur image restoration model GT and the discriminant model DT;

[0017] Repeat the above operation until the comprehensive loss value of the teacher model converges, and obtain the spatial transformation blurred image restoration model GT and the discriminant model DT in the teacher model.

[0018] Preferably, the distillation process comprises:

[0019] The student model obtained by distilling the restoration model GT is used to restore the blurred image to obtain the restored image, and the discriminant model DT is used to calculate the comprehensive loss of the student model between the restored image of the student model and the clear image;

[0020] Back propagation is used to calculate the gradient of the comprehensive loss value of the student model, and the parameter values ​​of the student model are updated;

[0021] Repeat the above operation until the comprehensive loss function value of the student model converges to obtain a lightweight student model distilled from the teacher model.

[0022] Preferably, the restoration model GT is mainly composed of a hierarchical encoding network, a feature extraction network and a decoding network connected in a U-shaped architecture; and

[0023] The feature extraction network includes a convolution module and a deconvolution module for downsampling and upsampling operations, and a hybrid attention module for feature processing operations;

[0024] The encoding and decoding network is mainly composed of an image encoding module, multiple downsampling modules, multiple feature extraction modules, multiple upsampling modules and an image decoding module in a U-shaped architecture;

[0025] Preferably, the image encoding module is mainly composed of a convolution layer and an image encoder connected in sequence, the convolution layer converts the input image from a single-channel grayscale image or a 3-channel color image into a 32-channel feature map, and keeps the size of the feature map consistent with the size of the input image by expansion, and the image encoder compresses the input image spatial dimension and inverts the spatial dimension and channel dimension;

[0026] The downsampling module is mainly composed of an image decoder, a convolution layer and an image encoder connected in sequence. The convolution layer increases the number of channels of the input feature to twice the original number, and the convolution kernel movement step is set to 2 for double downsampling;

[0027] The feature extraction module is mainly composed of a hybrid attention layer and a linear mapping layer connected in sequence, wherein the hybrid attention layer integrates a global attention modulator and a window multi-head self-attention mechanism; the multi-head self-attention mechanism first passes the input features through LayerNorm and then performs non-overlapping window segmentation according to a given window size, and then calculates the self-attention within the window and the self-attention between windows respectively for superposition, and the linear mapping layer passes the output features of the hybrid attention layer through LayerNorm and the local enhancement window module in sequence to obtain the output features;

[0028] The upsampling module is mainly composed of an image decoder, a deconvolution layer, an image encoder and a jump connection in sequence. The jump connection splices the input features of the corresponding downsampling module with the input features of the module at the channel position. The deconvolution layer reduces the spliced ​​feature map channel to half of the original. The convolution kernel movement step is set to 2 for double upsampling.

[0029] The image decoding module is mainly composed of an image decoder, a convolutional layer and a residual connection connected in sequence. The image decoder flattens the output features to the original size and converts the spatial dimension and channel dimension. The convolutional layer converts the image decoder output feature map channel into the number of input image channels of the network. The residual connection adds the input image to the convolutional layer output to obtain the output image.

[0030] Preferably, the number of the down-sampling modules and the up-sampling modules is the same and there is a jump connection between the corresponding down-sampling modules and up-sampling modules, and a feature extraction module is connected before each down-sampling module and up-sampling module.

[0031] Preferably, the number of mixed attention modules of each resolution of the student model is improved from N1=1, N2=2, N3=8, N4=8, N5=2 of the teacher restoration model GT to N1=1, N2=1, N3=2, N4=2, N5=4, wherein the resolution of the feature map processed from N1 to N5 increases by two times step by step;

[0032] The student model reduces the number of channels of the first-layer feature map from 32 to 8, and the feature maps of each subsequent resolution double in number, with the number of channels in the innermost layer reduced from 512 to 128.

[0033] The local enhancement window module in the student model uses depthwise separable convolution to reduce the number of convolution parameters and computational cost, and the convolution kernel size is set to 3×3;

[0034] Among them, the computational compression ratio of the depthwise separable convolution and the convolution layer is determined according to the following formula:

[0035]

[0036] Among them, K is the size of the convolution kernel, H, W, and C are the height, width, and number of channels of the input feature map, respectively.

[0037] Preferably, the comprehensive loss value L of the teacher model T Including adversarial loss, content loss and edge loss: L T =L GAN +μ1L CONT +μ2L EDGE ;

[0038] The migration loss is based on WGAN-GP and is calculated as:

[0039]

[0040] The content loss is based on Charbonnier and is calculated as:

[0041]

[0042] The edge loss is based on the edge loss function of MPRNet, and the calculation formula is:

[0043]

[0044] Among them, x and x~ represent the clear image and the restored image obtained by the spatial transformation blurred image restoration model GT, respectively. is the random interpolation term between the clear image and the restored image, that is γ is a random number between 0 and 1, P g , P c and P i Respectively represent the data distribution of the restored image, the clear image and the interpolation term of the two, η represents the regularization coefficient of the loss gradient penalty term; Δ represents the Laplace operator; i is the image index; μ1 and μ2 represent the regularization coefficients of the content loss and the edge loss respectively; ε c , ε e , ε t represents the error term.

[0045] Preferably, the comprehensive loss value L includes migration loss, content loss and edge loss: L = L TRANS +γ1L CONT +γ2L EDGE ;

[0046] The migration loss is based on Charbonnier and is calculated as:

[0047]

[0048] The content loss is based on Charbonnier and is calculated as:

[0049]

[0050] The edge loss is based on the edge loss function of MPRNet, and the calculation formula is:

[0051]

[0052] Among them, x and denote the clear image and the restored image respectively, Δ denotes the Laplace operator; i is the image index; γ1 and γ2 denote the regularization coefficients of content loss and edge loss respectively; G S With D T Represent the student model and the teacher discriminant model DT respectively; x and y represent the input blurred image and its corresponding clear image respectively; ε c , ε e , ε t represents the error term.

[0053] Preferably, during the registration process of the restored image and two adjacent frames of images: the previous frame is the standard image f(x, y), and the current frame is the image to be registered g(x, y); the following operations are performed on the two in sequence:

[0054] In the spatial domain, a Blackman window is applied and DFT transformation is performed to obtain F(u,v) and G(u,v). The image frequency domain after low-pass filtering by a low-pass filter is:

[0055]

[0056] The two are weighted related using the weight matrix as the coefficient, which is determined according to the following formula:

[0057]

[0058] The weighted frequency domain correlation matrix Cw(u,v) is subjected to IDFT to obtain a weighted phase correlation coefficient matrix, which is used to perform sub-pixel precision registration and displacement of the talisman image.

[0059] Among them, u0, v0 are two opposite cutoff frequencies, w(u,v) is the weight matrix, and a is an exponential adjustment coefficient.

[0060] Beneficial effects: The model compression technology of knowledge distillation distills the teacher model to obtain a lightweight student model, so that it can be applied to miniaturized embedded devices, and the blurred frames obtained from the jittered video are restored with high quality and then registered, and stable high-quality videos are efficiently output, which has good practical value. In addition, the restored image is sent to the image post-processing module to further obtain a high-quality restored image. The restored image is registered with the two adjacent frames through phase correlation technology, and the de-shaking video is output, thereby realizing the anti-shake processing of the video image, which can effectively improve the efficiency of blurry image restoration and enhance the stability and visual quality of the video image. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0062] In the attached picture:

[0063] Figure 1 This is a flow chart of the video image anti-shake method of the present invention;

[0064] Figure 2 This is a schematic diagram of the distillation model architecture of the present invention;

[0065] Figure 3 This is a structural diagram of the hybrid attention network of the present invention;

[0066] Figure 4 This is a comparison diagram of two adjacent registered images of the present invention. DETAILED DESCRIPTION

[0067] The embodiments of the present invention are described below in conjunction with the drawings in the embodiments of the present invention. The terms used in the implementation mode of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention. The embodiments of the present application are described below in conjunction with the drawings.

[0068] Embodiment: A method for processing blurred images based on a hybrid attention network, such as Figure 1 As shown, including:

[0069] Step 1, obtain and construct a supervised fuzzy image dataset, which is a clear image domain dataset and a fuzzy image domain dataset, respectively denoted as X and Y, and the image contents in the two datasets correspond one to one;

[0070] Step 2: Under the framework of generative adversarial network, train the blurred image restoration teacher model, specifically:

[0071] In the framework of generative adversarial network, a spatial transformation blurred image restoration model GT based on hybrid attention network is established, and a discriminative model DT is established;

[0072] The spatial transformation blurred image restoration model GT is used to restore the blurred image to obtain the restored image, and the discriminant model DT is used to calculate the teacher model comprehensive loss between the restored image of the spatial transformation blurred image restoration model GT and the clear image;

[0073] Use the teacher model comprehensive loss value to back-propagate the gradient and update the parameter values ​​of the spatial transformation blur image restoration model GT and the discriminant model DT;

[0074] Repeat the above operation until the comprehensive loss value of the teacher model converges, and obtain the spatial transformation blur image restoration model GT and the discriminant model DT in the teacher model;

[0075] The comprehensive loss value of the teacher model L T Including adversarial loss, content loss and edge loss: L T =L GAN +μ1L CONT +μ2L EDGE ;

[0076] The migration loss is based on WGAN-GP and is calculated as:

[0077]

[0078] The content loss is based on Charbonnier and is calculated as:

[0079]

[0080] The edge loss is based on the edge loss function of MPRNet, and the calculation formula is:

[0081]

[0082] Among them, x and x~ represent the clear image and the restored image obtained by the spatial transformation blurred image restoration model GT, respectively. is the random interpolation term between the clear image and the restored image, that is γ is a random number between 0 and 1, P g , P c and P i Respectively represent the data distribution of the restored image, the clear image and the interpolation term of the two, η represents the regularization coefficient of the loss gradient penalty term; Δ represents the Laplace operator; i is the image index; μ1 and μ2 represent the regularization coefficients of the content loss and the edge loss respectively; ε c , ε e , ε t represents the error term;

[0083] Step 3: Build the student model GS and randomly initialize the GS parameters. The number of GS parameters is much smaller than that of GT.

[0084] Step 4: randomly sample paired clear images x and blurred images y from the supervised datasets X and Y, input the blurred images into the student model, obtain GS(y), and use the discriminant model DT to calculate the comprehensive loss of the student model between the restored image of the student model and the clear image;

[0085] The comprehensive loss value L of the student model includes migration loss, content loss and edge loss: L = L TRANS +γ1L CONT +γ2L EDGE ;

[0086] The migration loss is based on Charbonnier and is calculated as:

[0087]

[0088] The content loss is based on Charbonnier and is calculated as:

[0089]

[0090] The edge loss is based on the edge loss function of MPRNet, and the calculation formula is:

[0091]

[0092] Among them, x and denote the clear image and the restored image respectively, Δ denotes the Laplace operator; i is the image index; γ1 and γ2 denote the regularization coefficients of content loss and edge loss respectively; G S With D T Represent the student model and the teacher discriminant model DT respectively; x and y represent the input blurred image and its corresponding clear image respectively; ε c , ε e , ε t represents the error term;

[0093] Step 5: Use the comprehensive loss value of the student model to back propagate the gradient and update the parameter value of the student model;

[0094] Step 6: Repeat steps 4 to 5 until the comprehensive loss function value of the student model in step 5 converges, and obtain the lightweight student model GS distilled from the teacher model;

[0095] Step 7, using the student model GS obtained in step 6 to process the blurred video frame obtained by the video segmentation, and restore the blurred image;

[0096] Step 8: The image restored in step 7 is sent to an image post-processing module including phase correlation technology to further obtain a registered restored image, which can achieve video de-shaking.

[0097] In a specific embodiment, when a jittery video is input, the corresponding content is output to de-jitter, so as to realize video anti-shake processing. In step 1, a three-channel color image is selected as a supervised image data set. If the number of images in X and Y is lower than a preset value, X and Y are expanded by rotation and cropping. In the process of constructing a supervised image data set, for input images of different sizes, the blurred images are resized to the same size to facilitate subsequent network construction and calculation. In addition, in view of the insufficient image data in the data set, the present invention adopts rotation and cropping and other methods to perform data enhancement to expand X and Y. For example, for each picture in the data set, the clear image in X and the corresponding blurred image in Y are obtained by rotating a certain angle and cropping different areas of the picture to obtain a new "blurred image-clear image" pair, and added to X and Y respectively to realize data enhancement of the X and Y data sets.

[0098] Among them, the restoration model GT is mainly composed of a hierarchical encoding network, a feature extraction network and a decoding network connected in a U-shaped architecture; the feature extraction network includes a convolution module and a deconvolution module to perform downsampling and upsampling operations, and a hybrid attention module to perform feature processing operations; the encoding and decoding network is mainly composed of an image encoding module, multiple downsampling modules, multiple feature extraction modules, multiple upsampling modules and an image decoding module in a U-shaped architecture, in which the number of downsampling modules and upsampling modules is the same and there are jump connections between the corresponding downsampling modules and upsampling modules, and each downsampling module and upsampling module is connected to a feature extraction module.

[0099] The image encoding module is mainly composed of a convolutional layer and an image encoder connected in sequence. The convolutional layer converts the input image from a single-channel grayscale image or a 3-channel color image into a 32-channel feature map, and keeps the size of the feature map consistent with the input image size by expansion. The image encoder compresses the input image spatial dimension and inverts the spatial dimension and channel dimension.

[0100] The downsampling module is mainly composed of an image decoder, a convolutional layer, and an image encoder connected in sequence. The convolutional layer increases the number of channels of the input feature to twice the original number, and the convolution kernel movement step is set to 2 for double downsampling.

[0101] The feature extraction module is mainly composed of a hybrid attention layer and a linear mapping layer connected in sequence. The hybrid attention layer integrates the global attention modulator (Globally Attention Modulator, GAM) and the window multi-head self-attention mechanism; the multi-head self-attention mechanism first passes the input features through LayerNorm and then divides them into non-overlapping windows according to the given window size, and then calculates the self-attention within the window and the self-attention between windows respectively for superposition. The linear mapping layer passes the output features of the hybrid attention layer through LayerNorm and the locally enhanced window module (Locally-Enhanced Feed-Forward Network, LeFF) in sequence to obtain the output features;

[0102] The sampling module is mainly composed of an image decoder, a deconvolution layer, an image encoder and a jump connection in sequence. The jump connection concatenates the input features of the corresponding downsampling module with the input features of the module at the channel position. The deconvolution layer reduces the concatenated feature map channel to half of the original one, and the convolution kernel movement step is set to 2 for double upsampling.

[0103] The image decoding module is mainly composed of an image decoder, a convolutional layer and a residual connection connected in sequence, wherein the image decoder flattens the output features to the original size and converts the spatial dimension and channel dimension, the convolutional layer converts the image decoder output feature map channel into the number of input image channels of the network, and finally the residual connection adds the input image to the output of the convolutional layer to obtain the output image;

[0104] The hybrid attention layer decodes the input features into feature maps, and the decoder is the same as the image decoder of the downsampling layer and the upsampling layer. Then, the features are normalized by LayerNorm, and multiple non-overlapping windows of M×M are obtained by window division. The feature information in each window is aggregated by maximum pooling and average pooling to extract the feature matrix between each window. In this way, the multi-head self-attention module captures the correlation between different windows of the input feature map. Finally, the global attention weight is obtained by fusing the attention information extracted by the multi-head self-attention module and expanding it to the original size.

[0105] The intra-window self-attention will calculate the multi-head self-attention within each window based on the input features after dividing the windows, and the output features will be consistent with the input feature size; the inter-window self-attention will merge the input features after dividing the windows, first calculate the maximum value of all elements in each window, and obtain a feature size of nW*C, then calculate the multi-head self-attention for all elements of the feature and repeatedly expand each element to the window size to obtain the output features and sum them with the output features of the intra-window self-attention.

[0106] In step 3, specifically including: the number of mixed attention modules of each resolution in the student model is improved from N1=1, N2=2, N3=8, N4=8, N5=2 of the teacher restoration model GT to N1=1, N2=1, N3=2, N4=2, N5=4, where the resolution of feature map processed from N1 to N5 increases by two times step by step.

[0107] The student model reduces the number of channels of the first-layer feature map from 32 to 8, and the feature maps of each subsequent resolution double in size, with the number of channels in the innermost layer reduced from 512 to 128.

[0108] The local enhancement window module in the student model uses depthwise separable convolution (DWConv) to reduce the number of convolution parameters and computational cost, and the convolution kernel size is set to 3×3. The computational compression ratio of DWConv and the convolution layer is determined according to the following formula:

[0109]

[0110] Among them, K is the size of the convolution kernel, H, W, and C are the height, width, and number of channels of the input feature map, respectively.

[0111] In step 8, it specifically includes: the core of the image post-processing module is the weighted phase correlation method, the restored blurred images are registered in pairs, the previous frame is the standard image f(x, y), and the current frame is the image to be registered g(x, y); the following operations are performed on the two in sequence: Blackman window is applied in the spatial domain, DFT transformation (Discrete Fourier Transform) is performed to obtain F(u, v) and G(u, v), and low-pass filter is passed. The image frequency domain after low-pass filtering is:

[0112]

[0113] The two are weighted related using the weight matrix as the coefficient, which is determined according to the following formula:

[0114]

[0115] The weighted frequency domain correlation matrix Cw(u,v) is subjected to IDFT (Inverse Discrete Fourier Transform) to obtain a weighted phase correlation coefficient matrix for sub-pixel precision registration and displacement of the talisman image.

[0116] Where u0, v0 are two opposite cutoff frequencies, w(u, v) is the weight matrix, and a is an exponential adjustment coefficient.

[0117] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments. For ordinary technicians in this technical field, after knowing the contents recorded in the present invention, they can make several equivalent changes and substitutions without departing from the principle of the present invention. These equivalent changes and substitutions should also be regarded as belonging to the protection scope of the present invention.

Claims

1. A video image stabilization method based on attention network and phase correlation, characterized in that: Including the following steps: Train the hybrid attention network-based spatial transformation blurred image restoration model GT and the discriminant model DT as the teacher model to build the student model; The teacher model is distilled using the model compression technology of knowledge distillation. During the distillation process, the discriminant model DT is used to predict the clear image, and the restoration model GT is used to compete with it so that the student model learns the distribution of the clear image and obtains a lightweight student model. Use the student model to process the blurred video frames obtained by video segmentation and restore the blurred images; The restored image is sent to the image post-processing module, and the restored image is aligned with the two adjacent frame images through phase correlation technology to output the de-shaking video.

2. The video image stabilization method based on attention network and phase correlation according to claim 1, characterized in that: The invention also includes constructing a supervised fuzzy image dataset, wherein the supervised fuzzy image dataset includes a clear image domain dataset and a fuzzy image domain dataset, and the image contents in the clear image domain dataset and the fuzzy image domain dataset correspond to each other one by one; The corresponding images in the clear image domain dataset and the blurred image domain dataset are used for training and distillation operations.

3. The video image stabilization method based on attention network and phase correlation according to claim 2, characterized in that: The training process of the teacher model includes: In the framework of generative adversarial network, a spatial transformation blurred image restoration model GT based on hybrid attention network is established, and a discriminative model DT is established; The spatial transformation blurred image restoration model GT is used to restore the blurred image to obtain the restored image, and the discriminant model DT is used to calculate the teacher model comprehensive loss between the restored image of the spatial transformation blurred image restoration model GT and the clear image; Use the teacher model comprehensive loss value to back-propagate the gradient and update the parameter values ​​of the spatial transformation blur image restoration model GT and the discriminant model DT; Repeat the above operation until the comprehensive loss value of the teacher model converges, and obtain the spatial transformation blurred image restoration model GT and the discriminant model DT in the teacher model.

4. The video image stabilization method based on attention network and phase correlation according to claim 3, characterized in that: The distillation process comprises: The student model obtained by distilling the restoration model GT is used to restore the blurred image to obtain the restored image, and the discriminant model DT is used to calculate the comprehensive loss of the student model between the restored image of the student model and the clear image; Back propagation is used to calculate the gradient of the comprehensive loss value of the student model, and the parameter values ​​of the student model are updated; Repeat the above operation until the comprehensive loss function value of the student model converges to obtain a lightweight student model distilled from the teacher model.

5. The video image stabilization method based on attention network and phase correlation according to claim 1, characterized in that: The restoration model GT is mainly composed of a hierarchical encoding network, a feature extraction network, and a decoding network connected in a U-shaped architecture; and The feature extraction network includes a convolution module and a deconvolution module for downsampling and upsampling operations, and a hybrid attention module for feature processing operations; The encoding and decoding network is mainly composed of an image encoding module, multiple downsampling modules, multiple feature extraction modules, multiple upsampling modules and an image decoding module in a U-shaped architecture; Among them, the feature extraction module is mainly composed of a hybrid attention layer and a linear mapping layer connected in sequence. The hybrid attention layer integrates the global attention modulator and the window multi-head self-attention mechanism; the multi-head self-attention mechanism first passes the input features through LayerNorm and then divides them into non-overlapping windows according to a given window size, and then calculates the self-attention within the window and the self-attention between windows respectively and superimposes them. The linear mapping layer obtains the output features of the hybrid attention layer through LayerNorm and the local enhancement window module in sequence.

6. The video image stabilization method based on attention network and phase correlation according to claim 5, characterized in that: The number of the down-sampling modules is the same as that of the up-sampling modules, and there are jump connections between the corresponding down-sampling modules and up-sampling modules. A feature extraction module is connected before each down-sampling module and up-sampling module.

7. The video image stabilization method based on attention network and phase correlation according to claim 1, characterized in that: The number of mixed attention modules of each resolution in the student model is improved from N1=1, N2=2, N3=8, N4=8, N5=2 of the teacher restoration model GT to N1=1, N2=1, N3=2, N4=2, N5=4, where the resolution of feature maps processed from N1 to N5 increases by two times step by step; The student model reduces the number of channels of the first-layer feature map from 32 to 8, and the feature maps of each subsequent resolution double in number, with the number of channels in the innermost layer reduced from 512 to 128. The local enhancement window module in the student model uses depthwise separable convolution to reduce the number of convolution parameters and computational cost, and the convolution kernel size is set to 3×3; The computational compression ratio of the depthwise separable convolution and the convolutional layer is determined by the following formula: Among them, K is the size of the convolution kernel, H, W, and C are the height, width, and number of channels of the input feature map, respectively.

8. The video image stabilization method based on attention network and phase correlation according to claim 3, characterized in that: The teacher model comprehensive loss value L T Including adversarial loss, content loss and edge loss: L T =L GAN +μ1L CONT +μ2L EDGE ; The migration loss is based on WGAN-GP and is calculated as: The content loss is based on Charbonnier and is calculated as: The edge loss is based on the edge loss function of MPRNet, and the calculation formula is: Among them, x and They represent the clear image and the restored image obtained by the spatial transformation blurred image restoration model GT, is the random interpolation term between the clear image and the restored image, that is γ is a random number between 0 and 1, P g , P c and P i Respectively represent the data distribution of the restored image, the clear image and the interpolation term of the two, η represents the regularization coefficient of the loss gradient penalty term; Δ represents the Laplace operator; i is the image index; μ1 and μ2 represent the regularization coefficients of the content loss and the edge loss respectively; ε c , ε e , ε t represents the error term.

9. The video image stabilization method based on attention network and phase correlation according to claim 4, characterized in that: The comprehensive loss value L of the student model includes migration loss, content loss and edge loss: L = L TRANS +γ1L CONT +γ2L EDGE ; The migration loss is based on Charbonnier and is calculated as: The content loss is based on Charbonnier and is calculated as: The edge loss is based on the edge loss function of MPRNet, and the calculation formula is: Among them, x and denote the clear image and the restored image respectively, Δ denotes the Laplace operator; i is the image index; γ1 and γ2 denote the regularization coefficients of content loss and edge loss respectively; G S With D T Represent the student model and the teacher discriminant model DT respectively; x and y represent the input blurred image and its corresponding clear image respectively; ε c , ε e , ε t represents the error term.

10. The video image stabilization method based on attention network and phase correlation according to claim 1, characterized in that: During the registration process of the restored image and two adjacent frames: the previous frame is the standard image f(x, y), and the current frame is the image to be registered g(x, y); the following operations are performed on the two in sequence: In the spatial domain, a Blackman window is applied and DFT transformation is performed to obtain F(u,v) and G(u,v). The image frequency domain after low-pass filtering by a low-pass filter is: The two are weighted related using the weight matrix as the coefficient, which is determined according to the following formula: The weighted frequency domain correlation matrix Cw(u,v) is subjected to IDFT to obtain a weighted phase correlation coefficient matrix, which is used to perform sub-pixel precision registration and displacement of the talisman image. Among them, u0, v0 are two opposite cutoff frequencies, w(u,v) is the weight matrix, and a is an exponential adjustment coefficient.

Citation Information

Patent Citations

  • Frequency domain weighting correlation method for image registration

    CN101976434A

  • Non-uniform motion blurred image adaptive restoration method based on attention model

    CN111275637A

  • Blurred image restoration method based on unsupervised generative adversarial network

    CN112884671A

  • Lightweight image super-resolution reconstruction method based on multi-dimensional knowledge distillation

    CN113240580A

  • Image deblurring algorithm based on knowledge distillation and deep neural network

    CN114677304A