Image moiré removal method and system based on progressive fusion multi-scale strategy
Through the image de-mooring method based on the progressive fusion multi-scale strategy, using the multi-scale de-mooring network and deep convolution blocks, the problem of high computational complexity of the deep learning model in the existing technology is solved, and high computational complexity is achieved with low complexity. Quality image removal of moire effects.
Patent Information
- Application Number
- CN202210335753.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-03-31
AI Technical Summary
Existing deep learning moiré removal models have high computational complexity and cannot generate high-quality moiré-free clean images with low computational complexity.
An image de-moire method based on the progressive fusion multi-scale strategy is adopted. By constructing a multi-scale de-moire network, the progressive texture fusion module and the residual moiré removal module are used, combined with multi-scale design and deep convolution blocks, to reduce the amount of network calculations. , improve the effect of removing moire patterns.
It effectively removes moiré patterns in images with low computational complexity, generates high-quality clean images without moiré patterns, improves visual effects and performance indicators, and reduces network parameters and calculation volume.
Smart Images

Figure CN114693558B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing and computer vision, and in particular relates to an image moiré removal method and system based on a progressive fusion multi-scale strategy. Background Art
[0002] With the rapid development of mobile devices and multimedia technology, smartphones have become an indispensable tool in daily life. With the support of improved shooting quality, the popularity of mobile photography is also increasing. Images and videos are an indispensable part of modern human communication and information transmission, and are of great significance to the development of all aspects of society. Digital screens are ubiquitous in modern daily life, such as TV screens at home, computers, and large LED screens in public places. It is common to use mobile phones to shoot these screens to quickly save information. Sometimes taking pictures is the only practical way to save information. However, when shooting digital screens, moiré patterns often appear and contaminate the underlying clean images and videos. Moiré is caused by the mutual interference between the camera's color filter array (CFA) and the sub-pixel layout of the screen, resulting in color-distorted stripes in the captured images and videos, which seriously reduces the visual quality of images and videos. The development of computer vision and the upgrade of hardware have made it possible to achieve this problem, so many researchers have begun to invest in the research of image moiré removal.
[0003] Removing moiré is a challenging task because the shape and color of moiré are irregular and it spans low and high frequencies. Unlike other image restoration tasks, such as image denoising, image demosaicing, and image super-resolution, the moiré removal task needs to deal with complex low-frequency and high-frequency moiré fringes, and restore the details of the image. At the same time, moiré also causes chromatic aberration in the captured image. Since the formation of moiré is closely related to the camera imaging process, especially the frequency of the color filter array (CFA), many people have proposed methods to improve the imaging pipeline to remove moiré. However, these methods have high computational complexity and are not suitable for practical applications. In 2018, Sun et al. created a large-scale de-moiré benchmark dataset containing more than 100,000 image pairs, the TIP2018 dataset, and proposed a novel multi-resolution fully convolutional network to remove moiré, which greatly promoted the development of image de-moiré tasks.
[0004] Image moiré removal has important practical significance. For a huge number of digital images, manually removing moiré from images will cost a lot of manpower and time. The image moiré removal algorithm solves this problem. Developers only need to use a trained moiré removal network to automatically remove moiré using the network, avoiding repetitive work and saving a lot of time. However, the existing deep learning moiré removal model has a high computational complexity and cannot generate high-quality moiré-free clean images at a low computational complexity. Therefore, further research and improvement are needed. Summary of the invention
[0005] The object of the present invention is to provide an image demoiré method and system based on a progressive fusion multi-scale strategy, which is conducive to achieving high-quality image demoiré.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is: an image moiré removal method based on a progressive fusion multi-scale strategy, comprising the following steps:
[0007] Step S1, processing the images in the original data set to obtain moiré images and clean image pairs, and preprocessing each image to obtain a training data set;
[0008] Step S2, constructing a multi-scale moiré removal network based on a progressive fusion multi-scale strategy, wherein the multi-scale moiré removal network adopts a multi-scale design and consists of two progressive texture fusion modules and a plurality of residual moiré removal modules;
[0009] Step S3, constructing a loss function for training the multi-scale moiré removal network;
[0010] Step S4, using a training data set to train the multi-scale moiré removal network;
[0011] Step S5: input the moiré image to be processed into the trained multi-scale moiré removal network, and output a clean image after the moiré is removed.
[0012] Furthermore, the step S1 specifically includes the following steps:
[0013] Step S11, obtaining an original data set, wherein each image in the original data set is composed of a moiré image and a clean image of the same size, dividing each image in the original data set into separate moiré images and clean images of the same size; and combining the moiré image and the clean image from the same image into a moiré image and a clean image pair;
[0014] Step S12, performing the same random flipping on the two images of the moiré image and the clean image pair and center-cropping them into a moiré image and a clean image of size H×W, while maintaining the relationship between the moiré image and the clean image pair;
[0015] Step S13: Normalize all moiré images and clean images of size H×W; given an image I(i,j), calculate the normalized image The formula is as follows:
[0016]
[0017] Among them, (i, j) represents the position of the pixel.
[0018] Furthermore, the step S2 specifically includes the following steps:
[0019] Step S21, constructing a residual moiré removal module, and using the residual moiré removal module to remove moiré from an image and correct the chromatic aberration of the image;
[0020] Step S22, constructing a progressive texture fusion module, using the progressive texture fusion module to compensate for details lost by downsampling and fuse low-scale information with high-scale information to achieve a better de-moiré effect;
[0021] Step S23: construct a multi-scale moiré removal network by combining the progressive texture fusion module and the residual moiré removal module, and use the multi-scale moiré removal network to gradually remove moiré from low resolution to high resolution.
[0022] Furthermore, in step S21, the input of the residual moiré removal module is a feature map of a moiré image, wherein the input feature map is represented by F i Indicates that its size is C×H×W; this module consists of two deep convolution blocks and a local color correction module. The deep convolution block is responsible for removing moiré patterns, and the local color correction module is responsible for correcting the color difference in the image; the feature map obtained by inputting the first convolution block is added to F i Get F of size C×H×W i2 , F i2 Input to the second convolutional block to get F of size C×H×W i3 , F i3 Input to the local color correction module to get the output F co , then F co Add F element by element i2 The final output F of the residual moiré removal module is obtained o ;
[0023] Each deep convolution block is composed of an extended convolution layer, an activation layer, a deep convolution layer, an activation layer, an attention module, and a bottleneck convolution layer in sequence; both activation layers use the Swish activation function, and both the extended convolution layer and the bottleneck convolution layer use convolution with a convolution kernel of 1×1. Assuming that the input feature size of the deep convolution block is C×H×W, the extended convolution layer enlarges the feature map with the original channel number C to 2C, and the bottleneck convolution layer reduces the feature map with the original channel number 2C to C; the deep convolution layer is a convolution with a convolution kernel of 5×5 and a grouping number of 2C; the attention module uses a channel attention module;
[0024] The input of the local color correction module is F i3 , which consists of an average pooling layer, a convolutional layer, an activation layer, a convolutional layer, an activation layer, a convolutional layer, an upsampling layer, a channel attention module, and a convolutional layer in order; the size of the average pooling layer is 2, and the stride is also 2; the four convolutional layers are all convolutions with a convolution kernel of 1×1, the activation layer uses the ReLu activation function, and the upsampling layer uses bilinear interpolation upsampling with a magnification of 2; the input F of this module i3 The color feature F is obtained by passing through the average pooling layer, convolution layer, activation layer, convolution layer, activation layer, convolution layer, and upsampling layer in sequence. lc , then F lc and F i3 Connect together and input into the channel attention module and convolution layer to get the color-corrected output F co .
[0025] Furthermore, in step S22, the input of the progressive texture fusion module is the low-scale final de-moiré feature. Low-scale de-moiré image and high-scale moiré image I h ; This module consists of an upsampling layer, three convolutional layers, two activation layers, two attention modules and two deep convolutional layers; the upsampling layer uses bilinear interpolation upsampling with a magnification of 2, the three convolutional layers all use convolution with a convolution kernel of 3×3, the two activation layers all use Swish activation function, the deep convolutional layer is a convolution with a convolution kernel of 5×5 and a grouping number of 2C, and the attention module uses a channel attention module;
[0026] The fusion mode of the progressive texture fusion module is: Assume I h The size is 3×H×W, The size is The size is First and They are sent to the upsampling layer for upsampling, and the sizes of 3×H×W are obtained respectively. and size C×H×W Will and I h The difference map is obtained by element-by-element subtraction, and the difference map is sent to the convolution layer to extract features, and then the feature is connected with Get the feature F of size 2C×H×W d ; Use deep convolutional layers to extract F d The texture features in F d After passing through the deep convolution layer, activation layer, deep convolution layer, activation layer, attention module and convolution layer in sequence, a feature of size C×H×W is obtained, and the feature is added element by element Get the first fusion feature F f1 ; In order to improve the network's utilization of low-scale feature information, Input to the attention module and compare the result with F f1 Connect them and input them into the convolutional layer for the second fusion to obtain feature F f2 Finally, F f2 with I h Connect together to get the final output F of the progressive texture fusion module uf .
[0027] 6. The image de-moiré method based on the progressive fusion multi-scale strategy according to claim 3 is characterized in that in the step S23, the multi-scale de-moiré network has three branches, and the size of the moiré image in the training data set of the input network is 3×H×W, and the image is represented as I, which is the input of the first branch. I is input to the downsampling layer for downsampling to obtain the input I' of the second branch, and its size is Input I' to the downsampling layer and downsample to get the input I" of the third branch, whose size is
[0028] The third branch consists of six residual moiré removal modules and two convolutional layers; a convolutional layer with a convolution kernel of 3×3 is used to extract the feature F” of I”, and F” is sent to six consecutive residual moiré removal modules to obtain the final de-moiré feature. The expansion coefficients of the deep convolutional layers in the first two and last residual moiré removal modules are set to 1. The expansion coefficients of the six deep convolutional layers in the third to fifth modules are set to 2, 3, 5, 7, 9, and 1, respectively, to expand the receptive field of the network to cope with moiré with a larger coverage area. The output feature of the last residual moiré removal module is Send it to the convolutional layer to get a size of Demoiré
[0029] The second branch consists of a progressive texture fusion module, five residual moiré removal modules and a convolution layer; the final output feature of the third branch and de-moiré And I' are input into the progressive texture fusion module to obtain the fusion feature F', and F' is sent to five consecutive residual moiré removal modules to obtain the final moiré removal feature The expansion coefficients of the deep convolutional layers in the first and last residual moiré removal modules are set to 1, and the expansion coefficients of the six deep convolutional layers in the middle three modules are set to 1, 2, 3, 5, 7, and 1 respectively; the output feature of the last residual moiré removal module is Send it to the convolutional layer to get a size of Demoiré
[0030] The first branch consists of a progressive texture fusion module, four residual moiré removal modules and a convolution layer; the final output feature of the second branch and de-moiré And I are input into the progressive texture fusion module to obtain the fusion feature F, and F is sent to four consecutive residual moiré removal modules to obtain the final moiré removal feature The expansion coefficients of the deep convolutional layers in the first and last residual moiré removal modules are set to 1, and the expansion coefficients of the four deep convolutional layers in the middle two modules are set to 2, 3, 5, and 7 respectively; the output feature of the last residual moiré removal module is Send it to the convolutional layer to get a de-moiré map of size 3×H×W
[0031] Furthermore, the step S3 specifically includes the following steps:
[0032] Step S31, construct the overall optimization target of the entire network; the optimization target is as follows:
[0033] min(L),
[0034]
[0035] Among them, min(L) means minimizing L, L represents the total loss of the network to remove moiré patterns, and They represent the loss functions of training the first, second and third branch networks to remove moiré images, respectively. η represents the weight parameter of the first branch loss function; the loss function of the i-th branch The calculation formula is as follows:
[0036]
[0037] in, represents the Charbonnier loss of the de-moiré image and the clean image, Represents the edge texture loss of the de-moiré image and the clean image, represents the color loss of the de-moiré image and the clean image; the clean image of the first branch is the clean image in the dataset, with a size of 3×H×W; the image is downsampled to Get the clean image of the second branch; continue downsampling to Get the clean image of the third branch;
[0038] Step S32, constructing the Charbonnier loss of the de-moiré image and the clean image; The calculation formula is as follows:
[0039]
[0040] in, represents the de-moiré image output by the d-th branch, O d represents the paired clean image, ∈ represents a constant for controlling accuracy, and λ C Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d ;
[0041] Step S33, constructing edge texture loss of the de-moiré image and the clean image; The calculation formula is as follows:
[0042]
[0043] Among them, || ||1 is the absolute value operation, Sobel * Represents the improved Sobel filter in different directions, Sobel * () represents the convolution operation, λ ASL Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d ;
[0044] Step S34, constructing the color loss of the de-moiré image and the clean image; The calculation formula is as follows:
[0045]
[0046] Where G represents the Gaussian blur kernel, represents the blurred de-moiré image, G(O d ) represents a blurred clean image, is the square operation of the two-norm, λ cr Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d .
[0047] Furthermore, the step S4 specifically includes the following steps:
[0048] Step S41, randomly select a pair of moiré images and clean images from the training data set, the moiré image and the clean image of the image pair are respectively denoted as I and O, bilinearly interpolate and downsample O to obtain O', and bilinearly interpolate and downsample O' to obtain O".
[0049] Step S42, the first stage of training the image de-moiré network based on the progressive fusion multi-scale strategy; input the moiré image I, and obtain three de-moiré images of different scales in turn through the three branches of the network and Calculate the total loss L for removing moiré patterns, use the back-propagation method to calculate the gradients of each parameter in the network, and use the Adam optimization method to update the parameters;
[0050] Step S43, the second stage of training the image de-moiré network based on the progressive fusion multi-scale strategy; the input and training methods are the same as those of the first stage, except that the color loss weight in the de-moiré total loss L is set to 0, and the network is fine-tuned;
[0051] Step S44: The entire training process is iterated 2.5 million times, and in each iteration, multiple image pairs are randomly sampled as a batch for training. The first two million iterations perform the first stage training of step S42, and the remaining 500,000 iterations perform the second stage training of step S43.
[0052] Furthermore, the specific implementation method of step S5 is as follows: input the moiré image I to be processed, and obtain three moiré-free images of different scales in sequence through the three branches of the network: and in That is, the clean image corresponding to the moiré image I after the moiré is removed.
[0053] The present invention also provides an image moiré removal system based on a progressive fusion multi-scale strategy, comprising a memory, a processor, and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the above-mentioned method steps can be implemented.
[0054] Compared with the prior art, the present invention has the following beneficial effects: the present invention proposes an image moiré removal method and system based on a progressive fusion multi-scale strategy, which uses a multi-scale design to effectively remove moiré and supplement details from low resolution to high resolution. The method uses a progressive fusion module, which first compensates for the details lost by downsampling and fuses low-scale information with high-scale information to achieve more effective and stable moiré removal. At the same time, the method also designs a residual moiré removal module, which uses deep convolution instead of ordinary convolution to greatly reduce the amount of network calculation. The present invention can remove moiré in an image at a low computational complexity and generate a high-quality moiré-free clean image. The generated moiré-free image has improved visual effects and performance indicators, and the network parameters and calculation amount are reduced. Therefore, the present invention has strong practicality and broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 The present invention is a flowchart of a method implementation according to an embodiment of the present invention.
[0056] Figure 2 Schematic diagram of the structure of a multi-scale de-moiré network in an embodiment of the present invention.
[0057] Figure 3 Schematic diagram of the structure of a residual moiré removal module in an embodiment of the present invention.
[0058] Figure 4 FIG. 4 is a schematic diagram of the structure of a local color correction module in an embodiment of the present invention.
[0059] Figure 5 Schematic diagram of the structure of a progressive texture fusion module in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0061] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. 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 application belongs.
[0062] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. 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 "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0063] like Figure 1 As shown, this embodiment provides an image moiré removal method based on a progressive fusion multi-scale strategy, comprising the following steps:
[0064] Step S1, processing the images in the original data set to obtain moiré images and clean image pairs, and preprocessing each image to obtain a training data set. Step S1 specifically includes the following steps:
[0065] Step S11, obtaining an original data set, wherein each image in the original data set is composed of a splicing of a moiré image and a clean image of the same size, dividing each image in the original data set into separate moiré images and clean images of the same size; and combining moiré images and clean images from the same image into a moiré image and clean image pair.
[0066] Step S12: Perform the same random flipping on the two images of the moiré image and the clean image pair and center-crop them into a moiré image and a clean image of size H×W, while maintaining the relationship between the moiré image and the clean image pair.
[0067] Step S13: Normalize all moiré images and clean images of size H×W; given an image I(i,j), calculate the normalized image The formula is as follows:
[0068]
[0069] Among them, (i, j) represents the position of the pixel.
[0070] Step S2: construct a multi-scale de-moiré network based on a progressive fusion multi-scale strategy. Figure 2 As shown, the multi-scale moiré removal network adopts a multi-scale design and consists of two progressive texture fusion modules and multiple residual moiré removal modules.
[0071] Specifically, step S2 includes the following steps:
[0072] Step S21: construct a residual moiré removal module, and use the residual moiré removal module to remove moiré from an image and correct the color difference of the image.
[0073] like Figure 3 As shown, the input of the residual moiré removal module is a feature map of a moiré image, where the input feature map is represented by F i Indicates that its size is C×H×W; this module consists of two deep convolution blocks and a local color correction module. The deep convolution block is responsible for removing moiré patterns, and the local color correction module is responsible for correcting the color difference in the image; the feature map obtained by inputting the first convolution block is added to F i Get F of size C×H×W i2 , F i2 Input to the second convolutional block to get F of size C×H×W i3 , F i3 Input to the local color correction module to get the output F co , then F co Add F element by element i2 The final output F of the residual moiré removal module is obtained o .
[0074] Each deep convolution block is composed of an extended convolution layer, an activation layer, a deep convolution layer, an activation layer, an attention module and a bottleneck convolution layer in sequence; both activation layers use the Swish activation function, and both the extended convolution layer and the bottleneck convolution layer use convolution with a kernel of 1×1. Assuming the input feature size of the deep convolution block is C×H×W, the extended convolution layer enlarges the feature map with C channels to 2C channels, and the bottleneck convolution layer reduces the feature map with 2C channels to C channels; the deep convolution layer is a convolution with a kernel of 5×5 and 2C groups; the attention module uses a channel attention module (SE).
[0075] like Figure 4 As shown, the input of the local color correction module is F i3 , which consists of an average pooling layer, a convolutional layer, an activation layer, a convolutional layer, an activation layer, a convolutional layer, an upsampling layer, a channel attention module, and a convolutional layer in order; the size of the average pooling layer is 2, and the stride is also 2; the four convolutional layers are all convolutions with a convolution kernel of 1×1, the activation layer uses the ReLu activation function, and the upsampling layer uses bilinear interpolation upsampling with a magnification of 2; the input F of this module i3 The color feature F is obtained by passing through the average pooling layer, convolution layer, activation layer, convolution layer, activation layer, convolution layer, and upsampling layer in sequence. lc , then F lc and F i3 Connect together and input into the channel attention module and convolution layer to get the color-corrected output F co .
[0076] Step S22: construct a progressive texture fusion module to use the progressive texture fusion module to compensate for details lost by downsampling and fuse low-scale information with high-scale information to achieve a better de-moiré effect.
[0077] like Figure 5 As shown, the input of the progressive texture fusion module is the low-scale final de-moiré feature Low-scale de-moiré image and high-scale moiré image I h ; This module consists of an upsampling layer, three convolutional layers, two activation layers, two attention modules and two deep convolutional layers; the upsampling layer uses bilinear interpolation upsampling with a magnification of 2, the three convolutional layers all use convolution with a convolution kernel of 3×3, the two activation layers all use Swish activation function, the deep convolutional layer is a convolution with a convolution kernel of 5×5 and a grouping number of 2C, and the attention module uses a channel attention module.
[0078] The fusion mode of the progressive texture fusion module is: Assume I h The size is 3×H×W, The size is The size is First and They are sent to the upsampling layer for upsampling, and the sizes of 3×H×W are obtained respectively. and size C×H×W Will and I h The difference map is obtained by element-by-element subtraction, and the difference map is sent to the convolution layer to extract features, and then the feature is connected with Get the feature F of size 2C×H×W d ; Use deep convolutional layers to extract F d The texture features in F d After passing through the deep convolution layer, activation layer, deep convolution layer, activation layer, attention module and convolution layer in sequence, a feature of size C×H×W is obtained, and the feature is added element by element Get the first fusion feature F f1 ; In order to improve the network's utilization of low-scale feature information, Input to the attention module and compare the result with F f1 Connect them and input them into the convolutional layer for the second fusion to obtain feature F f2 Finally, F f2 with I h Connect together to get the final output F of the progressive texture fusion module uf .
[0079] Step S23: construct a multi-scale moiré removal network by combining the progressive texture fusion module and the residual moiré removal module, and use the multi-scale moiré removal network to gradually remove moiré from low resolution to high resolution.
[0080] In step S23, the multi-scale de-moiré network has three branches. Assume that the size of the moiré image in the training data set of the input network is 3×H×W. The image is represented as I, which is the input of the first branch. I is input to the downsampling layer and downsampled to obtain the input I' of the second branch, whose size is Input I' to the downsampling layer and downsample to get the input I" of the third branch, whose size is
[0081] The third branch consists of six residual moiré removal modules and two convolutional layers; a convolutional layer with a convolution kernel of 3×3 is used to extract the feature F” of I”, and F” is sent to six consecutive residual moiré removal modules to obtain the final de-moiré feature. The expansion coefficients of the deep convolutional layers in the first two and last residual moiré removal modules are set to 1. The expansion coefficients of the six deep convolutional layers in the third to fifth modules are set to 2, 3, 5, 7, 9, and 1, respectively, to expand the receptive field of the network to cope with moiré with a larger coverage area. The output feature of the last residual moiré removal module is Send it to the convolutional layer to get a size of Demoiré
[0082] The second branch consists of a progressive texture fusion module, five residual moiré removal modules and a convolution layer; the final output feature of the third branch and de-moiré And I' are input into the progressive texture fusion module to obtain the fusion feature F', and F' is sent to five consecutive residual moiré removal modules to obtain the final moiré removal feature The expansion coefficients of the deep convolutional layers in the first and last residual moiré removal modules are set to 1, and the expansion coefficients of the six deep convolutional layers in the middle three modules are set to 1, 2, 3, 5, 7, and 1 respectively; the output feature of the last residual moiré removal module is Send it to the convolutional layer to get a size of Demoiré
[0083] The first branch consists of a progressive texture fusion module, four residual moiré removal modules and a convolution layer; the final output feature of the second branch and de-moiré And I are input into the progressive texture fusion module to obtain the fusion feature F, and F is sent to four consecutive residual moiré removal modules to obtain the final moiré removal feature The expansion coefficients of the deep convolutional layers in the first and last residual moiré removal modules are set to 1, and the expansion coefficients of the four deep convolutional layers in the middle two modules are set to 2, 3, 5, and 7 respectively; the output feature of the last residual moiré removal module is Send it to the convolutional layer to get a de-moiré map of size 3×H×W
[0084] Step S3: constructing a loss function for training the multi-scale moiré removal network.
[0085] The step S3 specifically comprises the following steps:
[0086] Step S31, construct the overall optimization target of the entire network; the optimization target is as follows:
[0087] min(L),
[0088]
[0089] Among them, min(L) means minimizing L, L represents the total loss of the network to remove moiré patterns, and They represent the loss functions of training the first, second and third branch networks to remove moiré images, respectively. η represents the weight parameter of the first branch loss function; the loss function of the i-th branch The calculation formula is as follows:
[0090]
[0091] in, represents the Charbonnier loss of the de-moiré image and the clean image, Represents the edge texture loss of the de-moiré image and the clean image, represents the color loss of the de-moiré image and the clean image; the clean image of the first branch is the clean image in the dataset, with a size of 3×H×W; the image is downsampled to Get the clean image of the second branch; continue downsampling to Get the clean image of the third branch.
[0092] Step S32, constructing the Charbonnier loss of the de-moiré image and the clean image; The calculation formula is as follows:
[0093]
[0094] in, represents the de-moiré image output by the d-th branch, O d represents the paired clean image, ∈ represents a constant for controlling accuracy, and λ C Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d .
[0095] Step S33, constructing edge texture loss of the de-moiré image and the clean image; The calculation formula is as follows:
[0096]
[0097] Among them, || ||1 is the absolute value operation, Sobel * Represents the improved Sobel filter in different directions, Sobel * () represents the convolution operation, λ ASL Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d .
[0098] Step S34, constructing the color loss of the de-moiré image and the clean image; The calculation formula is as follows:
[0099]
[0100] Where G represents the Gaussian blur kernel, represents the blurred de-moiré image, G(O d ) represents a blurred clean image, is the square operation of the two-norm, λ cr Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d .
[0101] Step S4: using a training data set to train the multi-scale moiré removal network.
[0102] The step S4 specifically comprises the following steps:
[0103] Step S41: randomly select a pair of moiré images and clean images from the training data set, the moiré image and the clean image of the image pair are respectively denoted as I and O, bilinearly interpolate and downsample O to obtain O', and bilinearly interpolate and downsample O' to obtain O".
[0104] Step S42, the first stage of training the image de-moiré network based on the progressive fusion multi-scale strategy; input the moiré image I, and obtain three de-moiré images of different scales in turn through the three branches of the network and The total loss L for removing moiré is calculated, the gradient of each parameter in the network is calculated using the back-propagation method, and the parameters are updated using the Adam optimization method.
[0105] Step S43, the second stage of training the image demoiré network based on the progressive fusion multi-scale strategy; the input and training methods are the same as the first stage, except that the color loss weight in the total demoiré loss L is set to 0, and the network is fine-tuned.
[0106] Step S44: The entire training process is iterated 2.5 million times, and in each iteration, multiple image pairs are randomly sampled as a batch for training. The first two million iterations perform the first stage training of step S42, and the remaining 500,000 iterations perform the second stage training of step S43.
[0107] Step S5: Input the moiré image to be processed into the trained multi-scale moiré removal network, and output a clean image after the moiré is removed. Specifically, input the moiré image to be processed I, and obtain three moiré removal images of different scales in turn through the three branches of the network. and in That is, the clean image corresponding to the moiré image I after the moiré is removed.
[0108] This embodiment also provides an image moiré removal system based on a progressive fusion multi-scale strategy, including a memory, a processor, and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the above-mentioned method steps can be implemented.
[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0110] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. 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.
[0111] 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 including 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.
[0112] 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 The steps for the functions specified in one or more boxes.
[0113] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
Claims
1. An image moiré removal method based on a progressive fusion multi-scale strategy, characterized in that: The following steps are involved: Step S1, processing the images in the original data set to obtain moiré images and clean image pairs, and preprocessing each image to obtain a training data set; Step S2, constructing a multi-scale moiré removal network based on a progressive fusion multi-scale strategy, wherein the multi-scale moiré removal network adopts a multi-scale design and consists of two progressive texture fusion modules and a plurality of residual moiré removal modules; Step S3, constructing a loss function for training the multi-scale moiré removal network; Step S4, using a training data set to train the multi-scale moiré removal network; Step S5, inputting the moiré image to be processed into a trained multi-scale moiré removal network, and outputting a clean image after the moiré is removed; The step S2 specifically includes the following steps: Step S21, constructing a residual moiré removal module, and using the residual moiré removal module to remove moiré from an image and correct the chromatic aberration of the image; Step S22, constructing a progressive texture fusion module, using the progressive texture fusion module to compensate for details lost by downsampling and fuse low-scale information with high-scale information to achieve a better de-moiré effect; Step S23, combining the progressive texture fusion module and the residual moiré removal module to construct a multi-scale moiré removal network, and using the multi-scale moiré removal network to gradually remove moiré from low resolution to high resolution; In step S21, the input of the residual moiré removal module is a feature map of a moiré image, wherein the input feature map is represented by F i Indicates that its size is C×H×W; this module consists of two deep convolution blocks and a local color correction module. The deep convolution block is responsible for removing moiré patterns, and the local color correction module is responsible for correcting the color difference in the image; the feature map obtained by inputting the first convolution block is added to F i Get F of size C×H×W i2 , F i2 Input to the second convolutional block to get F of size C×H×W i3 , F i3 Input to the local color correction module to get the output F co , then F co Add F element by element i2 The final output F of the residual moiré removal module is obtained o ; Each deep convolution block is composed of an extended convolution layer, an activation layer, a deep convolution layer, an activation layer, an attention module, and a bottleneck convolution layer in sequence; both activation layers use the Swish activation function, and both the extended convolution layer and the bottleneck convolution layer use convolution with a convolution kernel of 1×1. Assuming that the input feature size of the deep convolution block is C×H×W, the extended convolution layer enlarges the feature map with the original channel number C to 2C, and the bottleneck convolution layer reduces the feature map with the original channel number 2C to C; the deep convolution layer is a convolution with a convolution kernel of 5×5 and a grouping number of 2C; the attention module uses a channel attention module; The input of the local color correction module is F i3 , which consists of an average pooling layer, a convolutional layer, an activation layer, a convolutional layer, an activation layer, a convolutional layer, an upsampling layer, a channel attention module, and a convolutional layer in order; the size of the average pooling layer is 2, and the stride is also 2; the four convolutional layers are all convolutions with a convolution kernel of 1×1, the activation layer uses the ReLu activation function, and the upsampling layer uses bilinear interpolation upsampling with a magnification of 2; the input F of this module i3 The color feature F is obtained by passing through the average pooling layer, convolution layer, activation layer, convolution layer, activation layer, convolution layer, and upsampling layer in sequence. lc , then F lc and F i3 Connect together and input into the channel attention module and convolution layer to get the color-corrected output F co ; In step S22, the input of the progressive texture fusion module is the low-scale final de-moiré feature Low-scale de-moiré image and high-scale moiré image I h ; This module consists of an upsampling layer, three convolutional layers, two activation layers, two attention modules and two deep convolutional layers; the upsampling layer uses bilinear interpolation upsampling with a magnification of 2, the three convolutional layers all use convolution with a convolution kernel of 3×3, the two activation layers all use Swish activation function, the deep convolutional layer is a convolution with a convolution kernel of 5×5 and a grouping number of 2C, and the attention module uses a channel attention module; The fusion mode of the progressive texture fusion module is: Assume I h The size is 3×H×W, The size is 3× The size is First and They are sent to the upsampling layer for upsampling, and the sizes of 3×H×W are obtained respectively. and size C×H×W Will and I h The difference map is obtained by element-by-element subtraction, and the difference map is sent to the convolution layer to extract features, and then the feature is connected with Get the feature F of size 2C×H×W d ; Use deep convolutional layers to extract F d The texture features in F d After passing through the deep convolution layer, activation layer, deep convolution layer, activation layer, attention module and convolution layer in sequence, a feature of size C×H×W is obtained, and the feature is added element by element Get the first fusion feature F f1 ; In order to improve the network's utilization of low-scale feature information, Input to the attention module and compare the result with F f1 Connect them and input them into the convolutional layer for the second fusion to obtain feature F f2 Finally, F f2 with I h Connect together to get the final output F of the progressive texture fusion module uf ; In step S23, the multi-scale de-moiré network has three branches. Assume that the size of the moiré image in the training data set of the input network is 3×H×W. The image is represented as I, which is the input of the first branch. I is input to the downsampling layer and downsampled to obtain the input I' of the second branch, whose size is Input I' to the downsampling layer and downsample to get the input I" of the third branch, whose size is The third branch consists of six residual moiré removal modules and two convolutional layers; a convolutional layer with a convolution kernel of 3×3 is used to extract the feature F” of I”, and F” is sent to six consecutive residual moiré removal modules to obtain the final de-moiré feature. The expansion coefficients of the deep convolutional layers in the first two and last residual moiré removal modules are set to 1. The expansion coefficients of the six deep convolutional layers in the third to fifth modules are set to 2, 3, 5, 7, 9, and 1, respectively, to expand the receptive field of the network to cope with moiré with a larger coverage area. The output feature of the last residual moiré removal module is Send it to the convolutional layer to get a size of Demoiré The second branch consists of a progressive texture fusion module, five residual moiré removal modules and a convolution layer; the final output feature of the third branch and de-moiré And I' are input into the progressive texture fusion module to obtain the fusion feature F', and F' is sent to five consecutive residual moiré removal modules to obtain the final moiré removal feature The expansion coefficients of the deep convolutional layers in the first and last residual moiré removal modules are set to 1, and the expansion coefficients of the six deep convolutional layers in the middle three modules are set to 1, 2, 3, 5, 7, and 1 respectively; the output feature of the last residual moiré removal module is Send it to the convolutional layer to get a size of Demoiré The first branch consists of a progressive texture fusion module, four residual moiré removal modules and a convolution layer; the final output feature of the second branch and de-moiré And I are input into the progressive texture fusion module to obtain the fusion feature F, and F is sent to four consecutive residual moiré removal modules to obtain the final moiré removal feature The expansion coefficients of the deep convolutional layers in the first and last residual moiré removal modules are set to 1, and the expansion coefficients of the four deep convolutional layers in the middle two modules are set to 2, 3, 5, and 7 respectively; the output feature of the last residual moiré removal module is Send it to the convolutional layer to get a de-moiré map of size 3×H×W The step S3 specifically comprises the following steps: Step S31, construct the overall optimization target of the entire network; the optimization target is as follows: min(L), Among them, min(L) means minimizing L, L represents the total loss of the network to remove moiré patterns, and They represent the loss functions of training the first, second and third branch networks to remove moiré images, respectively. η represents the weight parameter of the first branch loss function; the loss function of the i-th branch The calculation formula is as follows: in, represents the Charbonnier loss of the de-moiré image and the clean image, Represents the edge texture loss of the de-moiré image and the clean image, represents the color loss of the de-moiré image and the clean image; the clean image of the first branch is the clean image in the dataset, with a size of 3×H×W; the image is downsampled to Get the clean image of the second branch; continue downsampling to Get the clean image of the third branch; Step S32, constructing the Charbonnier loss of the de-moiré image and the clean image; The calculation formula is as follows: in, represents the de-moiré image output by the d-th branch, O d represents the paired clean image, ∈ represents a constant for controlling accuracy, and λ C Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d ; Step S33, constructing edge texture loss of the de-moiré image and the clean image; The calculation formula is as follows: Among them, || ||1 is the absolute value operation, Sobel * Represents the improved Sobel filter in different directions, Sobel * () represents the convolution operation, λ ASL Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d ; Step S34, constructing the color loss of the de-moiré image and the clean image; The calculation formula is as follows: Where G represents the Gaussian blur kernel, represents the blurred de-moiré image, G(O d ) represents a blurred clean image, is the square operation of the two-norm, λ cr Represents the weight of the loss; calculate the three branches When the loss is applied, the de-moiré image of this branch and the clean image of the corresponding size are used as and O d .
2. The image moiré removal method based on progressive fusion multi-scale strategy according to claim 1, characterized in that: The step S1 specifically includes the following steps: Step S11, obtaining an original data set, wherein each image in the original data set is composed of a moiré image and a clean image of the same size, dividing each image in the original data set into separate moiré images and clean images of the same size; and combining the moiré image and the clean image from the same image into a moiré image and a clean image pair; Step S12, performing the same random flipping on the two images of the moiré image and the clean image pair and center-cropping them into a moiré image and a clean image of size H×W, while maintaining the relationship between the moiré image and the clean image pair; Step S13: Normalize all moiré images and clean images of size H×W; given an image I(i,j), calculate the normalized image The formula is as follows: Among them, (i, j) represents the position of the pixel.
3. The image moiré removal method based on progressive fusion multi-scale strategy according to claim 1, characterized in that: The step S4 specifically comprises the following steps: Step S41, randomly select a pair of moiré images and clean images from the training data set, the moiré image and the clean image of the image pair are respectively denoted as I and O, bilinearly interpolate and downsample O to obtain O', and bilinearly interpolate and downsample O' to obtain O". Step S42, the first stage of training the image de-moiré network based on the progressive fusion multi-scale strategy; input the moiré image I, and obtain three de-moiré images of different scales in turn through the three branches of the network and Calculate the total loss L for removing moiré patterns, use the back-propagation method to calculate the gradients of each parameter in the network, and use the Adam optimization method to update the parameters; Step S43, the second stage of training the image de-moiré network based on the progressive fusion multi-scale strategy; the input and training methods are the same as those of the first stage, except that the color loss weight in the de-moiré total loss L is set to 0, and the network is fine-tuned; Step S44: The entire training process is iterated 2.5 million times, and in each iteration, multiple image pairs are randomly sampled as a batch for training. The first two million iterations perform the first stage training of step S42, and the remaining 500,000 iterations perform the second stage training of step S43.
4. The image moiré removal method based on progressive fusion multi-scale strategy according to claim 3, characterized in that: The specific implementation method of step S5 is: input the moiré image I to be processed, and obtain three moiré-free images of different scales in sequence through the three branches of the network. and in That is, the clean image corresponding to the moiré image I after the moiré is removed.
5. An image moiré removal system based on a progressive fusion multi-scale strategy, characterized in that: The method comprises a memory, a processor and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the method steps as described in any one of claims 1 to 4 can be implemented.
Citation Information
Patent Citations
Image Semantic Segmentation Method Based on Deep Full Convolutional Network and Conditional Random Field
AU2020103901A4
Image restoration method based on deep learning image moire elimination
CN112184591A
Mask-based deep learning video moire removing method
CN112598602A
Screen shooting image moire removal method oriented to Raw domain
CN113066027A
Training method for deep residual network for removing a moire pattern of two-dimensional code
WO2021134874A1
