Ancient painting color reconstruction method based on double-pooling attention and pixel adaptive convolution
By adopting the dual-pooling attention and pixel adaptive convolution method in color reconstruction in ancient paintings, combining the overall loss function and reversible residual network, the problems of inaccurate color reconstruction and loss of details in the existing technology are solved, and the problem of color reconstruction in the existing technology is realized. Efficient color reconstruction effect of ancient paintings.
Patent Information
- Application Number
- CN202411090800.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-26
AI Technical Summary
The prior art is difficult to retain image detail information in the color reconstruction of ancient paintings, and the color matching is inaccurate, especially the local color reconstruction effect is not ideal.
The ancient painting color reconstruction method based on dual-pooling attention and pixel adaptive convolution is used to construct the ancient painting color reconstruction network. Through the overall loss function, the contrast continuous maintenance loss, style loss, matching Laplace loss and cyclic consistency loss Training is performed, using components such as reversible residual networks and dual-pooling attention modules to ensure accuracy and detail retention of color reconstruction.
It realizes the retention of image details and accurate matching of colors, which improves the effect of color reconstruction in ancient paintings, especially in local color reconstruction, and avoids incorrect color reconstruction results.
Smart Images

Figure CN119027333A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing and artificial intelligence, and specifically relates to a method for color reconstruction of ancient paintings. Background Art
[0002] Due to the influence of natural environment or human factors, ancient paintings often fade and change color to varying degrees. These factors greatly reduce the appreciation of ancient paintings and have an unignorable impact on the historical and cultural value of ancient paintings. Therefore, color reconstruction of ancient paintings is of great value and significance.
[0003] Color reconstruction of ancient paintings refers to the use of manual or digital methods to enhance the colors of the background and composition elements such as landscapes, trees and stones of ancient paintings, while retaining the structural information and content details of the ancient paintings, and to improve the fading and discoloration of ancient paintings. Manual color reconstruction requires in-depth analysis of factors such as the painting style, content, and techniques of ancient paintings, which is inefficient and may even cause damage to ancient paintings. With the continuous development of computer technology, digital color reconstruction technology has been widely used. Using digital methods for color reconstruction makes it easy to modify the reconstruction results and avoid operating on real ancient paintings, which will not cause damage to ancient paintings. Digital color reconstruction methods are mainly divided into traditional methods and deep learning-based methods. Traditional methods usually rely on model selection and parameter settings, such as using multispectral imaging technology to identify pigments for color reconstruction of ancient paintings, but improper model selection or parameter settings may lead to poor color reconstruction results.
[0004] In recent years, with the development of artificial intelligence, deep learning has been widely used in color reconstruction technology. By deeply learning the characteristics of ancient paintings, the effect of color reconstruction has been improved. Using deep learning technology to reconstruct the color of ancient paintings usually requires building a data set for color reconstruction of ancient paintings, building a model for training, learning the semantics, color and other features of ancient paintings, and finally using the trained model to reconstruct the color of ancient paintings. Color reconstruction models usually use VGG as a color style encoder, which makes it difficult to retain the detailed information of the image. At the same time, due to the difficulty in accurately extracting semantics and color features, incorrect colors often appear in the reconstruction results. In addition, since the model usually processes the image as a whole, the effect of local color reconstruction is not ideal. Summary of the invention
[0005] The technical problem to be solved by the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a color reconstruction method for ancient paintings based on double pooling attention and pixel adaptive convolution, which can preserve complete image details and accurately match colors.
[0006] The technical solution steps adopted to solve the above technical problems are as follows:
[0007] (1) Constructing a dataset for color reconstruction of ancient paintings
[0008] Works that meet the characteristics of Chinese ancient paintings were selected from museum websites and image databases, and ancient paintings in ink, green, and light crimson styles from different dynasties were collected. The height H and width W of the collected ancient paintings were adjusted to 512 and 512 pixels, and saved in jpg format. The ancient painting dataset was screened and divided into training set and test set according to 8:2.
[0009] (2) Constructing a color reconstruction network for ancient paintings
[0010] The ancient painting color reconstruction network is composed of a channel addition module and a reversible residual network 1, a space compression module 1, a reversible residual network 2, a space compression module 2, a reversible residual network 3, a channel reduction module, and a color migration module connected in series.
[0011] The reversible residual network 1 is composed of 4 or 6 reversible residual blocks with the same structure connected in series; the structures of the reversible residual network 2 and the reversible residual network 3 are the same as those of the reversible residual network 1.
[0012] (3) Training the ancient painting color reconstruction network
[0013] 1) Construct the overall loss function L total
[0014] The overall loss function L total Including contrast continuous maintenance loss function L ccp , style loss function L s , matching Laplace loss function L m , cycle-consistent loss function L cyc .
[0015] The overall loss function L is determined as follows: total :
[0016] L total =λ ccp L ccp +λ s L s +λ m L m +λ cyc L cyc
[0017] Among them, λ ccp To compare the continuous maintenance loss function L ccp The coefficient of ccp ∈(0,5],λ s is the style loss function L s The coefficient of s ∈(0,2],λ m To match the Laplace loss function Lm The coefficient of m ∈(0,1500],λ cyc is the cycle consistency loss L cyc The coefficient of cyc ∈(0,10].
[0018] Determine the contrast continuous loss function L as follows: ccp :
[0019]
[0020] Among them, P represents the total number of feature pairs for vector subtraction, m represents the mth feature pair for vector subtraction, represents the result of vector subtraction between the mth adjacent feature pairs of the ancient painting after color reconstruction, represents the vector subtraction result between the mth adjacent feature pairs of the color-degraded ancient painting, Represents the vector subtraction result between the nth adjacent feature pairs of the color-degraded ancient paintings. τ is a hyperparameter, τ∈(0,0.1], and n represents the nth feature pair for vector subtraction.
[0021] The style loss function L is determined as follows: s :
[0022]
[0023] Among them, I s Indicates the reference painting, I cs Represents the ancient painting after color reconstruction. The first to fourth layers of the pre-trained VGG19 network are used to extract the image features of the ancient painting. i represents the output feature map of the i-th layer of the pre-trained VGG19 network, μ and σ represent the mean and standard deviation respectively, and ||·||2 represents the L2 norm.
[0024] The matching Laplace loss function L is determined by the following formula m :
[0025]
[0026] Where N represents the number of image pixels, V c [I cs ] is the image of the ancient painting after color reconstruction I cs Vectorization on channel c, T represents the transposition of the obtained vector, and M represents the matching Laplacian matrix of the image.
[0027] The cycle-consistent loss function L is determined as follows: cyc :
[0028]
[0029] in, It means that the reconstructed ancient painting is input into the network, and the degraded ancient painting is used as a reference, and the resulting image is obtained. C represents degraded ancient paintings, and ||·||1 represents the L1 norm.
[0030] 2) Training ancient painting color reconstruction network
[0031] The training set is input into the ancient painting color reconstruction network for training. The parameters of the training process are set as follows: the server graphics card for training is RTX 3090, the Adam optimizer is used for training for 80,000 rounds, the initial learning rate is 0.0001, the training batch size is 2, and the overall loss function L is trained. total convergence.
[0032] (4) Save the network
[0033] In the process of training the ancient painting color reconstruction network, the weight file is saved once for each training round.
[0034] (5) Testing the ancient painting color reconstruction network
[0035] The test set is input into the trained ancient painting color reconstruction network for testing, and the color-reconstructed ancient paintings are output.
[0036] In step (2) of the present invention, in constructing the ancient painting color reconstruction network, the reversible residual block is composed of a double-pooling attention module and an adaptive feature extraction module connected in series.
[0037] The dual-pooled attention module of the present invention is composed of an average pooling layer and a global average pooling layer, a convolution layer 1 with a convolution kernel size of 3×3 and a step size of 1, and a Sigmoid activation function layer connected in series in sequence.
[0038] The adaptive feature extraction module of the present invention is composed of a convolution layer 2 with a convolution kernel size of 3×3 and a step size of 1 and a ReLU activation function layer 1, a convolution layer 3 with a convolution kernel size of 3×3 and a step size of 1, a ReLU activation function layer 2, and a pixel adaptive convolution layer connected in series in sequence.
[0039] The present invention selects ancient Chinese paintings and constructs a color reconstruction data set for ancient paintings, providing reliable data for feature extraction and color migration of ancient paintings; the constructed ancient painting color reconstruction network can retain the structural information and content details of ancient paintings, improve the fading and discoloration of input ancient paintings, reduce incorrect colors, and enhance the local color reconstruction effect; the ancient painting color reconstruction network is used to achieve computer reconstruction of ancient painting colors. The present invention has the advantages of clear details of the reconstruction results and accurate color reconstruction, and can be used for computer reconstruction of ancient painting colors. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a flow chart of Example 1 of the present invention.
[0041] Figure 2 It is a structural diagram of the ancient painting color reconstruction network.
[0042] Figure 3 yes Figure 2 Schematic diagram of the structure of the reversible residual network 1.
[0043] Figure 4 yes Figure 3 Schematic diagram of the structure of the reversible residual block 1.
[0044] Figure 5 yes Figure 4 Schematic diagram of the structure of the dual-pooling attention module.
[0045] Figure 6 yes Figure 4 Schematic diagram of the structure of the adaptive feature extraction module.
[0046] Figure 7 It is a visualized schematic diagram of the colors of ancient paintings of different styles reconstructed by the method of the present invention. DETAILED DESCRIPTION
[0047] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments, but the present invention is not limited to the following embodiments.
[0048] Example 1
[0049] The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution in this embodiment consists of the following steps (see Figure 1 ):
[0050] (1) Constructing a dataset for color reconstruction of ancient paintings
[0051] Works that meet the characteristics of Chinese ancient paintings were selected from museum websites and image databases, and ancient paintings in ink, green, and light crimson styles from different dynasties were collected. The height H and width W of the collected ancient paintings were adjusted to 512 and 512 pixels, and saved in jpg format. The ancient painting dataset was screened and divided into training set and test set according to 8:2.
[0052] (2) Constructing a color reconstruction network for ancient paintings
[0053] Figure 2 The structural diagram of the ancient painting color reconstruction network is given. Figure 2In the embodiment, the ancient painting color reconstruction network is composed of a channel addition module and a reversible residual network 1, a space compression module 1, a reversible residual network 2, a space compression module 2, a reversible residual network 3, a channel reduction module, and a color migration module connected in series in sequence.
[0054] Figure 3 Given Figure 2 Schematic diagram of the structure of the reversible residual network 1. Figure 3 In the embodiment, the reversible residual network 1 is composed of 6 reversible residual blocks with the same structure connected in series, and reversible residual blocks 1 to reversible residual blocks 6 are connected in series in series; the structures of reversible residual network 2 and reversible residual network 3 are the same as those of reversible residual network 1.
[0055] Figure 4 Given Figure 3 Schematic diagram of the structure of the reversible residual block 1. Figure 4 In the embodiment, the reversible residual block 1 is composed of a double-pooling attention module and an adaptive feature extraction module connected in series; the structures of the reversible residual blocks 2 to 6 are the same as the structure of the reversible residual block 1.
[0056] Figure 5 Given Figure 4 Schematic diagram of the structure of the dual-pooling attention module in. Figure 5 In the embodiment, the dual-pooling attention module is composed of an average pooling layer and a global average pooling layer, a convolution layer 1 with a convolution kernel size of 3×3 and a step size of 1, and a Sigmoid activation function layer connected in series in sequence.
[0057] Figure 6 Given Figure 4 Schematic diagram of the structure of the adaptive feature extraction module. Figure 6 In the embodiment, the adaptive feature extraction module is composed of a convolution layer 2 with a convolution kernel size of 3×3 and a step size of 1, a ReLU activation function layer 1, a convolution layer 3 with a convolution kernel size of 3×3 and a step size of 1, a ReLU activation function layer 2, and a pixel adaptive convolution layer connected in series in sequence. The construction method of the pixel adaptive convolution layer F is as follows:
[0058] F=v'
[0059]
[0060] Among them, v is the input feature map, v' is the output feature map, K is the kernel function with fixed parameters, W is the standard convolution kernel, b is the bias parameter, Indicates that the feature map is located at (x i ,y i ) position, and T represents the matrix transpose.
[0061] The ancient painting color reconstruction network constructed by the present invention can retain the structural information and content details of the ancient paintings, improve the fading and discoloration of the input ancient paintings, reduce incorrect colors, and enhance the local color reconstruction effect; the ancient painting color reconstruction network is adopted to realize computer reconstruction of the color of ancient paintings.
[0062] (3) Training the ancient painting color reconstruction network
[0063] 1) Construct the overall loss function L total
[0064] The overall loss function L total Including contrast continuous maintenance loss function L ccp , style loss function L s , matching Laplace loss function L m , cycle-consistent loss function L cyc .
[0065] The overall loss function L is determined as follows: total :
[0066] L total =λ ccp L ccp +λ s L s +λ m L m +λ cyc L cyc
[0067] Among them, λ ccp To compare the continuous maintenance loss function L ccp The coefficient of ccp ∈(0,5], λ in this embodiment ccp The value is 3, s is the style loss function L s The coefficient of s ∈(0,2], λ in this embodiment s The value is 1, λ m To match the Laplace loss function L m The coefficient of m ∈(0,1500], λ in this embodiment m The value is 750, cyc is the cycle consistency loss L cyc The coefficient of cyc ∈(0,10], λ in this embodiment cyc The value is 5.
[0068] Determine the contrast continuous loss function L as follows: ccp :
[0069]
[0070] Among them, P represents the total number of feature pairs for vector subtraction, m represents the mth feature pair for vector subtraction, represents the result of vector subtraction between the mth adjacent feature pairs of the ancient painting after color reconstruction, represents the vector subtraction result between the mth adjacent feature pairs of the color-degraded ancient painting, represents the vector subtraction result between the nth adjacent feature pairs of the color-degraded ancient painting, τ is a hyperparameter, τ∈(0,0.1], the value of τ in this embodiment is 0.05, and n represents the nth feature pair subjected to vector subtraction.
[0071] The style loss function L is determined as follows: s :
[0072]
[0073] Among them, I s Indicates the reference painting, I cs Represents the ancient painting after color reconstruction. The first to fourth layers of the pre-trained VGG19 network are used to extract the image features of the ancient painting. i represents the output feature map of the i-th layer of the pre-trained VGG19 network, μ and σ represent the mean and standard deviation respectively, and ||·||2 represents the L2 norm.
[0074] The matching Laplace loss function L is determined by the following formula m :
[0075]
[0076] Where N represents the number of image pixels, V c [I cs ] is the image of the ancient painting after color reconstruction I cs Vectorization on channel c, T represents the transposition of the obtained vector, and M represents the matching Laplacian matrix of the image.
[0077] The cycle-consistent loss function L is determined as follows: cyc :
[0078]
[0079] in, It means that the reconstructed ancient painting is input into the network, and the degraded ancient painting is used as a reference, and the resulting image is obtained. C represents degraded ancient paintings, and ||·||1 represents the L1 norm.
[0080] 2) Training ancient painting color reconstruction network
[0081] The training set is input into the ancient painting color reconstruction network for training. The parameters of the training process are set as follows: the server graphics card for training is RTX 3090, the Adam optimizer is used for training for 80,000 rounds, the initial learning rate is 0.0001, the training batch size is 2, and the overall loss function L is trained. total convergence.
[0082] (4) Save the network
[0083] In the process of training the ancient painting color reconstruction network, the weight file is saved once for each training round.
[0084] (5) Testing the ancient painting color reconstruction network
[0085] The test set is input into the trained ancient painting color reconstruction network for testing, and the color-reconstructed ancient paintings are output.
[0086] Completed the ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution.
[0087] Example 2
[0088] The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution in this embodiment consists of the following steps:
[0089] (1) Constructing a dataset for color reconstruction of ancient paintings
[0090] This step is the same as in Example 1.
[0091] (2) Constructing a color reconstruction network for ancient paintings
[0092] This step is the same as in Example 1.
[0093] (3) Training the ancient painting color reconstruction network
[0094] 1) Construct the overall loss function L total
[0095] The overall loss function L total Including contrast continuous maintenance loss function L ccp , style loss function L s , matching Laplace loss function L m , cycle-consistent loss function L cyc .
[0096] The overall loss function L is determined as follows: total :
[0097] L total =λ ccp L ccp +λ s L s +λm L m +λ cyc L cyc
[0098] Among them, λ ccp To compare the continuous maintenance loss function L ccp The coefficient of ccp ∈(0,5], λ in this embodiment ccp The value is 0.1, s is the style loss function L s The coefficient of s ∈(0,2], λ in this embodiment s The value is 0.1, m To match the Laplace loss function L m The coefficient of m ∈(0,1500], λ in this embodiment m The value is 1, λ cyc is the cycle consistency loss L cyc The coefficient of cyc ∈(0,10], λ in this embodiment cyc The value is 0.1.
[0099] Comparison with continuous loss function L ccp The expression is the same as that in Example 1. In contrast to the continuous loss function L ccp In the expression, τ is a hyperparameter, τ∈(0,0.1], the value of τ in this embodiment is 0.01, and the meanings and values of other parameters are the same as those in Example 1.
[0100] Style loss function L s , matching Laplace loss function L m , cycle-consistent loss function L cyc The meanings and values of the expressions and parameters are the same as those in Example 1.
[0101] The other steps are the same as those in Example 1. The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution is completed.
[0102] Example 3
[0103] The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution in this embodiment consists of the following steps:
[0104] (1) Constructing a dataset for color reconstruction of ancient paintings
[0105] This step is the same as in Example 1.
[0106] (2) Constructing a color reconstruction network for ancient paintings
[0107] This step is the same as in Example 1.
[0108] (3) Training the ancient painting color reconstruction network
[0109] 1) Construct the overall loss function L total
[0110] The overall loss function L total Including contrast continuous maintenance loss function L ccp , style loss function L s , matching Laplace loss function L m , cycle-consistent loss function L cyc .
[0111] The overall loss function L is determined as follows: total :
[0112] L total =λ ccp L ccp +λ s L s +λ m L m +λ cyc L cyc
[0113] Among them, λ ccp To compare the continuous maintenance loss function L ccp The coefficient of ccp ∈(0,5], λ in this embodiment ccp The value is 5, s is the style loss function L s The coefficient of s ∈(0,2], λ in this embodiment s The value is 2, m To match the Laplace loss function L m The coefficient of m ∈(0,1500], λ in this embodiment m The value is 1500, cyc is the cycle consistency loss L cyc The coefficient of cyc ∈(0,10], λ in this embodiment cyc The value is 10.
[0114] Comparison with continuous loss function L ccp The expression is the same as that in Example 1. In contrast to the continuous loss function L ccp In the expression, τ is a hyperparameter, τ∈(0,0.1], the value of τ in this embodiment is 0.1, and the meanings and values of other parameters are the same as those in Example 1.
[0115] Style loss function Ls , matching Laplace loss function L m , cycle-consistent loss function L cyc The meanings and values of the expressions and parameters are the same as those in Example 1.
[0116] The other steps are the same as those in Example 1. The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution is completed.
[0117] Example 4
[0118] In the above embodiments 1-3, the ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution in this embodiment consists of the following steps:
[0119] (1) Constructing a dataset for color reconstruction of ancient paintings
[0120] This step is the same as in Example 1.
[0121] (2) Constructing a color reconstruction network for ancient paintings
[0122] The ancient painting color reconstruction network of this embodiment is composed of a channel addition module and a reversible residual network 1, a space compression module 1, a reversible residual network 2, a space compression module 2, a reversible residual network 3, a channel reduction module, and a color migration module connected in series in sequence.
[0123] The reversible residual network 1 of this embodiment is composed of four reversible residual blocks with the same structure connected in series, and reversible residual blocks 1 to 4 are connected in series in series. The structures of reversible residual network 2 and reversible residual network 3 are the same as those of reversible residual network 1.
[0124] The other structures of the ancient painting color reconstruction network are the same as those in Example 1.
[0125] The other steps are the same as those in the corresponding embodiment. The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution is completed.
[0126] In order to verify the beneficial effects of the present invention, a simulation experiment was conducted using the ancient painting color reconstruction method based on double-pooled attention and pixel adaptive convolution according to Example 1 of the present invention. The experimental results are as follows:
[0127] 1. Simulation conditions
[0128] The hardware conditions are: Ubuntu 18.04, a server consisting of 1 NVIDIA RTX 3090 GPU.
[0129] The software platform is: python language and Pytorch neural model framework.
[0130] 2. Simulation content and results
[0131] We selected faded and discolored ancient paintings in three styles, namely, light purple, green, and ink, as input, and selected paintings with similar styles and relatively intact colors as reference paintings. We conducted simulation experiments using the ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution in Example 1. The experimental results are shown in Figure 2. Figure 7 .Depend on Figure 7 It can be seen that in the figure, (a) is the input Dongting Autumn Moon Picture, which is a degraded ancient painting in ink style, (b) is the input reference image, (c) is the output reconstruction result image, (d) is the input Minghuang Travels to Shu Picture, which is a degraded ancient painting in green style, (e) is the input reference image, (f) is the output reconstruction result image, (g) is the input landscape picture (Summer Trees Hanging in the Shade), which is a degraded ancient painting in light crimson style, (h) is the input reference image, (i) is the output reconstruction result image, (j) is the input landscape picture, which is a degraded ancient painting in light crimson style, (k) is the input reference image, and (l) is the output reconstruction result image.
[0132] Depend on Figure 7 It can be seen that the ancient paintings after color reconstruction obtained by the method of the present invention retain the structural information and content details of the ancient paintings, and improve the fading and discoloration phenomena of the input ancient paintings. It can be well adapted to ancient paintings of different styles and has a better color reconstruction effect.
Claims
1. A method for color reconstruction of ancient paintings based on double pooling attention and pixel adaptive convolution, characterized in that It consists of the following steps: (1) Constructing a dataset for color reconstruction of ancient paintings We screened works that match the characteristics of ancient Chinese paintings from museum websites and image databases, collected ancient paintings in ink, green, and light crimson styles from different dynasties, adjusted the height H to 512 and the width W to 512 pixels, saved them in jpg format, screened out the ancient painting dataset, and divided it into a training set and a test set according to an 8:2 ratio; (2) Constructing a color reconstruction network for ancient paintings The ancient painting color reconstruction network is composed of a channel addition module and a reversible residual network 1, a space compression module 1, a reversible residual network 2, a space compression module 2, a reversible residual network 3, a channel reduction module, and a color migration module connected in series in sequence; The reversible residual network 1 is composed of 4 or 6 reversible residual blocks with the same structure connected in series in sequence; the structures of the reversible residual network 2 and the reversible residual network 3 are the same as those of the reversible residual network 1; (3) Training the ancient painting color reconstruction network 1) Construct the overall loss function L total The overall loss function L total Including contrast continuous maintenance loss function L ccp , style loss function L s , matching Laplace loss function L m , cycle-consistent loss function L cyc ; The overall loss function L is determined as follows: total : L total =λ ccp L ccp +λ s L s +λ m L m +λ cyc L cyc Among them, λ ccp To compare the continuous maintenance loss function L ccp The coefficient of ccp ∈(0,5],λ s is the style loss function L s The coefficient of s ∈(0,2],λ m To match the Laplace loss function L m The coefficient of m ∈(0,1500],λ cyc is the cycle consistency loss L cyc The coefficient of cyc ∈(0,10]; Determine the contrast continuous loss function L as follows: ccp : Among them, P represents the total number of feature pairs for vector subtraction, m represents the mth feature pair for vector subtraction, represents the result of vector subtraction between the mth adjacent feature pairs of the ancient painting after color reconstruction, represents the vector subtraction result between the mth adjacent feature pairs of the color-degraded ancient painting, represents the result of vector subtraction between the nth adjacent feature pairs of the color-degraded ancient painting, τ is a hyperparameter, τ∈(0,0.1], n represents the nth feature pair for vector subtraction; The style loss function L is determined as follows: s : Among them, I s Indicates the reference painting, I cs Represents the ancient painting after color reconstruction. The first to fourth layers of the pre-trained VGG19 network are used to extract the image features of the ancient painting. i represents the output feature map of the i-th layer of the pre-trained VGG19 network, μ and σ represent the mean and standard deviation respectively, and ||·||2 represents the L2 norm; The matching Laplace loss function L is determined by the following formula m : Where N represents the number of image pixels, V c [I cs ] is the image of the ancient painting after color reconstruction I cs Vectorization on channel c, T represents the transposition of the obtained vector, and M represents the matching Laplacian matrix of the image; The cycle-consistent loss function L is determined as follows: cyc : in, It means that the reconstructed ancient painting is input into the network, and the degraded ancient painting is used as a reference, and the resulting image is obtained. C represents degraded ancient paintings, ||·||1 represents the L1 norm; 2) Training ancient painting color reconstruction network The training set is input into the ancient painting color reconstruction network for training. The parameters of the training process are set as follows: the server graphics card for training is RTX 3090, the Adam optimizer is used for training for 80,000 rounds, the initial learning rate is 0.0001, the training batch size is 2, and the overall loss function L is trained. total convergence; (4) Save the network In the process of training the ancient painting color reconstruction network, the weight file is saved once for each round of training; (5) Testing the ancient painting color reconstruction network The test set is input into the trained ancient painting color reconstruction network for testing, and the color-reconstructed ancient paintings are output.
2. The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution according to claim 1 is characterized in that: In step (2) of constructing the ancient painting color reconstruction network, the reversible residual block is composed of a double-pooling attention module and an adaptive feature extraction module connected in series.
3. The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution according to claim 2 is characterized in that: The dual-pooling attention module is composed of an average pooling layer and a global average pooling layer, a convolution layer 1 with a convolution kernel size of 3×3 and a step size of 1, and a Sigmoid activation function layer connected in series.
4. The ancient painting color reconstruction method based on double pooling attention and pixel adaptive convolution according to claim 2 is characterized in that: The adaptive feature extraction module is composed of a convolution layer 2 with a convolution kernel size of 3×3 and a step size of 1 and a ReLU activation function layer 1, a convolution layer 3 with a convolution kernel size of 3×3 and a step size of 1, a ReLU activation function layer 2, and a pixel adaptive convolution layer connected in series in sequence.
