Edge-guided image inpainting method integrating global information and multi-color space

By integrating global information and multi-color space edge-guided image repair methods, using edge completion and image repair networks, combined with CNN residual network and Swin attention structure, it solves the problem of structural disorder and texture that are prone to occur in image repair results in the existing technology. Blur problem is eliminated, clear and complete image restoration and color unity are achieved.

CN118411316BActive Publication Date: 2024-10-08QINGHAI UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410597091.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2024-10-08
Estimated Expiration
2044-05-14

AI Technical Summary

Technical Problem

When existing image restoration methods deal with images that are very different from natural images in color, structure, style, etc., due to the lack of prior information such as structure and texture, the restoration results are prone to problems such as structural disorder, color distortion, and texture blur.

Method used

An edge-guided image repair method is adopted that fuses global information and multi-color space. Through the pre-built edge-guided image repair model, edge completion network and image repair network are used, combined with CNN residual network and Swin attention structure, to extract and fuse images. The global information and local information in the image are used for image restoration.

Benefits of technology

It achieves a clear and complete restoration of the basic structure of the damaged image, and maintains a high degree of unity in color with the entire image, avoiding the problems of structural disorder and texture blur.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118411316B_ABST
    Figure CN118411316B_ABST
Patent Text Reader

Abstract

The present invention provides an edge-guided image restoration method that fuses global information and multi-color space, and relates to the field of image processing technology. The edge-guided image restoration model of the present invention includes an edge completion network and an image restoration network; the edge completion network outputs a restored single-channel edge image; the image restoration network uses the restored edge structure map and the RGB map of the damaged image to be restored as input, combines the YUV encoded image of the damaged image to be restored for sampling, and outputs the restored RGB image; the edge completion network and the image restoration network are both based on an encoder-decoder architecture, and a stacked TMC feature interaction block is inserted between the encoder and the decoder, and a CNN residual network and a SwinTransformer structure are used in the TMC feature interaction block to extract and fuse the global information and local information in the image. The present invention can clearly and completely restore the basic structure of the damaged image, and can also maintain a high degree of unity with the overall image in terms of color.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an edge-guided image restoration method that integrates global information and multiple color spaces. Background Art

[0002] Image digital restoration is a computer technology that uses prior information of existing intact areas to estimate and fill in damaged areas so that the restoration results meet the visual perception of the human eye.

[0003] A common image restoration method is the image restoration method based on deep learning, but this image restoration method is mainly used for real-world image restoration, such as outdoor scenes and face restoration. However, when it comes to images that are very different from natural images in terms of color, structure, style, etc., the existing methods lack the joint constraint guidance of the restoration process by prior information such as structure and texture, resulting in image results that are prone to structural disorder, color distortion, and texture blur. Summary of the invention

[0004] 1. Technical issues to be solved

[0005] In view of the shortcomings of the existing technology, the present invention provides an edge-guided image restoration method that integrates global information and multi-color space, which solves the technical problems that the existing methods lack joint constraint guidance of the restoration process by prior information, resulting in image restoration results prone to structural disorder, color distortion, and texture blur.

[0006] (II) Technical solution

[0007] To achieve the above objectives, the present invention is implemented through the following technical solutions:

[0008] In a first aspect, the present invention provides an edge-guided image restoration method that integrates global information and multi-color space, comprising:

[0009] Obtaining a damaged image to be repaired;

[0010] The damaged image to be repaired is processed based on the pre-built edge-guided image repair model to obtain a repaired RGB image;

[0011] Among them, the edge-guided image restoration model includes an edge completion network and an image restoration network;

[0012] The edge completion network processes the damaged image to be repaired, completes the missing edges of the damaged image to be repaired, and outputs a repaired single-channel edge image;

[0013] The image restoration network takes the restored edge structure map and the RGB map of the damaged image to be restored as input, combines the YUV encoded image of the damaged image to be restored for sampling, and outputs the restored RGB image;

[0014] The edge completion network and the image restoration network are both based on an encoder-decoder architecture, with stacked TMC feature interaction blocks inserted between the encoder and the decoder. A CNN residual network and a Swin attention structure are used in the TMC feature interaction blocks to extract and fuse global and local information in the image.

[0015] Preferably, the damaged image to be repaired includes a damaged RGB image, a damaged edge map, a damaged grayscale map and a mask map, wherein the damaged area of ​​the damaged RGB image is marked, and the marked damaged RGB image is subjected to image masking to obtain the mask map; the marked damaged RGB image is processed with an edge detection algorithm to obtain the damaged edge map; and the marked damaged RGB image is processed with a grayscale algorithm to obtain the damaged grayscale map.

