Ancient painting restoration method based on edge guidance and multi-scale residual blocks
The ancient painting restoration method based on edge guidance and multi-scale residual blocks solves the problems of insufficient feature extraction and loss of edge structure in existing technologies, achieving high-quality results in ancient painting restoration and is suitable for the restoration of large-area ancient paintings.
Patent Information
- Application Number
- CN202311438017.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-10-31
AI Technical Summary
Existing digital restoration methods for ancient paintings suffer from insufficient feature extraction and loss of edge structure. Deep learning-based methods struggle to generate natural and realistic restoration results in complex scenarios.
An ancient painting restoration method based on edge guidance and multi-scale residual blocks is adopted. By constructing an ancient painting restoration network, the edge map of the ancient painting is used to guide the generation of a complete ancient painting. The semantic features of different scales are learned through multi-scale residual blocks, and the polarization self-attention mechanism module is combined to improve the attention to important structures and details.
It effectively restores the texture and edges of ancient paintings, reconstructs clear lines and rich details, making the restored ancient paintings more realistic and natural, and is suitable for large-area restoration of ancient paintings.
Smart Images

Figure CN117392019B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer application technology, specifically relating to image restoration. Background Technology
[0002] Chinese ancient paintings, as a precious cultural heritage of our country, possess extremely high cultural and artistic value. With the passage of time and other external factors, many ancient paintings have suffered extensive damage and fading. Traditional manual restoration methods are easily limited by manpower and technology, making it difficult to meet the needs of large-scale restoration, and the use of physical and chemical methods may damage the original painting. In recent years, digital restoration technology has been widely applied. Utilizing computer technology and image processing methods, digital restoration can more accurately restore the original appearance of ancient paintings, while shortening restoration time and reducing the risk of further damage. Therefore, the introduction of digital restoration technology has significant research value for the field of ancient painting restoration.
[0003] Digital inpainting primarily relies on the correlation between known and damaged areas, using known pixel information to reconstruct missing pixels and thus restore the true content of the missing area. Based on different inpainting methods, digital inpainting can be broadly categorized into traditional methods and deep learning methods. Traditional methods can be further divided into diffusion-based methods and example-based methods. Diffusion-based methods mainly utilize partial differential equations to gradually diffuse pixels to the missing area. However, this method suffers from error propagation problems, resulting in an overly smooth inpainted area, making it unsuitable for large-area inpainting. Example-based methods solve the oversmoothing problem of diffusion-based methods, but their retrieval speed and matching efficiency are lower, and the confidence level decreases as the inpainting process progresses.
[0004] In recent years, deep learning methods have made significant progress and have become one of the cutting-edge technologies in digital restoration. These methods utilize deep learning models such as convolutional neural networks (CNNs) and generative adversarial networks (GANs) to learn the features and semantic information of ancient paintings, enabling them to produce natural and realistic restoration results even in complex scenes. However, ancient paintings usually contain rich line and structural information, and deep learning-based methods often suffer from drawbacks such as insufficient feature extraction and loss of edge structures when restoring ancient paintings. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide a method for the restoration of ancient paintings based on edge guidance and multi-scale residual blocks.
[0006] The technical solution adopted to solve the above-mentioned technical problems consists of the following steps.
[0007] (1) Establish a dataset for ancient painting restoration
[0008] The ancient painting restoration dataset was constructed by using the following sample data sources obtained from museum websites: "A Panorama of Rivers and Mountains", "Spring Morning in the Han Palace", "Dwelling in the Fuchun Mountains", and "Along the River During the Qingming Festival". These samples were cropped into ancient painting samples with a height (H) and width (W) of 256×256 pixels. The ancient painting restoration dataset was then divided into training set, validation set, and test set in a ratio of 7:2:1.
[0009] (2) Constructing an ancient painting restoration network
[0010] The ancient painting restoration network consists of an ancient painting completion network, a color correction network, and a Markov discriminator connected in series.
[0011] The ancient painting completion network consists of a downsampling module, a polarization self-attention mechanism module, a multi-scale residual block group, and an upsampling module connected in series.
[0012] The color correction network is composed of a downsampling module, a polarization self-attention mechanism module, a normal residual block group, and an upsampling module connected in series; the normal residual block group is composed of 4 normal residual blocks connected in series.
[0013] (3) Training ancient painting restoration network
[0014] 1) Determine the overall loss function of the model
[0015] Overall model loss function L Total Including the perceptual loss function L Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV .
[0016] Determine the perceptual loss function L using the following formula Perceptual :
[0017]
[0018] Where y represents the original ancient painting, x represents the restoration result, and F i (x) and F i (y) represents the output features of the VGG19 network, and N is the number of feature layers.
[0019] The L1 loss function L1 is determined by the following formula:
[0020]
[0021] Where, f(x) k ) and y k Let n represent the restoration result of the k-th sample and the corresponding complete ancient painting, respectively, where n is the number of samples and takes the value of a finite positive integer.
[0022] The histogram loss function L is determined by the following formula. Histogram :
[0023]
[0024] Among them, w l These are the weight parameters of the l-th layer, O l R represents the activation layer, R represents histogram matching, and R(O) represents the activation layer. l ) represents the activation layer after histogram matching, L is the total number of layers, and ||·|| F This represents the Frobenius norm.
[0025] The total variational loss function L is determined by the following formula. TV :
[0026]
[0027] Where i and j represent pixel position coordinates, x i,j This represents a pixel in the input image, where s and t are the image width and height, respectively.
[0028] The overall loss function L is determined by the following formula. Total :
[0029] L Total =λ1L Perceptual +λ2L1+λ3L Histogram +λ4L TV
[0030] Where λ1∈(0,1], λ2∈(0,1], λ3∈(0,1], and λ4∈(0,1] are the perceptual loss functions L, respectively. Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV The weight.
[0031] 2) Training network for ancient painting restoration
[0032] The ancient painting restoration training set was input into the ancient painting restoration network for training. The learning rates of the discriminator and generator were set to 0.0001 and 0.00001, respectively, with a batch size of 8. The Adam optimizer was used to optimize the parameters of the generator and discriminator, and the model was trained until the overall loss function L was obtained. Total convergence.
[0033] (4) Save the model
[0034] During the training of the ancient painting restoration network, a weight file is saved every 200 iterations.
[0035] (5) Verify the ancient painting restoration network
[0036] The validation set is input into the trained ancient painting restoration network for validation.
[0037] (6) Testing the ancient painting restoration network
[0038] The test set is input into the trained ancient painting restoration network for testing. The weight file is loaded to obtain the restored ancient painting.
[0039] In step (2) of this invention, the ancient painting restoration network is constructed by connecting a convolutional layer 1 with a kernel size of 7×7 and a stride of 1, an instance normalization layer 1, a ReLU activation function layer 1, a convolutional layer 2 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 2, a ReLU activation function layer 2, a convolutional layer 3 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 3, a ReLU activation function layer 3, a convolutional layer 4 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 4, and a ReLU activation function layer 4 in series.
[0040] In step (2) of the present invention, the ancient painting restoration network is constructed by connecting a convolutional layer 5 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 5, a ReLU activation function layer 5, a convolutional layer 6 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 6, a ReLU activation function layer 6, a convolutional layer 7 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 7, a ReLU activation function layer 7, a convolutional layer 8 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 8, and a ReLU activation function layer 8 in series.
[0041] In step (2) of this invention, the ancient painting restoration network is constructed, and the multi-scale residual block group is composed of four multi-scale residual blocks connected in series.
[0042] The multi-scale residual block of this invention is constructed by connecting a 5×5 convolutional branch and a 3×3 convolutional branch in parallel, and then sequentially connecting them with a Concat layer, a 1×1 convolutional layer 13, and an SENet module.
[0043] The 5×5 convolution branch of the present invention is composed of a convolutional layer 9 with a kernel size of 5×5 and a stride of 1, a ReLU activation function layer 9, a convolutional layer 10 with a kernel size of 5×5 and a stride of 1, and a ReLU activation function layer 10 connected in series.
[0044] The 3×3 convolution branch of the present invention is composed of a convolutional layer 11 with a kernel size of 3×3 and a stride of 1, a ReLU activation function layer 11, a convolutional layer 12 with a kernel size of 3×3 and a stride of 1, and a ReLU activation function layer 12 connected in series.
[0045] Because this invention uses edge maps of ancient paintings to guide the ancient painting completion network to generate a complete ancient painting, the restored content matches the original edges. It employs multi-scale residual blocks to learn the semantic features of the ancient painting at different scales, effectively restoring the texture and color of damaged areas, resulting in a harmonious and consistent overall restoration. Furthermore, it utilizes a polarized self-attention mechanism module, enhancing the restoration model's focus on important structures, edges, and details, thus restoring clear lines and rich details to the restored area. Compared to existing technologies, this invention offers advantages such as better restoration of ancient painting textures, edges, and colors, making it suitable for the restoration of ancient paintings. Attached Figure Description
[0046] Figure 1 This is a flowchart of Embodiment 1 of the present invention.
[0047] Figure 2 This is a schematic diagram of the network structure for ancient painting restoration.
[0048] Figure 3 This is a schematic diagram of the downsampling module.
[0049] Figure 4 This is a schematic diagram of the upsampling module.
[0050] Figure 5 This is a schematic diagram of the structure of a multi-scale residual block.
[0051] Figure 6 This is a schematic diagram of a Markov discriminator.
[0052] Figure 7 These are before-and-after photos showing the effects of restoring ancient paintings. Detailed Implementation
[0053] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments, but the present invention is not limited to the embodiments described below.
[0054] Example 1
[0055] The ancient painting restoration method based on edge guidance and multi-scale residual blocks implemented in this paper consists of the following steps (see...). Figure 1 ):
[0056] (1) Establish a dataset for ancient painting restoration
[0057] The ancient painting restoration dataset was constructed by using the following sample data sources obtained from museum websites: "A Panorama of Rivers and Mountains", "Spring Morning in the Han Palace", "Dwelling in the Fuchun Mountains", and "Along the River During the Qingming Festival". These samples were cropped into ancient painting samples with a height (H) and width (W) of 256×256 pixels. The ancient painting restoration dataset was then divided into training set, validation set, and test set in a ratio of 7:2:1.
[0058] (2) Constructing an ancient painting restoration network
[0059] Figure 2 A schematic diagram of the network structure for ancient painting restoration is provided. Figure 2 In this embodiment, the ancient painting restoration network is composed of an ancient painting completion network, a color correction network, and a Markov discriminator connected in series.
[0060] The ancient painting completion network in this embodiment is composed of a downsampling module, a polarization self-attention mechanism module, a multi-scale residual block group, and an upsampling module connected in series. The multi-scale residual block group is composed of four multi-scale residual blocks connected in series.
[0061] The color correction network in this embodiment is composed of a downsampling module, a polarization self-attention mechanism module, a normal residual block group, and an upsampling module connected in series; the normal residual block group is composed of 4 normal residual blocks connected in series.
[0062] Figure 3 A schematic diagram of the downsampling module is given. Figure 3 In this embodiment, the downsampling module is composed of a convolutional layer 1 with a kernel size of 7×7 and a stride of 1, an instance normalization layer 1, a ReLU activation function layer 1, a convolutional layer 2 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 2, a ReLU activation function layer 2, a convolutional layer 3 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 3, a ReLU activation function layer 3, a convolutional layer 4 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 4, and a ReLU activation function layer 4, connected in series.
[0063] Figure 4 A schematic diagram of the upsampling module is given. Figure 4 In this embodiment, the upsampling module is composed of a convolutional layer 5 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 5, a ReLU activation function layer 5, a convolutional layer 6 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 6, a ReLU activation function layer 6, a convolutional layer 7 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 7, a ReLU activation function layer 7, a convolutional layer 8 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 8, and a ReLU activation function layer 8, connected in series.
[0064] Figure 5 A schematic diagram of the multi-scale residual block structure is given. Figure 5 In this embodiment, the multi-scale residual block is formed by connecting a 5×5 convolutional branch and a 3×3 convolutional branch in parallel, and then connecting them in series with the Concat layer, the 1×1 convolutional layer 13, and the SENet module.
[0065] In this embodiment, the 5×5 convolutional branch is composed of a convolutional layer 9 with a kernel size of 5×5 and a stride of 1, a ReLU activation function layer 9, a convolutional layer 10 with a kernel size of 5×5 and a stride of 1, and a ReLU activation function layer 10 connected in series.
[0066] In this embodiment, the 3×3 convolutional branch is composed of a convolutional layer 11 with a kernel size of 3×3 and a stride of 1, a ReLU activation function layer 11, a convolutional layer 12 with a kernel size of 3×3 and a stride of 1, and a ReLU activation function layer 12 connected in series.
[0067] Figure 6 A schematic diagram of a Markov discriminator is given. Figure 6 In this embodiment, the Markov discriminator is composed of convolutional layer 14, convolutional layer 15, convolutional layer 16, convolutional layer 17, and sigmoid layer connected in series.
[0068] (3) Training ancient painting restoration network
[0069] 1) Determine the overall loss function of the model
[0070] Overall model loss function L Total Including the perceptual loss function L Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV .
[0071] Determine the perceptual loss function L using the following formula Perceptual :
[0072]
[0073] Where y represents the original ancient painting, x represents the restoration result, and F i (x) and F i (y) represents the output features of the VGG19 network, and N is the number of feature layers.
[0074] The L1 loss function L1 is determined by the following formula:
[0075]
[0076] Where, f(x) k ) and y k Let n represent the restoration result of the k-th sample and the corresponding complete ancient painting, respectively, where n is the number of samples and takes the value of a finite positive integer.
[0077] The histogram loss function L is determined by the following formula. Histogram :
[0078]
[0079] Among them, w l These are the weight parameters of the l-th layer, O l R represents the activation layer, R represents histogram matching, and R(O) represents the activation layer. l ) represents the activation layer after histogram matching, L is the total number of layers, and ||·|| F This represents the Frobenius norm.
[0080] The total variational loss function L is determined by the following formula. TV :
[0081]
[0082] Where i and j represent pixel position coordinates, x i,j This represents a pixel in the input image, where s and t are the image width and height, respectively.
[0083] The overall loss function L is determined by the following formula. Total :
[0084] L Total =λ1L Perceptual +λ2L1+λ3L Histogram +λ4L TV
[0085] Where λ1∈(0,1], λ2∈(0,1], λ3∈(0,1], and λ4∈(0,1] are the perceptual loss functions L, respectively. Perceptual L1 loss function, L1 histogram loss function Historgram Total variational loss function L TV The weights are λ1, λ2, λ3, and λ4, which take values of 1, 0.1, 0.0005, and 0.01, respectively, in this embodiment.
[0086] 2) Training network for ancient painting restoration
[0087] The ancient painting restoration training set was input into the ancient painting restoration network for training. The learning rates of the discriminator and generator were set to 0.0001 and 0.00001, respectively, with a batch size of 8. The Adam optimizer was used to optimize the parameters of the generator and discriminator until the overall model loss function L was obtained. Total convergence.
[0088] (4) Save the model
[0089] During the training of the ancient painting restoration network, a weight file is saved every 200 iterations.
[0090] (5) Verify the ancient painting restoration network
[0091] The validation set is input into the trained ancient painting restoration network for validation.
[0092] (6) Testing the ancient painting restoration network
[0093] The test set is input into the trained ancient painting restoration network for testing. The weight file is loaded to obtain the restored ancient painting.
[0094] A method for restoring ancient paintings based on edge guidance and multi-scale residual blocks was developed.
[0095] Example 2
[0096] The ancient painting restoration method based on edge guidance and multi-scale residual blocks implemented in this paper consists of the following steps:
[0097] (1) Establish a dataset for ancient painting restoration
[0098] The steps are the same as in Example 1.
[0099] (2) Constructing an ancient painting restoration network
[0100] The steps are the same as in Example 1.
[0101] (3) Training ancient painting restoration network
[0102] 1) Determine the overall loss function of the model
[0103] Overall model loss function L Total Including the perceptual loss function L Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV .
[0104] The overall loss function L is determined by the following formula. Total :
[0105] L Total =λ1L Perceptual +λ2L1+λ3L Histogram +λ4L TV
[0106] Where λ1∈(0,1], λ2∈(0,1], λ3∈(0,1], and λ4∈(0,1] are the perceptual loss functions L, respectively. Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV The weights are λ1, λ2, λ3, and λ4, and in this embodiment, the values are 0.5.
[0107] The other steps in this procedure are the same as in Example 1.
[0108] The other steps are the same as in Example 1, thus completing the ancient painting restoration method based on edge guidance and multi-scale residual blocks.
[0109] Example 3
[0110] The ancient painting restoration method based on edge guidance and multi-scale residual blocks implemented in this paper consists of the following steps:
[0111] (1) Establish a dataset for ancient painting restoration
[0112] The steps are the same as in Example 1.
[0113] (2) Constructing an ancient painting restoration network
[0114] The steps are the same as in Example 1.
[0115] (3) Training ancient painting restoration network
[0116] 1) Determine the overall loss function of the model
[0117] Overall model loss function L Total Including the perceptual loss function L Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV .
[0118] The overall loss function L is determined by the following formula. Total :
[0119] L Total =λ1L Perceptual +λ2L1+λ3L Histogram +λ4L TV
[0120] Where λ1∈(0,1], λ2∈(0,1], λ3∈(0,1], and λ4∈(0,1] are the perceptual loss functions L, respectively. Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV The weights are λ1, λ2, λ3, and λ4, and in this embodiment, the values are 0.1.
[0121] The other steps in this procedure are the same as in Example 1.
[0122] The other steps are the same as in Example 1, thus completing the ancient painting restoration method based on edge guidance and multi-scale residual blocks.
[0123] Example 4
[0124] The ancient painting restoration method based on edge guidance and multi-scale residual blocks implemented in this paper consists of the following steps:
[0125] (1) Establish a dataset for ancient painting restoration
[0126] The steps are the same as in Example 1.
[0127] (2) Constructing an ancient painting restoration network
[0128] The steps are the same as in Example 1.
[0129] (3) Training ancient painting restoration network
[0130] 1) Determine the overall loss function of the model
[0131] Overall model loss function L Total Including the perceptual loss function L Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV .
[0132] The overall loss function L is determined by the following formula. Total :
[0133] L Total =λ1L Perceptual +λ2L1+λ3L Histogram +λ4L TV
[0134] Where λ1∈(0,1], λ2∈(0,1], λ3∈(0,1], and λ4∈(0,1] are the perceptual loss functions L, respectively. Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV The weights are λ1, λ2, λ3, and λ4, and in this embodiment, the values are 1.
[0135] The other steps in this procedure are the same as in Example 1.
[0136] The other steps are the same as in Example 1, thus completing the ancient painting restoration method based on edge guidance and multi-scale residual blocks.
[0137] To verify the beneficial effects of the present invention, the inventors conducted a comparative experiment using the ancient painting restoration method based on edge guidance and multi-scale residual blocks (hereinafter referred to as the Method of Embodiment 1) of the present invention, and EdgeConnect (hereinafter referred to as EC), Recurrent Feature Reasoning (hereinafter referred to as RFR), Pluralistic Inpainting (hereinafter referred to as PI), and Local Global (hereinafter referred to as LG). The experimental results are as follows: Figure 7 As shown.
[0138] exist Figure 7In the figures, (a) shows the complete ancient painting image, (b) shows the damaged ancient painting image, (c) shows the image restored using the PI method, (d) shows the image restored using the RFR method, (e) shows the image restored using the EC method, (f) shows the image restored using the LG method, and (g) shows the image restored using Embodiment 1 of the present invention. As can be seen from the figures, compared with the EC, RFR, PI, and LG methods, Embodiment 1 of the present invention significantly improves problems such as loss of detail, blurred texture, excessive smoothing, and color deviation, avoids structural distortion, and makes the restored image more realistic and natural, successfully restoring the complete ancient painting image.
Claims
1. A method for restoring ancient paintings based on edge guidance and multi-scale residual blocks, characterized in that... It consists of the following steps: (1) Establish a dataset for ancient painting restoration The ancient painting restoration dataset was constructed by using the following sample data sources obtained from museum websites: "A Panorama of Rivers and Mountains", "Spring Morning in the Han Palace", "Dwelling in the Fuchun Mountains", and "Along the River During the Qingming Festival". These samples were cropped into ancient painting samples with a height (H) and width (W) of 256×256 pixels. The ancient painting restoration dataset was then divided into training set, validation set, and test set in a ratio of 7:2:
1. (2) Constructing an ancient painting restoration network The ancient painting restoration network consists of an ancient painting completion network, a color correction network, and a Markov discriminator connected in series. The ancient painting completion network is composed of a downsampling module, a polarization self-attention mechanism module, a multi-scale residual block group, and an upsampling module connected in series. The color correction network is composed of a downsampling module, a polarization self-attention mechanism module, a general residual block group, and an upsampling module connected in series; the general residual block group is composed of four general residual blocks connected in series. (3) Training ancient painting restoration network 1) Determine the overall loss function of the model Overall model loss function L Total Including the perceptual loss function L Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV ; Determine the perceptual loss function L using the following formula Perceptual : Where y represents the original ancient painting, x represents the restoration result, and F i (x) and F i (y) represent the output features of the VGG19 network, where N is the number of feature layers; The L1 loss function L1 is determined by the following formula: Where, f(x) k ) and y k Let n represent the restoration result of the k-th sample and the corresponding complete ancient painting, respectively, where n is the number of samples and n takes the value of a finite positive integer. The histogram loss function L is determined by the following formula. Histogram : Among them, w l These are the weight parameters of the l-th layer, O l R represents the activation layer, R represents histogram matching, and R(O) represents the activation layer. l ) represents the activation layer after histogram matching, L is the total number of layers, and ||·|| F Represents the Frobenius norm; The total variational loss function L is determined by the following formula. TV : Where i and j represent pixel position coordinates, x i,j represents a pixel in the input image, where s and t are the image width and height, respectively; The overall loss function L is determined by the following formula. Total : L Total =λ1L Perceptual +λ2L1+λ3L Histogram +λ4L TV Where λ1∈(0,1], λ2∈(0,1], λ3∈(0,1], and λ4∈(0,1] are the perceptual loss functions L1, L2, L3, L4, L5, L6, L7, L8, L9, L1, L2, L2, L3, L4, L9, L1, L2, L3, L4, L5, L6, L7, L9, L1, L2, L3, L Perceptual L1 loss function, L1 histogram loss function Histogram Total variational loss function L TV The weights; 2) Training network for ancient painting restoration The ancient painting restoration training set was input into the ancient painting restoration network for training. The learning rates of the discriminator and generator were set to 0.0001 and 0.00001, respectively, with a batch size of 8. The Adam optimizer was used to optimize the parameters of the generator and discriminator, and the model was trained until the overall loss function L was obtained. Total convergence; (4) Save the model During the training of the ancient painting restoration network, the weight file is saved once every 200 iterations; (5) Verify the ancient painting restoration network The validation set is input into the trained ancient painting restoration network for validation. (6) Testing the ancient painting restoration network The test set is input into the trained ancient painting restoration network for testing. The weight file is loaded to obtain the restored ancient painting.
2. The ancient painting restoration method based on edge guidance and multi-scale residual blocks according to claim 1, characterized in that: In step (2), the ancient painting restoration network is constructed by connecting a convolutional layer 1 with a kernel size of 7×7 and a stride of 1, an instance normalization layer 1, a ReLU activation function layer 1, a convolutional layer 2 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 2, a ReLU activation function layer 2, a convolutional layer 3 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 3, a ReLU activation function layer 3, a convolutional layer 4 with a kernel size of 4×4 and a stride of 2, an instance normalization layer 4, and a ReLU activation function layer 4 in sequence.
3. The ancient painting restoration method based on edge guidance and multi-scale residual blocks according to claim 1, characterized in that: In step (2), the ancient painting restoration network is constructed by connecting a convolutional layer 5 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 5, a ReLU activation function layer 5, a convolutional layer 6 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 6, a ReLU activation function layer 6, a convolutional layer 7 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 7, a ReLU activation function layer 7, a convolutional layer 8 with a kernel size of 3×3 and a stride of 1, an instance normalization layer 8, and a ReLU activation function layer 8 in sequence.
4. The ancient painting restoration method based on edge guidance and multi-scale residual blocks according to claim 1, characterized in that: In step (2), the ancient painting restoration network is constructed, and the multi-scale residual block group is composed of four multi-scale residual blocks connected in series.
5. The ancient painting restoration method based on edge guidance and multi-scale residual blocks according to claim 4, characterized in that: The multi-scale residual block is formed by connecting a 5×5 convolutional branch and a 3×3 convolutional branch in parallel, and then connecting them in series with the Concat layer, the 1×1 convolutional layer 13, and the SENet module.
6. The ancient painting restoration method based on edge guidance and multi-scale residual blocks according to claim 5, characterized in that: The 5×5 convolutional branch is composed of a convolutional layer 9 with a kernel size of 5×5 and a stride of 1, a ReLU activation function layer 9, a convolutional layer 10 with a kernel size of 5×5 and a stride of 1, and a ReLU activation function layer 10 connected in series.
7. The ancient painting restoration method based on edge guidance and multi-scale residual blocks according to claim 5, characterized in that: The 3×3 convolutional branch is composed of a convolutional layer 11 with a kernel size of 3×3 and a stride of 1, a ReLU activation function layer 11, a convolutional layer 12 with a kernel size of 3×3 and a stride of 1, and a ReLU activation function layer 12 connected in series.
