Wood board image deblurring method and device and computer readable storage medium
By combining the Transformer architecture and feedforward neural network, introducing frequency domain processing and self-attention mechanism, and using Charbonnier loss function, the deficiencies in edge information and frequency information processing in wooden board image deblurring are solved, and better image deblurring effect is achieved. and detail recovery.
Patent Information
- Application Number
- CN202410829268.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-10
AI Technical Summary
The existing wood board image deblurring method is difficult to effectively restore a clear image, especially in the processing of edge information and frequency information, resulting in poor image restoration effects.
The Transformer architecture is combined with the feedforward neural network, and image deblurring is performed through the pre-convolution module, encoder, decoder and post-convolution module. Frequency domain processing and self-attention mechanism are introduced, and the Charbonnier loss function is used to optimize the model to ensure Edge preservation and training stability.
It improves the accuracy and detail recovery ability of image deblurring, enhances the understanding of the global structure of the image and the capture of semantic information, and the generated images are more natural and coherent.
Smart Images

Figure CN118628403A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image coding technology of information technology, and more specifically, relates to a method and device for deblurring a wooden board image and a computer-readable storage medium. Background Art
[0002] Wood board image acquisition plays an indispensable role in the wood board manufacturing process. However, on the wood board production line, the wood board usually passes through the detection device at high speed, and the camera needs to capture a clear wood board image in a very short time. However, due to the movement or vibration of the camera and the high-speed movement of the wood board itself, the captured image often appears motion blurred. In order to solve this problem, a variety of methods have been proposed, such as using a camera with a high-speed shutter, increasing the light intensity of image acquisition, and using mechanical devices to slow down the movement of the wood board. However, these methods have their own limitations and shortcomings. With the development of deep learning, a new direction for image deblurring is provided. Researchers use convolutional neural networks and adversarial networks to deblur blurred images and restore them to clear images.
[0003] Chinese invention patent CN113570516A discloses an image blind motion deblurring method based on a CNN-Transformer hybrid autoencoder. The method includes two stages, namely a model training stage and a prediction stage. The model training stage includes the following steps: Step 1: Prepare an image deblurring standard data set; Step 2: Experimental data preprocessing; Step 3: Input the blurred image in the training set of the image deblurring standard data set into the hybrid autoencoder part for restoration; Step 4: Input the potential clear image generated by the hybrid autoencoder together with the corresponding target clear image in its standard data set into the discriminator, and the discriminator returns the gradient after calculating the loss; Step 5: The hybrid autoencoder receives the gradient from the discriminator for parameter update; The model prediction stage includes a step: input the blurred image into the trained hybrid autoencoder, and the output is the deblurred clear image.
[0004] In summary, many problems are still encountered in these deep learning methods, especially determining which frequency information is helpful for image restoration, and in the image restoration process, the edge information of the image is easily lost. For these reasons, blurred images cannot be restored with good results. Summary of the invention
[0005] The present invention aims to overcome at least one defect of the above-mentioned prior art and provide a method for deblurring a wooden board image to solve the problem that the blurred image cannot be restored well in the prior art.
[0006] The detailed technical scheme of the present invention is as follows:
[0007] The purpose of the present invention is to use the image deblurring model to obtain a clear image, which is convenient for a series of subsequent work using the wood board image as the data source, such as wood board defect detection, instance segmentation, semantic segmentation, etc. In order to achieve the above purpose, the present invention adopts the following technical solutions:
[0008] S1. Obtain a fuzzy image dataset, and divide the dataset into a training set, a validation set, and a test set; the dataset includes a collected wooden board image dataset and a public wooden board image dataset;
[0009] Preferably, the public data sets include Gopro and HIDE.
[0010] S2, using the Transformer architecture as the backbone network combined with a feedforward neural network to build a wooden board image deblurring model;
[0011] S3, training the wooden board image deblurring model based on the training set, and verifying the trained wooden board image deblurring model based on the verification set;
[0012] S4. Based on the test set, the trained wooden board image deblurring model is used to perform deblurring processing to obtain the infrared image deblurring result.
[0013] Furthermore, the wood board image deblurring model includes a front convolution module, an encoder, a decoder, a loss function module and a back convolution module, wherein each layer in the encoder and the decoder includes a feedforward neural network;
[0014] The front convolution module extracts input image block features and establishes global dependencies between image blocks;
[0015] The encoder is used to extract shallow features of the image block, wherein the feedforward neural network layer performs nonlinear transformation on the feature representation of each image block, thereby effectively enhancing the image feature expression capability by capturing complex mapping relationships;
[0016] The decoder is used to remap the shallow features extracted by the encoder back to the image block, and deblur and reconstruct according to the shallow features to obtain a reconstructed image, wherein the feedforward neural network layer performs further nonlinear transformation on the representation of the image block, thereby effectively restoring a clear image from a blurred image by enhancing the feature expression capability and capturing complex mapping relationships.
[0017] The loss function module guides the training process of the model and optimizes the deblurring effect of the encoder and decoder;
[0018] The post-convolution module, after being optimized by the loss function module, reconstructs the image which usually contains a large amount of detail information, which needs to be integrated and converted into an output image with the same resolution and number of channels as the original image. The post-convolution module can integrate the high-resolution reconstructed image through its convolution kernel to extract the most useful information.
[0019] Furthermore, the execution process of the wooden board image deblurring model is as follows:
[0020] The blurred image is input into the front convolution module to extract low-resolution features and establish global dependencies between image blocks;
[0021] The image block features extracted by convolution enter the encoder and are converted into initial features through 1×1 point convolution;
[0022] The initial features are processed by downsampling. The downsampling layer reduces the resolution of the feature map by half and reduces the number of feature channels. The features are then represented by nonlinear transformation optimization through a feedforward neural network layer. The downsampled features are obtained by processing through multiple downsampling layers and feedforward neural network layers. The downsampled features are residually connected with the image block features before entering the encoder to obtain the updated image block features.
[0023] The updated image block features are then layer normalized to ensure that the features are distributed consistently across different layers, which helps speed up training convergence. Finally, the encoder outputs shallow features, i.e., low-level features.
[0024] Next, the decoder takes shallow features as input and gradually restores the spatial resolution of the image through upsampling. Each upsampling layer doubles the resolution of the feature map while reducing the number of feature channels. It then performs nonlinear transformation optimization representation through a feedforward neural network layer, and obtains high-level features through processing by multiple upsampling layers and feedforward neural network layers. The features processed by the encoder have been processed by multiple layers of convolution and encoders, and contain high-frequency information and low-frequency information of the image. The low-frequency information corresponds to the slowly changing parts of the image, usually including the overall structure of the image, background, and large object contours, and the high-frequency information corresponds to the rapidly changing parts of the image, usually including image details, textures, edges, and noise, etc.
[0025] At the same time, jump connections are used between the high-level features of the decoder and the shallow features of the encoder to better fuse the shallow features and high-level features, thereby generating clearer images. After completing all upsampling steps, the decoder further refines the fused shallow and high-level features, and converts the refined features into a residual image with the same resolution and number of channels as the original input image through a convolutional layer. The residual image is then added to the blurred image of the initial input to generate a clear image.
[0026] The loss function module optimizes the clear image using a loss function;
[0027] The post-convolution module converts the clear image optimized by the loss function module into an image with the same resolution and number of channels as the original input image, extracts key information, and finally obtains a deblurred wooden board image.
[0028] Furthermore, the feedforward neural network is improved:
[0029] Traditional feedforward neural networks (FFNs) mainly operate in the spatial domain and perform deblurring in the spatial domain, which cannot effectively handle the separation and reconstruction of high-frequency and low-frequency information. The feedforward neural network proposed in this paper introduces frequency domain processing, uses fast Fourier transform (FFT) to convert features to the frequency domain, and operates in the frequency domain, which can more effectively distinguish and process low-frequency and high-frequency information, thereby better preserving the details and structure of the image. At the same time, by selectively retaining important frequency information, the details of the image can be processed more accurately, improving the deblurring effect;
[0030] During the processing, the extracted features are fast Fourier transformed and converted to the frequency domain. The correlation between features is calculated through the self-attention mechanism, important frequency information is retained and enhanced, and image details are processed; then, the processed features are converted back to the spatial domain through the inverse fast Fourier transform.
[0031] Since not all frequency domain information is useful for image deblurring, an improved feedforward network (FFN) is proposed. The FFN structure is as follows: Figure 3 As shown, the improved feedforward neural network includes: a normalization layer, a convolution layer, a block expansion layer, a frequency domain processing layer, a block folding layer and an activation function; the frequency domain processing layer includes a fast Fourier transform and an inverse fast Fourier transform;
[0032] A frequency domain processing layer is introduced in the feedforward neural network. The fast Fourier transform is used to convert features from the spatial domain to the frequency domain. Features of specific frequencies are selected and processed in the frequency domain, and a quantization matrix is introduced for processing. Specific frequencies are set according to actual needs, important frequencies are selected, and unimportant frequencies are ignored to improve computational efficiency and accuracy, and to more effectively distinguish and process low-frequency and high-frequency information. The correlation between features is then calculated through the self-attention mechanism, and important frequency information is retained and enhanced. Finally, the processed features are converted back to the spatial domain through the inverse fast Fourier transform.
[0033] Furthermore, in the self-attention layer in the encoder and decoder, the dilated neighborhood attention is introduced to capture more global context information and increase the receptive field exponentially without increasing the additional computational cost. The dilated neighborhood attention is calculated as follows:
[0034]
[0035] in, represents the attention vector at the i-th position, represents the first position index related to position i in the neighborhood δ calculated according to the expansion rate, represents the second position index related to position i in the neighborhood δ calculated according to the expansion rate, represents the kth position index related to position i in the neighborhood δ calculated according to the expansion rate, k is the total number of position indexes related to position i in the neighborhood, Q i K T represents the product of query Q and key K, is a function used to calculate the complementary information between position i and the position in the neighborhood. In the expanded neighborhood attention, the corresponding value vector at position i is It is expressed as:
[0036]
[0037] The weighted value vector at the i-th position can be expressed as:
[0038]
[0039] Among them, d k is the dimension of the query vector. The advantage of introducing this attention is that it can reduce the number of model calculations by skipping a certain number of elements and expanding the neighborhood attention. Compared with the traditional self-attention mechanism, it has lower computational complexity when processing long sequences; by expanding the neighborhood, the model can capture a wider range of contextual information while maintaining locality, which helps the model better establish long-range dependencies in sequence data, thereby improving the performance and generalization ability of the model.
[0040] Furthermore, in the deblurring work, the commonly used mean square error loss function is insensitive to edge areas and texture information, resulting in unclear image details and unclear edges in the image generated by the model. Therefore, this paper introduces Charbonnier loss to optimize the model. It has better edge preservation ability and higher numerical stability. Its loss function is as follows:
[0041]
[0042] Among them, x i Represents the predicted value of the blurred image, y i represents the value of the clear image, N represents the number of samples, and ω is a constant set to 10 -3 .
[0043] A device for deblurring a wooden board image, the device comprising:
[0044] processor;
[0045] a memory having stored thereon a computer program executable on the processor;
[0046] Wherein, when the computer program is executed by the processor, the steps of the method for deblurring a wooden board image are implemented.
[0047] A computer-readable storage medium stores a wooden board image deblurring program, and when the wooden board image deblurring program is executed by the processor, the steps of the wooden board image deblurring method are implemented.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] 1. The present invention proposes a method, device and computer-readable storage medium for deblurring a wooden board image. The Transformer architecture is used as the backbone network, which can capture the long-distance pixel relationship in the image through the self-attention mechanism without being limited by the local receptive field of the convolution operation. This enables the Transformer to better understand the global structure and semantic information of the image, which helps to accurately restore the details, texture and edge information of the image.
[0050] 2. The present invention proposes a method, device and computer-readable storage medium for deblurring a wooden board image. By proposing an improved feedforward neural network, it is determined which frequency domain information is helpful for image deblurring and adaptively retains this frequency domain information. By introducing the Charbonnier loss function, it can reduce the jitter that may occur during the gradient descent process, improve the stability and convergence speed of training, and reduce artifacts, making the generated image more coherent and natural. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flow chart of the method for deblurring a wooden board image according to the present invention.
[0052] Figure 2 This is a diagram of the network structure for deblurring a wooden board image in Example 1 of the present invention.
[0053] Figure 3 This is a diagram of the architecture of the feedforward neural network module in Example 1 of the present invention. DETAILED DESCRIPTION
[0054] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0055] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0056] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0057] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0058] Example 1
[0059] This embodiment provides a method for deblurring a wooden board image. It uses the powerful global building capability of Transformer to capture the global context information of the image, which is particularly important for dealing with complex and extensive blur. It can effectively process long-distance dependencies in the image and better understand and restore the overall structure of the image. Figure 1 As shown, including:
[0060] S1. Obtain a fuzzy image dataset, and divide the dataset into a training set, a validation set, and a test set; the dataset includes a collected wooden board image dataset and a public wooden board image dataset.
[0061] Preferably, the public data sets include but are not limited to Gopro and HIDE.
[0062] S2, using the Transformer architecture as the backbone network combined with a feedforward neural network to build a wooden board image deblurring model;
[0063] Specifically, the wooden board image deblurring model includes a front convolution module (1×1 convolution), an encoder, a decoder, a loss function module and a back convolution module (3×3 convolution), wherein each layer in the encoder and the decoder includes a feedforward neural network (FFN), such as Figure 2 As shown, the proposed model for wood board image deblurring is named WVformer;
[0064] The front convolution module (1×1 convolution) extracts input image block features and establishes global dependencies between image blocks;
[0065] The encoder is used to extract shallow features of the image block, wherein the feedforward neural network layer performs nonlinear transformation on the feature representation of each image block, thereby effectively enhancing the image feature expression capability by capturing complex mapping relationships;
[0066] The decoder is used to remap the shallow features extracted by the encoder back to the image block, and deblur and reconstruct according to the shallow features to obtain a reconstructed image, wherein the feedforward neural network layer performs further nonlinear transformation on the representation of the image block, thereby effectively restoring a clear image from a blurred image by enhancing the feature expression capability and capturing complex mapping relationships.
[0067] The loss function module guides the training process of the model and optimizes the deblurring effect of the encoder and decoder;
[0068] The post-convolution module (3×3 convolution), after being optimized by the loss function module, reconstructs the image which usually contains a lot of detail information, which needs to be integrated and converted into an output image with the same resolution and number of channels as the original image. The post-convolution module can integrate the high-resolution reconstructed image through its convolution kernel to extract the most useful information.
[0069] Preferably, the feedforward neural network is improved;
[0070] Traditional feedforward neural networks (FFNs) mainly operate in the spatial domain and perform deblurring in the spatial domain, which cannot effectively handle the separation and reconstruction of high-frequency and low-frequency information. The feedforward neural network proposed in this paper introduces frequency domain processing, uses fast Fourier transform (FFT) to convert features to the frequency domain, and operates in the frequency domain, which can more effectively distinguish and process low-frequency and high-frequency information, thereby better preserving the details and structure of the image. At the same time, by selectively retaining important frequency information, the details of the image can be processed more accurately, improving the deblurring effect;
[0071] During the processing, the extracted features are fast Fourier transformed and converted to the frequency domain. The correlation between features is calculated through the self-attention mechanism, important frequency information is retained and enhanced, and image details are processed; then, the processed features are converted back to the spatial domain through the inverse fast Fourier transform.
[0072] Since not all frequency domain information is useful for image deblurring, a new feedforward network (FFN) is proposed. The FFN structure is as follows: Figure 3 As shown, the improved feedforward neural network includes: a normalization layer, a convolution layer, a block expansion layer, a frequency domain processing layer, a block folding layer and an activation function; the frequency domain processing layer includes a fast Fourier transform and an inverse fast Fourier transform;
[0073] First, the features are preprocessed by the normalization layer and the convolution layer, and then expanded by the block expansion layer to input the frequency domain processing layer;
[0074] A frequency domain processing layer is introduced in the feedforward neural network. The fast Fourier transform is used to convert features from the spatial domain to the frequency domain. Features of specific frequencies are selected in the frequency domain and a quantization matrix is introduced for processing. Specific frequencies are set according to actual needs, important frequencies are selected, and unimportant frequencies are ignored to improve computational efficiency and accuracy, and to more effectively distinguish and process low-frequency and high-frequency information. The correlation between features is then calculated through the self-attention mechanism, and important frequency information is retained and enhanced. Finally, the processed features are converted back to the spatial domain through the inverse fast Fourier transform.
[0075] Its core idea is to enhance the expressiveness of features through information processing in the frequency domain, by converting features to the frequency domain, operating in the frequency domain, and then converting back to the spatial domain. This method can capture global features more efficiently and can effectively process details and complex structures in the image. The main components are composed of frequency domain conversion, dynamic frequency filtering, self-attention mechanism, and reverse conversion. It can selectively retain the frequency domain information of the image. The following formulas explain the frequency domain conversion and frequency domain processing operations respectively:
[0076] X f =F(P(X1)) (5);
[0077] X′ f =F -1 (JX f ) (6);
[0078] In formulas (5)-(6), P represents the block operation in the JPEG compression algorithm, F represents the fast Fourier transform, which converts the spatial domain feature X1 into the frequency domain, and F -1 Represents inverse fast Fourier transform, which converts the processed frequency domain features back to the spatial domain.
[0079] Furthermore, the features processed in the frequency domain are aggregated and integrated using convolution operations to obtain aggregated feature representations. The aggregated feature representations are folded through a block folding layer, and then an activation function is applied to perform nonlinear transformation on the aggregated features to further optimize the feature representation.
[0080] Specifically, the execution process of the wooden board image deblurring model is as follows:
[0081] Given a blurred image I∈R H×W×3 , H×W represents the spatial dimension of the input image, 3 means that the input image is 3-channel. First, the input blurred image passes through a 3×3 front convolution layer to extract the initial feature F0 and establish the global dependency between image blocks;
[0082] The image block features extracted by convolution enter the encoder and are converted into initial features through 1×1 point convolution. The initial feature conversion is expressed by the following formula:
[0083] X1=Conv 1×1 (L(X input )) (7)
[0084] In formula (7), Conv 1×1 Represents a 1×1 convolution operation, which is used to linearly transform features. input represents the input features, and X1 represents the features after convolution.
[0085] The initial features are then processed by downsampling. The downsampling layer reduces the resolution of the feature map by half, for example, from 512 to 256, while reducing the number of feature channels. The features are then represented by nonlinear transformation optimization through a feedforward neural network layer. The downsampled features are obtained by processing through multiple layers of downsampling layers and feedforward neural network layers. The downsampled features are residually connected with the image block features before entering the encoder to obtain the updated image block features.
[0086] Finally, the updated image block features are layer normalized to ensure that the features are distributed consistently across different layers, which helps speed up the training convergence. Finally, the encoder outputs shallow features, i.e., low-level features, which are expressed by the following formula:
[0087] X out =G(P′ -1 (X f ))+X input (8);
[0088] In formula (8), P -1 represents the inverse block operation, G represents the GEGLU activation function processing, X out Represents the final output features of the encoder, i.e., shallow features;
[0089] The decoder takes shallow features as input and gradually restores the spatial resolution of the image through upsampling. Each upsampling layer doubles the resolution of the feature map while reducing the number of feature channels. It then performs nonlinear transformation optimization representation through a feedforward neural network layer, and obtains high-level features through processing by multiple upsampling layers and feedforward neural network layers. The features processed by the encoder have been processed by multiple layers of convolution and encoders, and contain high-frequency information and low-frequency information of the image. The low-frequency information corresponds to the slowly changing parts of the image, usually including the overall structure of the image, the background, and the outline of large objects, etc. The high-frequency information corresponds to the rapidly changing parts of the image, usually including the details, textures, edges, and noise of the image, etc.
[0090] At the same time, jump connections are used between the high-level features of the decoder and the shallow features of the encoder to better integrate the shallow features and high-level features, thereby generating clearer images;
[0091] Finally, after completing all the upsampling steps, the decoder further refines the fused shallow and high-level features, converts the refined features into a residual image with the same resolution and number of channels as the original input image through a convolutional layer, and then adds the residual image to the blurred image of the initial input to generate a clear image.
[0092] It is common knowledge for people in the field that the encoder and decoder have self-attention layers. Preferably, this embodiment improves the self-attention layer: in the self-attention layers in the encoder and decoder, an extended neighborhood attention is introduced to capture more global context information, and the receptive field can be increased exponentially without increasing additional computational costs. The extended neighborhood attention is calculated as follows:
[0093]
[0094] in, represents the attention vector at the i-th position, represents the first position index related to position i in the neighborhood δ calculated according to the expansion rate, represents the second position index related to position i in the neighborhood δ calculated according to the expansion rate, represents the kth position index related to position i in the neighborhood δ calculated according to the expansion rate, k is the total number of position indexes related to position i in the neighborhood, Q i K T represents the product of query Q and key K, is a function used to calculate the complementary information between position i and the position in the neighborhood. In the expanded neighborhood attention, the corresponding value vector at position i is It is expressed as:
[0095]
[0096] The weighted value vector at the i-th position can be expressed as:
[0097]
[0098] Among them, d kis the dimension of the query vector. The advantage of introducing this attention is that it can reduce the number of model calculations by skipping a certain number of elements and expanding the neighborhood attention. Compared with the traditional self-attention mechanism, it has lower computational complexity when processing long sequences; by expanding the neighborhood, the model can capture a wider range of contextual information while maintaining locality, which helps the model better establish long-range dependencies in sequence data, thereby improving the performance and generalization ability of the model.
[0099] The loss function module uses a loss function to optimize the clear image; preferably, in the deblurring work, the commonly used mean square error loss function is insensitive to the edge area and texture information, resulting in unclear image details and unclear edges generated by the model. Therefore, this paper introduces Charbonnier loss to optimize the model. It has better edge retention ability and higher numerical stability. Its loss function is as follows:
[0100]
[0101] Among them, x i Represents the predicted value of the blurred image, y i represents the value of the clear image, N represents the number of samples, and ω is a constant set to 10 -3 .
[0102] The post-convolution module (3×3 convolution) converts the clear image optimized by the loss function module into an image with the same resolution and number of channels as the original input image, and finally obtains a deblurred wooden board image.
[0103] S3, training the wooden board image deblurring model based on the training set, and verifying the trained wooden board image deblurring model based on the verification set;
[0104] S4. Based on the test set, the trained wooden board image deblurring model is used to perform deblurring processing to obtain the infrared image deblurring result.
[0105] In order to verify the performance of the model, this embodiment selects the peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM) indicators to evaluate the performance of our model. On the wooden board dataset collected by ourselves, the HINet method was tested to achieve 32.24 and 89.61 in PSNR and SSIM respectively, and the method of this embodiment achieved 32.86 and 91.02 in PSNR and SSIM respectively, which is a certain improvement.
[0106] Among them, PSNR is one of the commonly used indicators to measure the quality of image reconstruction. It evaluates the degree of image distortion by comparing the peak signal-to-noise ratio between the original image and the reconstructed image. The formula is as follows:
[0107]
[0108] Among them, MAX is the maximum possible value of the image pixel (usually 255), and MSE is the mean square error, which represents the average of the sum of the squares of the average pixel differences between the original image and the reconstructed image. The value range of PSNR is usually between 0 and infinity. The larger the value, the smaller the distortion between the reconstructed image and the original image, and the better the quality.
[0109] SSIM is a structured image quality assessment indicator that not only considers the brightness information of the image, but also the contrast and structure information of the image. The formula is as follows:
[0110]
[0111] Among them, μ x and μ y are the means of the original image and the reconstructed image, respectively. and are the variances of the original image and the reconstructed image, σ xy is the covariance between the original image and the reconstructed image, c1 and c2 are constants used to stabilize the calculation. The value range of SSIM is between -1 and 1. When SSIM is close to 1, it means that the reconstructed image has a high similarity with the original image and has a high quality; when SSIM is close to -1, it means that the reconstructed image has a low similarity with the original image and has a poor quality.
[0112] Example 2
[0113] This embodiment provides a device for deblurring a wooden board image, the device comprising:
[0114] processor;
[0115] a memory having stored thereon a computer program executable on the processor;
[0116] Wherein, when the computer program is executed by the processor, the steps of the method for deblurring a wooden board image are implemented.
[0117] A computer-readable storage medium stores a wooden board image deblurring program, and when the wooden board image deblurring program is executed by the processor, the steps of the wooden board image deblurring method are implemented.
[0118] In this embodiment, the device includes but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable computing devices, consumer electronic devices, etc.
[0119] Example 3
[0120] This embodiment also provides a computer-readable storage medium storing executable instructions, which, when executed, enable the machine to perform the method for deblurring a wooden board image as described above.
[0121] Specifically, a system or device equipped with a readable storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or device can read and execute instructions stored in the readable storage medium.
[0122] In this case, the program code itself read from the machine-readable medium can realize the function of any one of the above embodiments, and thus the machine-readable code and the machine-readable storage medium storing the machine-readable code constitute part of this specification.
[0123] Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer or a cloud via a communication network.
[0124] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0125] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0126] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0127] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0128] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.
Claims
1. A method for deblurring a wooden board image, characterized in that: include: S1, obtain a blurred image dataset, and divide the dataset into a training set, a validation set, and a test set; S2, using the Transformer architecture as the backbone network combined with a feedforward neural network to build a wood board image deblurring model; S3, training the wooden board image deblurring model based on the training set, and verifying the trained wooden board image deblurring model based on the verification set; S4. Based on the test set, the trained wooden board image deblurring model is used to perform deblurring processing to obtain the infrared image deblurring result.
2. The method for deblurring a wooden board image according to claim 1, characterized in that: The wooden board image deblurring model comprises a front convolution module, an encoder, a decoder, a loss function module and a back convolution module, wherein each layer in the encoder and the decoder comprises a feedforward neural network; The front convolution module extracts low-resolution features and establishes global dependencies between image blocks; The encoder is used to extract the initial features of the image block, wherein the feedforward neural network layer optimizes the feature representation of each image block by performing nonlinear transformation to obtain shallow features; The decoder is used to remap the features extracted by the encoder back to the image block and perform deblurring and reconstruction based on the features extracted by the encoder, wherein the feedforward neural network layer optimizes the representation of the image block by nonlinear transformation to obtain high-level features and output a clear image; The loss function module guides the training process of the model and optimizes the deblurring effect of the encoder and decoder; The post-convolution module, after being optimized by the loss function module, integrates the high-resolution clear image through the convolution kernel, extracts key information, and finally obtains the deblurred wooden board image.
3. The method for deblurring a wooden board image according to claim 2, characterized in that: The execution process of the wooden board image deblurring model is as follows: The blurred image is input into the front convolution module to extract low-resolution features and establish global dependencies between image blocks; The image block features extracted by convolution enter the encoder and are converted into initial features through 1×1 point convolution. The initial features are processed by downsampling. The downsampling layer reduces the resolution of the feature map by one half and reduces the number of feature channels. The features are then represented by nonlinear transformation optimization through the feedforward neural network layer. The downsampled features are processed through multiple downsampling layers and feedforward neural network layers to obtain the downsampled features. The downsampled features are residually connected with the image block features before entering the encoder to obtain the updated image block features. The updated image block features are then layer normalized, and the encoder finally outputs shallow features, i.e. low-level features. The decoder takes shallow features as input and gradually restores the spatial resolution of the image through upsampling. Each upsampling layer doubles the resolution of the feature map while reducing the number of feature channels. The decoder then performs nonlinear transformation optimization representation through a feedforward neural network layer. High-level features are obtained through processing through multiple upsampling layers and feedforward neural network layers. At the same time, jump connections are used between the high-level features of the decoder and the shallow features of the encoder to better fuse the shallow features and the high-level features. After completing all the upsampling steps, the decoder further refines the fused shallow features and high-level features, converts the refined features into a residual image with the same resolution and number of channels as the original input image through a convolutional layer, and then adds the residual image to the initial input blurred image to generate a clear image; The loss function module optimizes the clear image using a loss function; The post-convolution module converts the clear image optimized by the loss function module into an image with the same resolution and number of channels as the original input image, extracts key information, and finally obtains a deblurred wooden board image.
4. A method for deblurring a wooden board image according to claim 2 or 3, characterized in that: Improvements to the feedforward neural network: The improved feedforward neural network includes: a normalization layer, a convolution layer, a block expansion layer, a frequency domain processing layer, a block folding layer and an activation function; the frequency domain processing layer includes a fast Fourier transform and an inverse fast Fourier transform; A frequency domain processing layer is introduced in the feedforward neural network. The fast Fourier transform is used to convert features from the spatial domain to the frequency domain. Features of specific frequencies are selected and processed in the frequency domain, and a quantization matrix is introduced for processing. The correlation between features is calculated through the self-attention mechanism. Specific frequencies are set according to actual needs, important frequencies are selected, important frequency information is retained and enhanced, and finally the processed features are converted back to the spatial domain through the inverse fast Fourier transform.
5. The method for deblurring a wooden board image according to claim 4, characterized in that: In the self-attention layers in the encoder and decoder, dilated neighborhood attention is introduced: The expanded neighborhood attention is calculated as follows: in, represents the attention vector at the i-th position, represents the first position index related to position i in the neighborhood δ calculated according to the expansion rate, k is the total number of position indexes related to position i in the neighborhood, Q i K T represents the product of query Q and key K, is a function used to calculate the complementary information between position i and the position in the neighborhood. In the expanded neighborhood attention, the corresponding value vector at position i is It is expressed as: The weighted value vector at the i-th position It can be expressed as: Among them, d k is the dimension of the query vector.
6. A device for deblurring a wooden board image, characterized in that: The device comprises: processor; a memory having stored thereon a computer program executable on the processor; Wherein, when the computer program is executed by the processor, the steps of the method for deblurring a wooden board image as claimed in any one of claims 1 to 5 are implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a wooden board image deblurring program, and when the wooden board image deblurring program is executed by the processor, the steps of the method for deblurring the wooden board image as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Image blind motion deblurring method based on CNN-Transform hybrid auto-encoder
CN113570516A
An image deblurring method based on channel attention and cross-scale feature fusion
CN114936977A
Image deblurring method and system applied to infrared thermal image and medium
CN117196990A
Cited By
Microorganism image enhancement processing method
CN119477735A
Image processing method, device and equipment
CN119946286A