[0016] Preferably, the construction process of the pre-constructed edge-guided image restoration model is as follows:

[0017] Acquire a data set, and train and optimize the initial edge-guided image restoration model using the data set to obtain a trained edge-guided image restoration model;

[0018] Among them, the expression of the loss function in the training optimization process is as follows:

[0019] L=λ rec L rec +λ adv L adv +λ sty L sty +λ per L per

[0020] L rec =||II comp ||

[0021]

[0022]

[0023] L sty =E i [||Φ i (I) T Φ i (I)-Φ i (I comp ) T Φ i (I comp)||1]

[0024] Among them, L rec represents the reconstruction loss, L adv represents the adversarial loss, L per represents the perceptual loss, L sty represents the style loss; λ rec , adv , sty , per represents the weight coefficient; I is the original image, i.e., the RGB image of the damaged image in the dataset, I comp is the restored RGB image after output; D() is the discriminator, G() is the image restoration network, I b-r and I b-y They represent the RGB image and YUV image of the damaged image to be repaired respectively; E is the symbol of the expected formula, I~pdata means that I follows the pdata distribution; Φ i (I) refers to inputting I into the trained VGG network and taking the activation map obtained from the i-th layer; N i is Φ i (I) The number of pixels in .

[0025] Preferably, the edge completion network includes an edge encoder, a first TMC feature interaction block and an edge decoder, wherein the edge encoder includes n feature interaction modules, n dilated convolutional layers and n+1 standard convolutional layers, and n is a positive integer greater than 1; the image joint features pass through the first standard convolutional layer and the first dilated convolutional layer respectively, and the first local feature output by the first standard convolutional layer and the first non-local feature output by the first dilated convolutional layer are input into the first feature interaction module to output the first interactive feature; at the same time, the first non-local feature passes through the second dilated convolutional layer to output the second non-local feature; the first interactive feature is input into the second standard convolutional network to output the second local feature; the second local feature and the second non-local feature output the second interactive feature; and so on, the nth interactive feature output at last passes through a standard convolutional layer to output the coding feature; the image joint feature is the image feature obtained by combining the features of the damaged image to be repaired through a merging channel.

[0026] Preferably, the feature interaction module includes a merging channel, a convolutional layer, a residual connection and a batch normalization layer; the input local features and non-local features are jointly operated through the merging channel, and then feature transformed by the convolutional layer, and after combining with the residual connection, normalized by the batch normalization layer.

[0027] Preferably, the image restoration network includes an image encoder, a second TMC feature interaction block and an image decoder, wherein the image encoder includes two branches, wherein the first branch includes M standard convolutional layers and M+1 merging channels; and the second branch includes one merging channel, M dilated convolutional layers, M standard convolutional layers and M feature refinement interaction blocks;

[0028] In the first branch, the method is to arrange the layers in the form of merged channel, standard convolution layer, and merged channel. The damaged RGB image, the single-channel edge image, and the damaged grayscale image are jointly operated through a merged channel and then input into the first branch.

[0029] The damaged YUV image and the mask image are jointly operated through the M+2th merging channel and then passed through M dilated convolutional layers and M standard convolutional layers respectively. The output of the mth, m=1,2,…,M dilated convolutional layers and the output of the mth standard convolutional layer pass through the mth feature refinement interaction block and output the mth refined feature.

[0030] The mth refined feature is merged with the RGB encoding feature through a joint operation of the mth merging channel in the first branch, and the M+1th merging channel in the first branch outputs the image encoding feature.

[0031] Preferably, the feature refinement interaction block includes three branches, each branch includes a convolution layer, a normalization layer and an activation layer, wherein the first branch inputs RGB encoding features and the third branch inputs YUV encoding features; the second branch of the feature refinement interaction block also includes a merging channel, and the RGB encoding features and the YUV encoding features are jointly operated through the merging channel to output the joint features. After the joint features pass through the convolution layer, the normalization layer and the activation layer, they are element-wise multiplied with the features output by the first branch, and the output fused features are connected with the output of the third branch through a residual connection to output the refined features.

[0032] In a second aspect, the present invention provides an image restoration system integrating global information and multi-color space edge guidance, comprising:

[0033] An image acquisition module, used to acquire a damaged image to be repaired;

[0034] An image processing module is used to process the damaged image to be repaired based on a pre-built edge-guided image repair model to obtain a repaired RGB image;

[0035] Among them, the edge-guided image restoration model includes an edge completion network and an image restoration network;

[0036] The edge completion network processes the damaged image to be repaired, completes the missing edges of the damaged image to be repaired, and outputs a repaired single-channel edge image;

