Attention-based multi-scale parameter sharing deblurring method for defocused images
By combining multi-scale parameter sharing and attention mechanisms, the problem of high parameter quantity and complexity in existing defocused image deblurring methods is solved, achieving efficient image deblurring effect and significantly improving PSNR and SSIM.
Patent Information
- Application Number
- CN202311671805.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-12-07
AI Technical Summary
Existing defocused image deblurring methods suffer from high neural network parameter count and complexity, resulting in time-consuming and ineffective deblurring operations.
We employ an attention-based multi-scale parameter sharing method, which obtains defocused blurred images at different scales by downsampling the blurred image twice in the network. We then utilize encoders, decoders, and refiners to perform feature context attention operations and feature selection and concatenation. In addition, we combine parameter-sharing convolutional blocks to perform feature aggregation and compression, thereby reducing the number of parameters and complexity.
A lightweight defocusing and deblurring network structure was implemented, which has high PSNR and SSIM, low MAE, and significantly improved the deblurring effect. The number of parameters was reduced by 20.49M, PSNR was increased by 0.79dB, and SSIM was increased by 0.03.
Smart Images

Figure CN118195951B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision and image processing technology, and relates to an attention-based method for deblurring defocused images with multi-scale parameter sharing. Background Technology
[0002] Existing image blurring is mainly divided into motion blur and defocus blur. Motion blur is caused by the relative motion between the camera and the subject during shooting, while defocus blur is caused by the subject not being on the focal plane. There are two main methods for deblurring defocused images: deblurring methods based on defocus maps and end-to-end deblurring methods.
[0003] The deblurring method based on defocus maps works as follows: First, the defocus blur kernel size for each pixel is estimated to form a defocus map. Then, the image is deblurred based on the estimated blur kernel.
[0004] The main technologies include region-based deblurring and boundary-based deblurring.
[0005] Region-based methods: Calculate the defocus blur kernel size starting from a local block centered on the current pixel.
[0006] Boundary-based methods: First, estimate the size of the blur kernel along the image edge to obtain a sparse blur map, and then propagate it to the entire image through an interpolation method to obtain a dense defocus map.
[0007] End-to-end deblurring method: It does not require estimating the size of the defocused blur kernel, and directly restores the clear image through a neural network.
[0008] The loss function and network structure are defined based on the prior information of defocus blur. Existing network structures include MDPNet, DPDNet, RDPD+, DMENet, etc.
[0009] However, existing methods share common limitations: neural networks have a high number of parameters and high complexity, requiring a significant amount of time to deblur images and the restoration effect is not very good. Summary of the Invention
[0010] In view of this, the purpose of this invention is to provide a multi-scale parameter sharing defocusing image deblurring method based on attention, which solves the technical problem that the high number and complexity of neural network parameters in image deblurring results in a large amount of time being consumed and poor restoration effect.
[0011] To achieve the above objectives, the present invention provides the following technical solution:
[0012] An attention-based multi-scale parameter sharing method for defocused image deblurring includes the following steps:
[0013] S1: Input the blurred image img1 into the network and perform two downsampling operations to obtain three defocused blurred images at different scales;
[0014] S2: Input the three defocused and blurred images of different scales obtained in S1 into different convolutional blocks to obtain three feature vectors of different sizes;
[0015] S3: The three feature vectors of different sizes obtained in S2 are subjected to feature context attention operation and feature selection concatenation operation in the encoder, decoder and refiner. The features are then encoded by the encoder, decoded by the decoder and extracted and restored by the refiner to obtain three different features.
[0016] The Encoder, Decoder, and Refine are each composed of a Feature Context Attention (CAB) module and a Feature Selection and Concatenation (FAB) module. An additional CAB module is added between the Encoder and Decoder to extract deep feature information, while the other CAB modules extract shallow feature information. Each CAB module in the Encoder processes the same feature size and performs the same processing operations as its corresponding CAB module in the Decoder and Refine, and they share parameters.
[0017] S4: Input the three different features obtained in S3 into different convolutional blocks respectively, and perform feature aggregation and compression to obtain three different aggregated and compressed features;
[0018] S5: Merge the three different aggregated and compressed features obtained in S4 with the input image img1 to obtain a deblurred image.
[0019] Furthermore, in step S1, the blurred image img1 is input into the network and subjected to two downsampling operations to obtain three defocused blurred images at different scales, specifically:
[0020] Inputting image1 into the network and performing two downsampling operations on it yields three defocused blurred images at different scales: image1, image2, and image3. The resolutions of these three images are H×W×3, respectively. Wherein, img2 is obtained by downsampling image img1 using PixelShuffle, as shown in formula (1); img3 is obtained by downsampling image img2 using PixelShuffle, as shown in formula (2):
[0021] img2 = PixelShuffle(img1) (1)
[0022] img3=PixelShuffle(img2) (2).
[0023] Furthermore, in step S2, three defocused and blurred images of different scales are input into different convolutional blocks to obtain three feature vectors of different sizes. Specifically, images img1, img2, and img3 are input into three different convolutional blocks to obtain three feature vectors of different sizes. Image img1 is convolved by 3*3 to output a feature vector I1 of size H×W×C, and image img2 is convolved by 3*3 to output... The feature vector I2 of size is output by 3x3 convolution of image img3. The eigenvectors I3 of size are represented as follows;
[0024] I1 = Conv(img1) (3)
[0025] I2 = Conv(img2) (4)
[0026] I3 = Conv(img3) (5).
[0027] Furthermore, in S3, context attention and selective concatenation operations are performed, specifically as follows: the feature vector of size H×W×C is denoted as F0, which is used as the initial input of the CAB module in the Encoder stage. After passing through two 3*3 convolutions and an activation function SimpleGate, a feature F1 of size H×W×C is obtained, as shown in formula (6):
[0028] F1=Conv(SimpleGate(Conv(F0))) (6)
[0029] F1 will simultaneously undergo two different operations to gain attention between channels;
[0030] F1 is transformed into feature F2 of size 1×HW×C by a dimension transformation reshape operation, as shown in formula (7):
[0031] F2 = Reshape(F1) (7)
[0032] Meanwhile, F1 is passed through a 1*1 convolution to obtain H×W×1 features. The obtained H×W×1 features are then passed through Reshape and the SoftMax activation function to output features F3 of size 1×1×HW, as shown in formula (8):
[0033] F3=SoftMax(Reshape(Conv(F1))) (8)
[0034] Multiplying F2 and F3 together, we obtain the channel attention feature F4, as shown in formula (9):
[0035] F4 = F2 * F3 (9)
[0036] Feature F4 is processed through two 1*1 convolutions and a SimpleGate to obtain a new attention feature F5, as shown in formula (10):
[0037] F5=Conv(SimpleGate(Conv(F4)) (10)
[0038] F5 and F1 are added pixel by pixel to aggregate the contextual feature information onto F1. Then, through SimpleGate, feature F6 is obtained, as shown in formula (11):
[0039] F6 = SimpleGate(F1 + F5) (11)
[0040] Adding F6 and F0 together, we get the output F7 of the CAB module, as shown in formula (12):
[0041] F7 = F6 + F0 (12)
[0042] The output result F7 is downsampled to obtain The size characteristic will be obtained Size features are concatenated with I2 for contextual attention;
[0043] Contextual attention concatenation is specifically performed by concatenating two feature maps X and Y of the same size to obtain feature Z, as shown in formula (13).
[0044] Z = X + Y (13)
[0045] After global average pooling, Z outputs a feature vector V of size 1×1×C, as shown in formula (14):
[0046] V = GAP(Z) (14)
[0047] The feature vector V is processed by two 1*1 convolutions and two activation functions to obtain two selection attention vectors V1 and V2 of size 1×1×C, as shown in formulas (15) and (16):
[0048] V1=SoftMax(Conv(SimpleGate(Conv(V)))) (15)
[0049] V2=SoftMax(Conv(SimpleGate(Conv(V)))) (16)
[0050] Using V1 and V2, meaningful features are selected from X and Y to combine into a new feature map. V1 is multiplied with the input feature X to obtain X1, and V2 is multiplied with the input feature Y to obtain Y1. Then X1 and Y1 are added together to obtain a new concatenated feature U, as shown in formula (17):
[0051] U = X*V1 + Y*V2 (17).
[0052] Furthermore, in S3, the encoder encodes the features, the decoder decodes the features, and the refiner extracts and restores the features, specifically as follows:
[0053] f1,f2,f3,f4=Encoder(I1,I2,I3) (18)
[0054] g1,g2,g3=Decoder(f1,f2,f3,f4) (19)
[0055] R1,R2,R3=Refine(g1,g2,g3) (20)
[0056] Where f1, f2, f3, f4 are the feature information obtained after encoding operations of img1, img2, and img3, f4 is the deep feature information extracted by the CAB module between the Encoder and Decoder, g1, g2, g3 are the feature information obtained after decoding operations of f1, f2, f3, and f4, and R1, R2, R3 are the features obtained after refining operations of g1, g2, and g3, respectively.
[0057] Furthermore, in step S4, the three extracted features are input into different convolutional blocks to perform feature aggregation and compression, resulting in three different aggregated and compressed features, specifically:
[0058] The outputs R1, R2, and R3 of Refine are input into a 3*3 convolution to perform feature aggregation and compression, resulting in three outputs Q1, Q2, and Q3, as shown in formulas (21) to (23):
[0059] Q1 = Conv(R1) (21)
[0060] Q2=Conv(R2) (22)
[0061] Q3 = Conv(R3) (23).
[0062] Furthermore, in step S5, the three different aggregated and compressed features are merged with the input image img1 to obtain a deblurred image, specifically as follows:
[0063] I=(PixelShuffle(FAB(PixelShuffle(Q3),Q2))+Q1+img1 (24)
[0064] Where I represents the deblurred image.
[0065] The beneficial effects of this invention are as follows:
[0066] First, this invention employs existing multi-scale strategies, inputting three defocused and blurred images at different scales into a network structure to form a composite U-shaped network. This network comprises three parts: an encoding part, a decoding part, and a refining part. This reduces information loss during transmission, allowing the network to learn richer image information, resulting in a clearer deblurred image. Furthermore, this invention integrates an attention mechanism, enabling the network to extract more meaningful features and filter out meaningless ones during feature extraction and stitching. In the information extraction and stitching modules, networks with fewer parameters and lower complexity are used, resulting in a lightweight defocusing and blurring network structure.
[0067] Secondly, this invention cleverly utilizes splicing attention mechanism and contextual attention mechanism, multi-scale, and parameter sharing to form a brand-new network structure. It has high PSNR and SSIM, low MAE, and fewer parameters and complexity, enabling this invention to effectively deblur images and achieve excellent performance.
[0068] Third, compared with the highly representative defocusing and blurring methods proposed in recent years, the technical solution adopted in this invention has significantly improved both objective evaluation indicators and subjective visual effects. Compared with methods in recent years, the number of parameters has been reduced by an average of 20.49M, the PSNR has been increased by an average of 0.79dB, the SSIM has been increased by an average of 0.03, and the MAE has decreased by an average of 0.003.
[0069] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0070] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:
[0071] Figure 1 This is a network structure diagram of the method proposed in this invention;
[0072] Figure 2 This is a network structure diagram of the CAB of the present invention;
[0073] Figure 3 This is a network structure diagram of the FAB of the present invention;
[0074] Figure 4 A comparison of the restoration results on the DPDD dataset; Figure 4 (a) is a blurred image; Figure 4 (b) is a diagram showing the restored MDPNet; Figure 4 (c) is the restoration result of RDPD+; Figure 4 (d) shows the restored result of DPDNet; Figure 4 (e) is a diagram showing the restoration result of the present invention; Figure 4 (f) is a clear image;
[0075] Figure 5 This is a diagram showing the restoration result of this invention on the RealDOF dataset; Figure 5 (a) is a blurred image; Figure 5 (b) is the restored image. Detailed Implementation
[0076] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0077] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0078] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0079] Please see Figures 1-5 This is an attention-based multi-scale parameter sharing defocusing image deblurring method, and the specific operation steps are as follows:
[0080] The network structure proposed in the invention is as follows: Figure 1 As shown, the specific training process is as follows.
[0081] First step, such as Figure 1 As shown, we input img1 into the network and perform two downsampling operations on img1, resulting in three defocused blurred images of different scales: img1, img2, and img3. The resolutions of these three images are H×W×3, respectively. img2 is obtained by downsampling image img1 using PixelShuffle, as shown in Equation (1). Similarly, img3 is obtained by downsampling image img2 using PixelShuffle, as shown in Equation (2).
[0082] img2 = PixelShuffle(img1) (1)
[0083] img3 = PixelShuffle(img2) (2)
[0084] The second step is to increase the feature dimension. Images img1, img2, and img3 are input into three different convolutional blocks, resulting in three feature vectors of different sizes. The first layer's 3x3 convolution outputs a feature vector I1 of size H×W×C, and the second layer's 3x3 convolution outputs... The feature vector of size I2, the output of the 3x3 convolution in the third layer The eigenvector I3 of the size is shown in formulas (3) to (5).
[0085] I1 = Conv(img1) (3)
[0086] I2 = Conv(img2) (4)
[0087] I3 = Conv(img3) (5)
[0088] The third step involves performing Contextual Attention Block (CAB) and Fusion Attention Block (FAB) operations on the features I1, I2, and I3 obtained in the second step. Specifically, the input feature maps go through three stages: Encoder, Decoder, and Refine, as shown in equations (6) to (8). The Encoder stage encodes the features, the Decoder stage decodes the features, and the Refine stage further extracts and restores the features. After performing the above operations, we obtain the extracted features R1, R2, and R3.
[0089] f1,f2,f3,f4=Encoder(I1,I2,I3) (6)
[0090] g1,g2,g3=Decoder(f1,f2,f3,f4) (7)
[0091] R1,R2,R3=Refine(g1,g2,g3) (8)
[0092] Specifically, for Figure 1 The feature I1 in the top left corner has a size of H×W×C. We will perform feature context attention operations and selective splicing operations.
[0093] For the Feature Context Attention (CAB) operation, we input the feature vector I1 obtained in the second step into the CAB in the top left corner. The CAB is the attention module used in this invention to extract more meaningful feature information, and its internal structure is as follows: Figure 2As shown. First, the input feature vector F0 of size H×W×C is processed through two 3×3 convolutions and an activation function SimpleGate to obtain feature F1 of size H×W×C. F1 undergoes two different operations to obtain inter-channel attention. F1 is then reshaped to become feature F2 of size 1×HW×C. Simultaneously, F1 is processed through a 1×1 convolution to obtain a feature of size H×W×1. This feature is then reshaped and activated by the SoftMax function to output feature F3 of size 1×1×HW. Then, F2 and F3 are multiplied to obtain the channel attention feature F4. Feature F4 is processed through two 1×1 convolutions and a SimpleGate to obtain a new attention feature F5. F5 is added to F1 pixel-wise to aggregate contextual feature information onto F1. Through SimpleGate, feature F6 is obtained. F6 is added to F0 to finally obtain the output F7 of the CAB module. F7 will continue to be fed into subsequent CAB modules to learn new feature information. Specifically, the CAB module between the Encoder and Decoder extracts deep feature information, while other CAB modules extract shallow feature information to enrich the information extraction. The calculation process of CAB is shown in formulas (9)-(15):
[0094] F1=Conv(SimpleGate(Conv(F0))) (9)
[0095] F2 = Reshape(F1) (10)
[0096] F3=SoftMax(Reshape(Conv(F1))) (11)
[0097] F4 = F2 * F3 (12)
[0098] F5=Conv(SimpleGate(Conv(F4)) (13)
[0099] F6 = SimpleGate(F1 + F5) (14)
[0100] F7 = F6 + F0 (15)
[0101] For Feature Selection Embedding (FAB) operations, such as Figure 3 As shown. We downsample the output F7 from the previous step to obtain... The features are concatenated with I2 obtained in the second step using context attention. The context attention concatenation is implemented as follows: First, two feature maps X and Y of the same size are concatenated to obtain feature Z. Z is then subjected to global average pooling (GAP) to output a feature vector V of size 1×1×C. Feature vector V is subjected to two 1×1 convolutions and two activation functions to obtain two selection attention vectors V1 and V2 of size 1×1×C. Then, V1 and V2 are used to select meaningful features from X and Y to combine them into a new feature map. V1 is multiplied with the input feature X to obtain X1, and V2 is multiplied with the input feature Y to obtain Y1. Then, X1 and Y1 are added together to obtain a new concatenated feature U. The implementation process of FAB is shown in formulas (16) to (20).
[0102] Z = X + Y (16)
[0103] V = GAP(Z) (17)
[0104] V1=SoftMax(Conv(SimpleGate(Conv(V)))) (18)
[0105] V2=SoftMax(Conv(SimpleGate(Conv(V)))) (19)
[0106] U=X*V1+Y*V2 (20)
[0107] The fourth step is to input the outputs R1, R2, and R3 from the third stage of Refine into a program such as... Figure 1 In the rightmost gray 3*3 convolution, feature aggregation and compression are performed to obtain three outputs Q1, Q2, Q3, as shown in formulas (21) to (23).
[0108] Q1 = Conv(R1) (21)
[0109] Q2=Conv(R2) (22)
[0110] Q3 = Conv(R3) (23)
[0111] Finally, we merge the features Q1, Q2, Q3 with the input image img1 to obtain the final deblurred image I, as shown in formula (24).
[0112] I=(PixelShuffle(FAB(PixelShuffle(Q3),Q2))+Q1+img1 (24)
[0113] Specifically, for the parameter-sharing method, each CAB module in the Encoder processes the same features and performs the same processing operations as its corresponding CAB module in the Decoder and Refine, and shares parameters to reduce the number of parameters and complexity.
[0114] For the network structure described above, we propose a new loss function to optimize the model, as shown in formulas (25) to (27), which significantly accelerates the convergence of the model and improves its performance.
[0115]
[0116]
[0117]
[0118] in, It is the content loss function, where X is the restored image of size H×W×3, Y is the corresponding sharpened image, and ε is a constant. F() is the Fourier loss function, which performs a Fourier transform on the image. Therefore, the total loss function is the content loss function plus the Fourier loss function. Generally, the Fourier loss is multiplied by a weight λ to make the training more inclined to reduce the size of the content loss function. λ is usually set to 0.1.
[0119] experiment
[0120] To verify the effectiveness of the method proposed in this invention, we compared it with defocusing and deblurring methods developed in recent years, comparing them in terms of parameter quantity, complexity, PSNR, SSIM, and MAE. We also conducted ablation experiments on the module to verify its effectiveness.
[0121] The dataset used for training in this invention is the DPDD (Dual Pixel Dataset), which contains 350 training images, 74 evaluation images, and 76 test images. Each image is 1680×1120 pixels. The test set is divided into indoor scenes, outdoor scenes, and combined indoor and outdoor scenes. Because large image sizes would lead to excessively long training times, we cropped the images to 512×512 pixels, resulting in 7000 training images. We implemented the network using PyTorch, and the optimization algorithm used was AdamW, with parameters β1 and β2 set to 0.9 and 0.99 respectively. The network iteration count was set to 600,000, employing a cosine annealing and restart cyclic fire strategy. For the first 92,000 iterations, the learning rate was fixed at 3e-4, gradually decreasing to 1e-6 in the remaining iterations. Specifically, the channel dimension of this invention is set to 48, and the number of CABs is [2,2,2,2], that is, the number of CABs in each row is 2, 2, 2, 2 respectively. Specifically, as shown... Figure 1 As shown, the leftmost yellow CAB is composed of 2 CABs, and the number of CABs of the same color is the same.
[0122] 1. Ablation test
[0123] During the ablation experiment phase, we conducted ablation experiments on the DPDD dataset for the CAB and FAB modules proposed in this invention to verify their effectiveness. Table 1 shows the ablation experiments for CAB and FAB.
[0124] Table 1
[0125] method CAB FAB PSNR 1 √ 25.32 2 √ 25.57 3 √ √ 25.61
[0126] As shown in Table 1, removing the CAB module proposed in this invention reduced the PSNR by 0.29 dB, and similarly, removing the FAB module proposed in this invention reduced the PSNR by 0.04 dB. Table 1 fully demonstrates the effectiveness of the CAB and FAB proposed in this invention.
[0127] 2. Comparison with highly representative methods of recent years
[0128] To verify the superiority of this invention, we compared it with methods from recent years (MDPNet, RDPD+, DMENet, DPDNet).
[0129] The following comparisons are made: Table 2 shows the performance comparison in indoor and outdoor scenarios, Table 3 shows the performance comparison in indoor scenarios, Table 4 shows the performance comparison in outdoor scenarios, and Table 5 shows the performance comparison in RealDOF.
[0130] Table 2
[0131]
[0132]
[0133] Table 3
[0134]
[0135] Table 4
[0136]
[0137]
[0138] This invention was compared on the DPDD and RealDOF datasets, and its objective evaluation metrics are significantly better than existing methods. Specifically, as shown in Table 2, in the indoor-outdoor combined scene of the DPDD dataset, the number of parameters of this invention was reduced by an average of 20.49M, the PSNR was improved by an average of 0.79dB, and the SSIM was improved by an average of 0.03. As shown in Table 3, in the indoor scene of the DPDD dataset, all objective evaluation metrics of this invention are better than those of methods in recent years, and compared with the method MDPNet in 22, the number of parameters was reduced by 34.02M and the PSNR was improved by 0.43dB.
[0139] To demonstrate the generalizability of this invention, we also conducted tests on RealDOF, as shown in Table 5, comparing it with methods from recent years (DPDNet, DMENet). The present invention improved PSNR by an average of 2.12 dB, improved SSIM value by an average of 0.09, and decreased MAE by an average of 0.01.
[0140] Figure 4 The results of the restoration of the present invention on the DPDD dataset are shown. As can be seen from the figure, the method proposed in this invention has better effect on restoring image details and restores both indoor and outdoor scenes very well. Figure 5 The figures demonstrate the excellent restoration results of this invention on the RealDOF dataset, showcasing its good generalization ability. In summary, Tables 2, 3, 4, and 5... Figure 4 , Figure 4 (a)~ Figure 4 (f) Figure 5 , Figure 5 (a)~ Figure 5 As shown in (b), it is evident that the present invention has significant effects in both objective evaluation indicators and subjective visual effects.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A deblurring method for defocused images based on attention-based multi-scale parameter sharing, characterized in that: Includes the following steps: S1: Input the blurred image img1 into the network and perform two downsampling operations to obtain three defocused blurred images at different scales; S2: Input the three defocused and blurred images of different scales obtained in S1 into different convolutional blocks to obtain three feature vectors of different sizes; S3: The three feature vectors of different sizes obtained in S2 are subjected to feature context attention operation and feature selection concatenation operation in the encoder, decoder and refiner. The features are then encoded by the encoder, decoded by the decoder and extracted and restored by the refiner to obtain three different features. The Encoder, Decoder, and Refine are each composed of a Feature Context Attention (CAB) module and a Feature Selection and Concatenation (FAB) module. An additional CAB module is added between the Encoder and Decoder to extract deep feature information, while the other CAB modules extract shallow feature information. Each CAB module in the Encoder processes the same feature size and performs the same processing operations as its corresponding CAB module in the Decoder and Refine, and they share parameters. S4: Input the three different features obtained in S3 into different convolutional blocks respectively, and perform feature aggregation and compression to obtain three different aggregated and compressed features; S5: Merge the three different aggregated and compressed features obtained in S4 with the input image img1 to obtain a deblurred image.
2. The attention-based multi-scale parameter sharing defocusing image deblurring method according to claim 1, characterized in that: In step S1, the blurred image img1 is input into the network and subjected to two downsampling operations to obtain three defocused blurred images at different scales, specifically: Inputting image1 into the network and performing two downsampling operations on it yields three defocused blurred images at different scales: image1, image2, and image3. The resolutions of these three images are H×W×3, respectively. Wherein, img2 is obtained by downsampling image img1 using PixelShuffle, as shown in formula (1); img3 is obtained by downsampling image img2 using PixelShuffle, as shown in formula (2): img2 = PixelShuffle(img1) (1) img3=PixelShuffle(img2) (2).
3. The attention-based multi-scale parameter sharing defocusing image deblurring method according to claim 2, characterized in that: In step S2, three defocused and blurred images of different scales are input into different convolutional blocks to obtain three feature vectors of different sizes. Specifically, images img1, img2, and img3 are input into three different convolutional blocks to obtain three feature vectors of different sizes. Image img1 is convolved by 3*3 to output a feature vector I1 of size H×W×C, and image img2 is convolved by 3*3 to output... The feature vector I2 of size is output by 3x3 convolution of image img3. The eigenvectors I3 of size are represented as follows; I1 = Conv(img1) (3) I2 = Conv(img2) (4) I3 = Conv(img3) (5).
4. The attention-based multi-scale parameter sharing defocused image deblurring method according to claim 3, characterized in that: In S3, context attention and selective concatenation operations are performed, specifically as follows: the feature vector of size H×W×C is denoted as F0 and used as the initial input of the CAB module in the Encoder stage. After passing through two 3*3 convolutions and an activation function SimpleGate, a feature F1 of size H×W×C is obtained, as shown in formula (6): F1=Conv(SimpleGate(Conv(F0))) (6) F1 will simultaneously undergo two different operations to gain attention between channels; F1 is transformed into feature F2 of size 1×HW×C by a dimension transformation reshape operation, as shown in formula (7): F2 = Reshape(F1) (7) Meanwhile, F1 is passed through a 1*1 convolution to obtain H×W×1 features. The obtained H×W×1 features are then passed through Reshape and the SoftMax activation function to output features F3 of size 1×1×HW, as shown in formula (8): F3=SoftMax(Reshape(Conv(F1))) (8) Multiplying F2 and F3 together, we obtain the channel attention feature F4, as shown in formula (9): F4 = F2 * F3 (9) Feature F4 is processed through two 1*1 convolutions and a SimpleGate to obtain a new attention feature F5, as shown in formula (10): F5=Conv(SimpleGate(Conv(F4)) (10) F5 and F1 are added pixel by pixel to aggregate the contextual feature information onto F1. Then, through SimpleGate, feature F6 is obtained, as shown in formula (11): F6 = SimpleGate(F1 + F5) (11) Adding F6 and F0 together, we get the output F7 of the CAB module, as shown in formula (12): F7 = F6 + F0 (12) The output result F7 is downsampled to obtain The size characteristic will be obtained Size features are concatenated with I2 for contextual attention; Contextual attention concatenation is specifically performed by concatenating two feature maps X and Y of the same size to obtain feature Z, as shown in formula (13). Z = X + Y (13) After global average pooling, Z outputs a feature vector V of size 1×1×C, as shown in formula (14): V = GAP(Z) (14) The feature vector V is processed by two 1*1 convolutions and two activation functions to obtain two selection attention vectors V1 and V2 of size 1×1×C, as shown in formulas (15) and (16): V1=SoftMax(Conv(SimpleGate(Conv(V)))) (15) V2=SoftMax(Conv(SimpleGate(Conv(V)))) (16) Using V1 and V2, meaningful features are selected from X and Y to combine into a new feature map. V1 is multiplied with the input feature X to obtain X1, and V2 is multiplied with the input feature Y to obtain Y1. Then X1 and Y1 are added together to obtain a new concatenated feature U, as shown in formula (17): U = X*V1 + Y*V2 (17).
5. The attention-based multi-scale parameter sharing defocusing image deblurring method according to claim 4, characterized in that: In S3, the encoder encodes the features, the decoder decodes the features, and the refiner extracts and restores the features. Specifically, this is represented as follows: f1,f2,f3,f4=Encoder(I1,I2,I3) (18) g1,g2,g3=Decoder(f1,f2,f3,f4) (19) R1,R2,R3=Refine(g1,g2,g3) (20) Where f1, f2, f3, f4 are the feature information obtained after encoding operations of img1, img2, and img3, f4 is the deep feature information extracted by the CAB module between the Encoder and Decoder, g1, g2, g3 are the feature information obtained after decoding operations of f1, f2, f3, and f4, and R1, R2, R3 are the features obtained after refining operations of g1, g2, and g3, respectively.
6. The attention-based multi-scale parameter sharing defocusing image deblurring method according to claim 5, characterized in that: In step S4, the three extracted features are input into different convolutional blocks to perform feature aggregation and compression, resulting in three different aggregated and compressed features, specifically: The outputs R1, R2, and R3 of Refine are input into a 3*3 convolution to perform feature aggregation and compression, resulting in three outputs Q1, Q2, and Q3, as shown in formulas (21) to (23): Q1 = Conv(R1) (21) Q2=Conv(R2) (22) Q3 = Conv(R3) (23).
7. The attention-based multi-scale parameter sharing defocusing image deblurring method according to claim 6, characterized in that: In step S5, the three different aggregated and compressed features are merged with the input image img1 to obtain a deblurred image, specifically as follows: I=(PixelShuffle(FAB(PixelShuffle(Q3),Q2))+Q1+img1 (24) Where I represents the deblurred image.
Citation Information
Patent Citations
Attention mechanism-based image blind deblurring method and system
CN111709895A
An image deblurring method based on channel attention and cross-scale feature fusion
CN114936977A