[0037] The image restoration network takes the restored edge structure map and the RGB map of the damaged image to be restored as input, combines the YUV encoded image of the damaged image to be restored for sampling, and outputs the restored RGB image;

[0038] The edge completion network and the image restoration network are both based on an encoder-decoder architecture, with stacked TMC feature interaction blocks inserted between the encoder and the decoder. A CNN residual network and a Swin attention structure are used in the TMC feature interaction blocks to extract and fuse global and local information in the image.

[0039] In a third aspect, the present invention provides a computer-readable storage medium storing a computer program for a method for fusing global information and edge-guided image restoration in a multi-color space, wherein the computer program enables a computer to execute the method for fusing global information and edge-guided image restoration in a multi-color space as described above.

[0040] In a fourth aspect, the present invention provides an electronic device, characterized in that it includes:

[0041] One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the programs include methods for executing the global information fusion and multi-color space edge-guided image restoration method as described above.

[0042] (III) Beneficial effects

[0043] The present invention provides an edge-guided image restoration method that integrates global information and multi-color space. Compared with the prior art, it has the following beneficial effects:

[0044] The present invention obtains a damaged image to be repaired; processes the damaged image to be repaired based on a pre-built edge-guided image repair model to obtain a repaired RGB image; wherein the edge-guided image repair model includes an edge completion network and an image repair network; the edge completion network processes the damaged image to be repaired, completes the missing edges of the damaged image to be repaired, and outputs a repaired single-channel edge image; the image repair network takes the repaired edge structure map and the RGB map of the damaged image to be repaired as input, samples in combination with the YUV encoded image of the damaged image to be repaired, and outputs the repaired RGB image; the edge completion network and the image repair network are both based on an encoder-decoder architecture, a stacked TMC feature interaction block is inserted between the encoder and the decoder, and a CNN residual network and a SwinTransformer structure are used in the TMC feature interaction block to extract and fuse the global information and local information in the image. The present invention uses an edge-guided image repair model to fuse global-local information and YUV images, can clearly and completely restore the basic structure of the damaged image, and can also maintain a high degree of unity with the overall image in terms of color. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 It is a schematic diagram of the structure of the edge-guided image restoration model;

[0047] Figure 2 is a schematic diagram of an edge encoder;

[0048] Figure 3 It is a structural diagram of the feature interaction module;

[0049] Figure 4 It is a schematic diagram of the structure of the TMC feature interaction block;

[0050] Figure 5 It is a structural diagram of an image encoder;

[0051] Figure 6 It is a schematic diagram of the structure of the feature refinement interaction block;

[0052] Figure 7 Schematic diagram for qualitative comparison of experimental results for comparison and verification. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] The embodiment of the present application provides an edge-guided image restoration method that integrates global information and multi-color spaces, thereby solving the technical problem that the existing methods lack joint constraint guidance of the restoration process based on prior information, resulting in image restoration results that are prone to structural disorder and texture blur, and achieves clear and complete restoration of the basic structure of the damaged image.

[0055] The technical solution in the embodiment of the present application is to solve the above technical problems, and the overall idea is as follows:

[0056] Image restoration methods are mainly divided into: ① traditional image restoration methods and ② deep learning image restoration methods. Among them, traditional image restoration methods mainly use methods such as pixel diffusion, sample matching and sparse representation to complete restoration, but traditional image restoration methods are mainly aimed at the restoration of a small range of damaged areas, and cannot make full use of the contextual high-level semantic information of the image, and cannot complete the restoration of large areas of damaged areas. When the existing deep learning image restoration methods are used to restore images (such as murals) that are very different from natural images in color, structure, style, etc., due to the lack of joint constraint guidance of the restoration process by prior information such as structure and texture, the image restoration results are prone to problems such as structural disorder and texture blur. To solve the above problems, an embodiment of the present invention proposes an edge-guided image restoration method that integrates global information and multi-color space. The method uses an edge-guided image restoration model to integrate global-local information and multi-color space, and can clearly and completely restore the basic structure of the damaged image, and can also maintain a high degree of unity with the overall image in terms of color.

[0057] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0058] An embodiment of the present invention provides an edge-guided image restoration method that integrates global information and multiple color spaces, the method comprising:

[0059] S1, obtaining a damaged image to be repaired;

[0060] S2, processing the damaged image to be repaired based on the pre-built edge-guided image repair model to obtain a repaired RGB image;

[0061] Among them, the edge-guided image restoration model includes an edge completion network and an image restoration network;

[0062] The edge completion network processes the damaged image to be repaired, completes the missing edges of the damaged image to be repaired, and outputs a repaired single-channel edge image;

[0063] Edge-guided image inpainting models such as Figure 1 As shown, the image restoration network takes the restored edge structure map and the RGB map of the damaged image to be restored as input, combines the YUV encoded image of the damaged image to be restored for sampling, and outputs the restored RGB image;

[0064] The edge completion network and the image restoration network are both based on an encoder-decoder architecture, with stacked TMC feature interaction blocks inserted between the encoder and the decoder. The CNN residual network and SwinTransformer structure are used in the TMC feature interaction blocks to extract and fuse global and local information in the image.

[0065] The embodiment of the present invention uses an edge-guided image restoration model to fuse global-local information and YUV images, so as to clearly and completely restore the basic structure of a damaged image and maintain a high degree of unity with the overall image in terms of color.

[0066] In one embodiment, S1, obtaining a damaged image to be repaired, including:

[0067] The damaged image to be repaired includes the original image of the damaged image to be repaired (i.e., RGB image), the damaged edge image, the damaged grayscale image, and the mask image. The damaged area of ​​the original image of the damaged image is manually marked to obtain a mask image, where the pixels of the damaged area are 255 and the pixels of the non-damaged area are 0. The marked damaged RGB image is processed with the Canny edge detection algorithm to obtain the damaged edge image. The marked damaged RGB image is processed with the grayscale algorithm to obtain the damaged grayscale image.

[0068] In one embodiment, S2, based on a pre-built edge-guided image restoration model, the damaged image to be restored is processed to obtain a restored RGB image. This includes:

[0069] The construction process of the pre-built edge-guided image inpainting model is as follows:

[0070] A data set is obtained, and an initial edge-guided image restoration model is trained and optimized using the data set to obtain a trained edge-guided image restoration model.

[0071] The expression of the loss function in the training optimization process is as follows:

[0072] L=λ rec Lrec +λ adv L adv +λ sty L sty +λ per L per

[0073] Among them, L rec represents the reconstruction loss, L adv represents the adversarial loss, L per represents the perceptual loss, L sty represents the style loss. rec , adv , sty , per Represents the weight coefficient.

[0074] Among them, the reconstruction loss L rec It is used to constrain the pixel-level reconstruction accuracy and is defined using the L1 norm. rec =||II comp ||. I is the original image, that is, the RGB image of the damaged image in the dataset, I comp is the output inpainted RGB image.

[0075] L adv The adversarial training used to constrain the generator and discriminator is expressed as:

[0076]

[0077] Where D() is the patch GAN discriminator, G() is the generator, i.e., the image restoration network in the second stage (the GRB image output by the image restoration network and the original image are input into the discriminator for adversarial training to optimize the parameters of the image restoration network), I is the original image, i.e., the intact original image without mask in the training data, I b-r and I b-y They represent the RGB image and YUV image of the damaged image to be repaired respectively. E is the symbol of the expected formula, and I~pdata means that I follows the pdata distribution.

[0078] The perceptual loss aims to minimize the L1 distance between the activation maps of the inpainted image and the real image, which can be formulated as:

[0079]

[0080] Among them, Φ i (I) refers to inputting I into the trained VGG19 network and taking the activation map obtained from the i-th layer, N i is Φ iSimilarly, the style loss is defined as the L1 distance between the Gram matrices of the deep features of the restored image and the true image:

[0081] L sty =E i [||Φ i (I) T Φ i (I)-Φ i (I comp ) T Φ i (I comp )||1]

[0082] In one embodiment, the specific structure of the edge-guided image restoration model is as follows: Figure 1 As shown, it includes an edge completion network and an image restoration network, wherein the edge completion network includes an edge encoder, a TMC feature interaction block and an edge decoder.

[0083] The data set includes the original images of multiple damaged images (i.e., damaged RGB images) and the corresponding damaged edge images, damaged grayscale images, and mask images. The input damaged image to be repaired is subjected to a concat operation to perform feature union to obtain an image joint feature, which is then encoded by an edge encoder to obtain rich multi-scale features. The local features and multi-scale global features in the encoded features are further fused by stacking the TMC feature interaction block, and the fused features are output. The fused features are passed through an edge decoder to output a single-channel edge image that completes the missing edges. In an embodiment of the present invention, the edge encoder is a multi-scale encoder.

[0084] Among them, the edge encoder is as follows Figure 2 As shown, it includes several standard convolutional layers, feature interaction modules and dilated convolutional layers. The input image joint features pass through the first standard convolutional layer and the first dilated convolutional layer respectively, and the first local feature output by the first standard convolutional layer and the first non-local feature output by the first dilated convolutional layer are input into the first feature interaction module to output the first interactive feature; at the same time, the first non-local feature passes through the second dilated convolutional layer to output the second non-local feature; the first interactive feature is input into the second standard convolutional network to output the second local feature; the second local feature and the second non-local feature output the second interactive feature; and so on, the nth interactive feature output finally passes through a standard convolutional layer to output the coding feature. That is, the edge encoder includes n feature interaction modules, n dilated convolutional layers and n+1 standard convolutional layers. In the embodiment of the present invention, n=3.

[0085] Feature interaction modules such as Figure 3As shown in the figure, it includes merging channels, convolutional layers, residual connections (Sum Operator) and batch normalization layers. The input multi-scale features (i.e. local features and non-local features) are concat-operated through merging channels and then transformed by 1*1 convolution. After the residual connection, they are normalized by the Batch Norm layer. The 1*1 convolutional layer and residual connection design can fully integrate the input multi-scale features. BatchNorm ensures the stability of the output feature distribution and is used to stabilize the training process.

[0086] The structure of the TMC feature interaction block is as follows Figure 4 As shown in the figure, this module takes advantage of the CNN and attention mechanism by combining the CNN residual network with the Swin-Transformer block, and can effectively realize the extraction and fusion of global and local features. The TMC feature interaction block contains two sub-modules with similar structures. Each module contains a SwinTransformer block (i.e., (shifted) window-based multi-head self-attention ((S)W-MSA)) and a parallel multi-scale depth-wise separable convolution channel (MSDSCC). Specifically, MSDSCC includes two sets of stacked depth-wise separable convolutional layers with different kernel sizes, and each set of convolutional layers is followed by a 1×1 convolutional layer (conv 1×1) and batch normalization (BatchNorm). Residual connections are also used in the convolutional channel. Among them, Figure 4 The ⊕ in represents the residual connection, Concatenate means merging channels, and Linear means linear regression.

[0087] The image restoration network is also based on the encoder-decoder architecture, and the restored single-channel edge image output by the upper edge completion network is used as a structural guide. Compared with natural images, the colors of murals are more diverse and more evenly distributed. In order to make full use of the color information in the murals to be restored, a YUV color space sampling branch is designed in the encoder. It can extract rich color and texture information from the damaged image in YUV format, and fuse it with the features of the RGB sampling branch through the designed feature fusion interaction module to obtain richer structural and texture features. The specific structure of the image restoration network is as follows: Figure 1 As shown, it includes an image encoder, a TMC feature interaction block and an image decoder.

[0088] The structure of the image encoder is as follows Figure 5As shown, it includes two branches, one branch takes the damaged RGB image, the single-channel edge image and the damaged grayscale image through a merge channel as input, and the other branch takes the damaged YUV image and the mask image through a merge channel as input. The image encoder includes two branches, in the first branch, it includes M standard convolutional layers and M+1 merged channels; in the second branch, it includes a merged channel, M dilated convolutional layers, M standard convolutional layers and M feature refinement interaction blocks. In the embodiment of the present invention, M=3.

[0089] For example, in the first branch, it includes the first merged channel, the first standard convolution layer, the second merged channel, the second standard convolution layer, the third merged channel, the second standard convolution layer, the fourth merged channel, and so on.

[0090] In the second branch, the damaged YUV image and the mask image are concat-operated through the M+2th merge channel and then passed through M dilated convolutional layers and M standard convolutional layers respectively. The output of the mth (m=1, 2,…, M)th dilated convolutional layer and the output of the mth standard convolutional layer pass through the mth feature refinement interaction block to output the mth refined feature.

[0091] The mth refined feature is merged with the RGB encoding feature through the mth merging channel in the first branch through the concat operation, and so on to output the image encoding feature.

[0092] Feature refinement interaction blocks such as Figure 6 As shown, it includes three branches, each of which includes a convolution layer, a normalization layer, and an activation layer. The first branch inputs RGB encoded features, and the third branch inputs YUV encoded features. The second branch of the feature refinement interaction block also includes a concat operation. The RGB encoded features and the YUV encoded features are concat to output joint features. After the joint features pass through the convolution layer, the normalization layer, and the activation layer, they are element-wise multiplied with the features output by the first branch. The output fusion features and the output of the third branch are connected through a residual (Sum Operator) to output the refined features. Figure 6 The ⊕ in represents the residual connection, Concatenate means merging channels, and means element-wise multiplication. Conv means convolution layer, Norm means normalization layer, and LRelu means activation layer.

[0093] The multi-color space encoding features output by the image encoder are fed into the TMC feature interaction block for further feature fusion. Finally, the image decoder consisting of two transposed convolutional layers and one standard convolutional layer maps the features from the last TMC feature interaction block into a complete image.

[0094] It should be noted that in the edge completion network and image restoration network, multiple stacked TMC feature interaction blocks are included.

[0095] The effectiveness of the embodiments of the present invention is verified by comparison below:

[0096] The proposed method is evaluated and compared with the state-of-the-art methods on the established Mural dataset and the public face image restoration dataset CelebAHQ. The mural dataset for this verification process contains 8673 512×512 mural images. The mask image is a public mask dataset containing 12,000 irregular mask images. In addition, the mask images are also grouped into six intervals according to the mask area (i.e., 0-10%, 10%-20%, 20%-30%, 30%-40%, 40%-50%, and 50%-60%). The qualitative comparison of the experimental results is as follows Figure 7 As shown, Figure 7 Masked in the example refers to a damaged RGB image with a mask added. The eepFillV2 in the comparative verification experiment refers to the use of partial convolution in the model, which constructs a three-stage restoration model from coarse to fine, and gradually generates a complete restoration image. This method generally has good restoration results in natural image restoration. RFR is a feature space progressive restoration method based on recursive feature reasoning and knowledge consistency attention. This method generally has good restoration results for large-scale damaged areas. AOT GAN is a high-resolution image restoration model constructed using a stacked aggregated context transform block structure, and a new mask prediction loss is designed. LaMa is based on the fast Fourier convolution structure, which enables the model to obtain a global receptive field, and adopts a high receptive field perceptual loss and a large mask training model. FCF is a Fourier Coarse-to-Fine (FcF) restoration framework that combines the receptive ability of fast Fourier convolution to capture global repeated textures and uses a coarse-to-fine generator modulated together to generate realistic image structures. Realistic restoration results have been achieved in natural image restoration and face restoration. Ours is a method of an embodiment of the present invention. It can be seen that the mural image repaired by the method of the embodiment of the present invention is superior to the comparison method in terms of structure and color, can relatively completely restore the basic structure of the damaged image, and also maintains a high degree of color unity with the overall mural, which further verifies the effectiveness of the method of the embodiment of the present invention.

[0097] The quantitative comparison of the experimental results is shown in the following figure: Table 1 and Table 2 show the results of each method on mural image restoration. In the table, ↑ means the larger the better, ↓ means the smaller the better, the best result is shown in bold, and the second best result is underlined. It is obvious that the method of the embodiment of the present invention is significantly better than the comparison method in terms of PSNR, SSIM and LIPIS. For the metric FID, when the damage ratio is less than 40%, the method of the embodiment of the present invention shows superior performance. When the damage ratio exceeds 40%, the results of the embodiment of the present invention are also very competitive.

[0098] Table 1 Results of various methods on the mural dataset

[0099]

[0100] Table 2 Experimental results of various methods on the CelebA-HO dataset

[0101]

[0102] An embodiment of the present invention provides a system for image restoration that integrates global information and multi-color space edge guidance, the method comprising:

[0103] An image acquisition module, used to acquire a damaged image to be repaired;

[0104] An image processing module is used to process the damaged image to be repaired based on a pre-built edge-guided image repair model to obtain a repaired RGB image;

[0105] Among them, the edge-guided image restoration model includes an edge completion network and an image restoration network;

[0106] The edge completion network processes the damaged image to be repaired, completes the missing edges of the damaged image to be repaired, and outputs a repaired single-channel edge image;

[0107] The image restoration network takes the restored edge structure map and the RGB map of the damaged image to be restored as input, combines the YUV encoded image of the damaged image to be restored for sampling, and outputs the restored RGB image;

[0108] The edge completion network and the image restoration network are both based on an encoder-decoder architecture, with stacked TMC feature interaction blocks inserted between the encoder and the decoder. The CNN residual network and SwinTransformer structure are used in the TMC feature interaction blocks to extract and fuse global and local information in the image.

[0109] It can be understood that the global information fusion and multi-color space edge-guided image restoration system provided in an embodiment of the present invention corresponds to the above-mentioned edge-guided image restoration method that fuses global information and multi-color spaces. The explanations, examples, beneficial effects and other parts of the relevant contents can refer to the corresponding contents in the edge-guided image restoration method that fuses global information and multi-color spaces, and will not be repeated here.

[0110] An embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program for fusing global information and edge-guided image restoration in multiple color spaces, wherein the computer program enables a computer to execute the method for fusing global information and edge-guided image restoration in multiple color spaces as described above.

[0111] An embodiment of the present invention further provides an electronic device, including:

[0112] one or more processors;

[0113] Memory; and

[0114] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs including instructions for executing the edge-guided image restoration method for fusing global information and multiple color spaces as described above.

[0115] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0116] The embodiment of the present invention uses an edge-guided image restoration model to fuse global-local information and multi-color space image information (YUV image), so as to clearly and completely restore the basic structure of the damaged image and maintain a high degree of color uniformity with the overall image.

[0117] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0118] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An edge-guided image restoration method integrating global information and multi-color space, characterized in that: include: Obtaining a damaged image to be repaired; The damaged image to be repaired is processed based on the pre-built edge-guided image repair model to obtain a repaired RGB image; Among them, the edge-guided image restoration model includes an edge completion network and an image restoration network; The edge completion network processes the damaged image to be repaired, completes the missing edges of the damaged image to be repaired, and outputs a repaired single-channel edge image; The image restoration network takes the restored edge structure map and the RGB map of the damaged image to be restored as input, combines the YUV encoded image of the damaged image to be restored for sampling, and outputs the restored RGB image; The edge completion network and the image restoration network are both based on an encoder-decoder architecture, with a stacked TMC feature interaction block inserted between the encoder and the decoder. The CNN residual network and the Swin attention structure are used in the TMC feature interaction block to extract and fuse the global information and local information in the image. The edge completion network includes an edge encoder, a first TMC feature interaction block and an edge decoder, wherein the edge encoder includes n feature interaction modules, n dilated convolution layers and n+1 standard convolution layers, where n is a positive integer greater than 1; the image joint feature passes through the first standard convolution layer and the first dilated convolution layer respectively, and the first local feature output by the first standard convolution layer and the first non-local feature output by the first dilated convolution layer are input into the first feature interaction module to output the first interactive feature; at the same time, the first non-local feature passes through the second dilated convolution layer to output the second non-local feature; the first interactive feature is input into the second standard convolution network to output the second local feature; the second local feature and the second non-local feature output the second interactive feature; and so on, the nth interactive feature outputted at last passes through a standard convolution layer to output the coding feature; the image joint feature is the image feature obtained by combining the features of the damaged image to be repaired through a merged channel; The feature interaction module includes a merging channel, a convolution layer, a residual connection and a batch normalization layer; the input local features and non-local features are jointly operated through the merging channel, and then the convolution layer performs feature transformation, and after combining the residual connection, the batch normalization layer performs normalization processing; The image restoration network includes an image encoder, a second TMC feature interaction block and an image decoder, wherein the image encoder includes two branches, wherein the first branch includes M standard convolutional layers and M+1 merging channels; and the second branch includes one merging channel, M dilated convolutional layers, M standard convolutional layers and M feature refinement interaction blocks; In the first branch, the method is to arrange the layers in the form of merged channel, standard convolution layer, and merged channel. The damaged RGB image, the single-channel edge image, and the damaged grayscale image are jointly operated through a merged channel and then input into the first branch. The damaged YUV image and the mask image are jointly operated through the M+2th merging channel and then passed through M dilated convolutional layers and M standard convolutional layers respectively. The output of the mth, m=1,2,…,M dilated convolutional layers and the output of the mth standard convolutional layer pass through the mth feature refinement interaction block and output the mth refined feature. The mth refined feature and the RGB encoding feature are merged through a joint operation of the mth merging channel in the first branch, and the M+1th merging channel in the first branch outputs the image encoding feature; The feature refinement interaction block includes three branches, each of which includes a convolution layer, a normalization layer and an activation layer, wherein the first branch inputs RGB encoding features, and the third branch inputs YUV encoding features; the second branch of the feature refinement interaction block also includes a merging channel, and the RGB encoding features and the YUV encoding features are jointly operated through the merging channel to output the joint features. After the joint features pass through the convolution layer, the normalization layer and the activation layer, they are element-wise multiplied with the features output by the first branch, and the output fusion features are connected with the output of the third branch through a residual connection to output the refined features.

2. The edge-guided image restoration method of fusing global information and multi-color space as claimed in claim 1, characterized in that: The damaged image to be repaired includes a damaged RGB image, a damaged edge map, a damaged grayscale map and a mask map, wherein the damaged area of ​​the damaged RGB image is marked, and the marked damaged RGB image is subjected to image masking to obtain the mask map; the marked damaged RGB image is processed by an edge detection algorithm to obtain the damaged edge map; and the marked damaged RGB image is processed by a grayscale algorithm to obtain the damaged grayscale map.

3. The edge-guided image restoration method of fusing global information and multi-color space as claimed in claim 1, characterized in that: The construction process of the pre-built edge-guided image restoration model is as follows: Acquire a data set, and train and optimize the initial edge-guided image restoration model using the data set to obtain a trained edge-guided image restoration model; Among them, the expression of the loss function in the training optimization process is as follows: L=λ rec L rec +λ adv L adv +λ sty L sty +λ per L per L rec =||I-I comp || L sty =E i [||Φ i (I) T F i (I)-F i (I comp ) T F i (I comp )||1] Among them, L rec represents the reconstruction loss, L adv represents the adversarial loss, L per represents the perceptual loss, L sty represents the style loss; λ rec , adv , sty , per represents the weight coefficient; I is the original image, i.e., the RGB image of the damaged image in the dataset, I comp is the restored RGB image after output; D() is the discriminator, G() is the image restoration network, I b-r and I b-y They represent the RGB image and YUV image of the damaged image to be repaired respectively; E is the symbol of the expected formula, I~pdata means that I follows the pdata distribution; Φ i (I) refers to inputting I into the trained VGG network and taking the activation map obtained from the i-th layer; N i Yes i (I) The number of pixels in .

4. A system for image restoration that integrates global information and multi-color space edge guidance, characterized in that: include: An image acquisition module, used to acquire a damaged image to be repaired; An image processing module is used to process the damaged image to be repaired based on a pre-built edge-guided image repair model to obtain a repaired RGB image; Among them, the edge-guided image restoration model includes an edge completion network and an image restoration network; The edge completion network processes the damaged image to be repaired, completes the missing edges of the damaged image to be repaired, and outputs a repaired single-channel edge image; The image restoration network takes the restored edge structure map and the RGB map of the damaged image to be restored as input, combines the YUV encoded image of the damaged image to be restored for sampling, and outputs the restored RGB image; The edge completion network and the image restoration network are both based on an encoder-decoder architecture, with a stacked TMC feature interaction block inserted between the encoder and the decoder. The CNN residual network and the Swin attention structure are used in the TMC feature interaction block to extract and fuse the global information and local information in the image. The edge completion network includes an edge encoder, a first TMC feature interaction block and an edge decoder, wherein the edge encoder includes n feature interaction modules, n dilated convolution layers and n+1 standard convolution layers, where n is a positive integer greater than 1; the image joint feature passes through the first standard convolution layer and the first dilated convolution layer respectively, and the first local feature output by the first standard convolution layer and the first non-local feature output by the first dilated convolution layer are input into the first feature interaction module to output the first interactive feature; at the same time, the first non-local feature passes through the second dilated convolution layer to output the second non-local feature; the first interactive feature is input into the second standard convolution network to output the second local feature; the second local feature and the second non-local feature output the second interactive feature; and so on, the nth interactive feature outputted at last passes through a standard convolution layer to output the coding feature; the image joint feature is the image feature obtained by combining the features of the damaged image to be repaired through a merged channel; The feature interaction module includes a merging channel, a convolution layer, a residual connection and a batch normalization layer; the input local features and non-local features are jointly operated through the merging channel, and then the convolution layer performs feature transformation, and after combining the residual connection, the batch normalization layer performs normalization processing; The image restoration network includes an image encoder, a second TMC feature interaction block and an image decoder, wherein the image encoder includes two branches, wherein the first branch includes M standard convolutional layers and M+1 merging channels; and the second branch includes one merging channel, M dilated convolutional layers, M standard convolutional layers and M feature refinement interaction blocks; In the first branch, the method is to arrange the layers in the form of merged channel, standard convolution layer, and merged channel. The damaged RGB image, the single-channel edge image, and the damaged grayscale image are jointly operated through a merged channel and then input into the first branch. The damaged YUV image and the mask image are jointly operated through the M+2th merging channel and then passed through M dilated convolutional layers and M standard convolutional layers respectively. The output of the mth, m=1,2,…,M dilated convolutional layers and the output of the mth standard convolutional layer pass through the mth feature refinement interaction block and output the mth refined feature. The mth refined feature and the RGB encoding feature are merged through a joint operation of the mth merging channel in the first branch, and the M+1th merging channel in the first branch outputs the image encoding feature; The feature refinement interaction block includes three branches, each of which includes a convolution layer, a normalization layer and an activation layer, wherein the first branch inputs RGB encoding features, and the third branch inputs YUV encoding features; the second branch of the feature refinement interaction block also includes a merging channel, and the RGB encoding features and the YUV encoding features are jointly operated through the merging channel to output the joint features. After the joint features pass through the convolution layer, the normalization layer and the activation layer, they are element-wise multiplied with the features output by the first branch, and the output fusion features are connected with the output of the third branch through a residual connection to output the refined features.

5. A computer-readable storage medium, characterized in that: It stores a computer program for fusing global information and multi-color space edge-guided image restoration method, wherein the computer program enables a computer to execute the global information fusing and multi-color space edge-guided image restoration method as claimed in any one of claims 1 to 3.

6. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the programs include a method for executing the global information fusion and multi-color space edge-guided image restoration method as described in any one of claims 1 to 3.