Image multi-domain style conversion method based on dense frequency domain attention residual
By introducing dense frequency domain attention residual network and spectral normalization on StarGAN, the background color difference and edge blur of expression images in face style conversion are solved, which improves the authenticity and efficiency of image style conversion and achieves more Efficient multi-domain style conversion effect.
Patent Information
- Application Number
- CN202411415007.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-03
AI Technical Summary
The prior art has problems in the face style conversion with large differences in background color, blurred edges and overlapping textures during expression image generation, especially in multi-domain image style conversion tasks, the model calculation complexity is high and the generation effect is not good.
Using StarGAN-based multi-domain style conversion method, the learning ability of facial change areas is enhanced by embedding convolutional attention and dense frequency domain attention residual network in the generated network, and in the discriminator Introduce spectral normalization to improve the depth perception and feature multiplexing capabilities of the model, and generate more realistic images.
It effectively solves the problems of background color differences, edge blur and texture overlap, improves the authenticity and quality of image style conversion, reduces the instability of model training, and improves the efficiency and effect of multi-domain style conversion.
Smart Images

Figure CN119251045A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to an image multi-domain style conversion method based on dense frequency domain attention residual. Background Art
[0002] Style transfer is an important research field in computer vision. It modifies the texture features of the content image based on the texture information of the style image without changing its content. Style transfer was originally used in the art industry, but has now expanded to film, television, entertainment, medicine, criminal investigation and other fields. As a branch of style transfer, face style transfer refers to editing some facial attributes and reflecting these attributes on the face. Currently, face style transfer algorithms have been widely used in face synthesis, photo editing and other aspects.
[0003] At present, the image style transfer methods mainly include traditional methods and neural network-based methods. Traditional image style transfer methods focus on manually designed feature extraction and mathematical optimization. Although they are simple and easy to understand, they have problems such as poor style transfer effect. With the development of deep learning, image style transfer based on neural networks has gradually become an important direction of style transfer research. Early image-to-image conversion considered paired settings. When paired samples are given, conditional generative models or simple regression models can be used, but the most advanced methods currently focus on unpaired settings. This trend was initiated by CycleGAN, and many variants such as DualGAN and StarGAN were subsequently proposed. The CycleGAN model uses two generators and two discriminators to convert datasets from two different domains to each other. The network does not require paired data, but only needs to input and output two datasets, which solves the unpaired problem between images in Pix2Pix. However, it can only perform single-domain conversion of images, and there are too many generators. DualGAN is an unsupervised learning framework for image-to-image conversion, but it also has the problem of too many generators. Although these two types of models have good performance in single-domain image conversion, they will increase the computational complexity of the model for multi-domain conversion applications. StarGAN proposed by Choi et al. is a multi-domain image translation technology that can be used to achieve style transfer between multiple domains. It can learn the mapping between all domains with only one generator and one discriminator, overcoming the problem that the generator must be trained when extracting features between two different domains in traditional domain migration. However, the StarGAN generator simply downsamples and upsamples when extracting features and generating images, which can cause the generated expression images to be blurred and overlapped, and the background color of the generated attribute images to be significantly different from the original image.
[0004] Therefore, based on StarGAN as the basic framework, this paper proposes an image multi-domain style transfer method based on dense frequency domain attention residual to address the above-mentioned problems. Summary of the invention
[0005] The purpose of the present invention is to provide an image multi-domain style transfer method based on dense frequency domain attention residual, in order to address the problems in the prior art of multi-domain image style transfer tasks, such as large differences in background colors after facial attribute transformation and blurred edges and overlapping textures in key areas of expression pictures generated in expression synthesis tasks. The method embeds convolutional attention in the shallow part of the generative network encoding and decoding to strengthen the learning of areas with large facial changes, and proposes a dense frequency domain attention residual network to enhance the depth perception and feature reuse of the model, so that the model can perform style transfer tasks more efficiently. A discriminator embedded with spectral normalization is constructed, which can effectively prevent instability in the model training process and generate more realistic images.
[0006] To achieve the above object, the present invention provides the following solutions:
[0007] A multi-domain image style transfer method based on dense frequency domain attention residual, comprising:
[0008] Get the image to be converted and the target style attribute label;
[0009] The image to be converted and the target style attribute label are input into a preset style transfer model, and a target style image is output, wherein the style transfer model is obtained by training a training set, the training set contains images and attribute labels of several styles, and the style transfer model is constructed by fusing a dense frequency domain attention residual block and a spectral normalized feature extraction block based on the StarGAN network.
[0010] Optionally, the style transfer model includes a generator and a discriminator, the generator is used to generate a false image based on the image to be converted and the target style attribute label; the discriminator is used to judge and classify the attributes of the image to be converted and the false image, and output the target style image.
[0011] Optionally, the generator includes a downsampling module, a dense frequency domain attention residual network, and an upsampling module. The image to be converted and the target style attribute label are downsampled by convolution through the downsampling module, and then feature extracted through the dense frequency domain attention residual network. Finally, they are upsampled by deconvolution through the upsampling module to output a false image that conforms to the target style.
[0012] Optionally, a convolutional attention module CBAM is added to both the downsampling module and the upsampling module, and the convolutional attention module CBAM is used to enhance the editing capability of the style transfer model for key area attributes.
[0013] Optionally, the dense frequency domain attention residual network includes several densely connected residual blocks, and a frequency domain channel attention mechanism FcaNet is introduced into the residual block. The frequency domain channel attention mechanism FcaNet is used to divide the input into multiple parts along the channel dimension and assign a two-dimensional frequency component to each part to obtain a multi-spectrum compression vector.
[0014] Optionally, the residual block includes a first convolutional layer, a first normalization layer, a first activation function, a second convolutional layer, a second normalization layer, and a second activation function connected in sequence;
[0015] The frequency domain channel attention mechanism FcaNet includes a two-dimensional discrete cosine transform layer, a first fully connected layer, a third activation function, a second fully connected layer, and a fourth activation function connected in sequence;
[0016] The frequency domain channel attention mechanism FcaNet is introduced into the residual block, that is, the frequency domain channel attention mechanism FcaNet is introduced after the second normalization layer of the residual block.
[0017] Optionally, the discriminator includes several third convolutional layers and fourth convolutional layers, the third convolutional layers are used to perform layer-by-layer feature extraction on the image to be converted and the false image, a fifth activation function is connected after each third convolutional layer, and spectral normalization is embedded between every two third convolutional layers; the fourth convolutional layer is used to judge the authenticity and attribute category of the image to be converted and the false image based on the features extracted by the third convolutional layer.
[0018] Optionally, the style transfer model is optimized by a loss function during training, and the loss function is:
[0019]
[0020] Among them, L D is the discriminator loss, L G is the generator loss, L adv is the adversarial loss, λ cls and λ rec is a hyperparameter, is the domain classification loss of the discriminator, is the domain classification loss of the generator, L rec To rebuild the losses.
[0021] The beneficial effects of the present invention are:
[0022] The present invention provides an image multi-domain style transfer method based on dense frequency domain attention residual, embeds convolutional attention in the shallow part of the generative network encoding and decoding to strengthen the learning of facial areas with large changes, and proposes a dense frequency domain attention residual network, which enhances the depth perception and feature reuse of the model, making the model more efficient in style transfer tasks; and constructs a discriminator embedded with spectral normalization, which can effectively prevent instability in the model training process and generate more realistic images. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] 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 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.
[0024] Figure 1 A schematic diagram of the network structure of a style transfer model according to an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of a generator network structure according to an embodiment of the present invention;
[0026] Figure 3 This is a schematic diagram of the network structure of a multi-spectral channel attention mechanism according to an embodiment of the present invention;
[0027] Figure 4 A schematic diagram of a residual block network structure that introduces a frequency domain channel attention mechanism according to an embodiment of the present invention;
[0028] Figure 5 Schematic diagram of the discriminator network structure of an embodiment of the present invention;
[0029] Figure 6 This is a visualization result diagram of the model of an embodiment of the present invention on the CelebA dataset;
[0030] Figure 7 This is a visualization result diagram of the model of an embodiment of the present invention on the RaFD dataset;
[0031] Figure 8 This is a comparison chart of the visualization results of the model of the embodiment of the present invention and other models on the CelebA dataset;
[0032] Fig. 9 This is a comparison chart of the visualization results of the model of an embodiment of the present invention and other models on the RaFD dataset. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.
[0034] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0035] This embodiment provides an image multi-domain style transfer method based on dense frequency domain attention residual, including:
[0036] Get the image to be converted and the target style attribute label;
[0037] The image to be converted and the target style attribute label are input into a preset style transfer model, and a target style image is output, wherein the style transfer model is obtained by training a training set, the training set contains images and attribute labels of several styles, and the style transfer model is constructed by fusing a dense frequency domain attention residual block and a spectral normalized feature extraction block based on the StarGAN network.
[0038] Specifically, in this embodiment, a dense frequency domain attention residual network is proposed to enhance the depth perception and feature reuse of the model, making the model more efficient in style transfer tasks; and a discriminator with embedded spectral normalization is constructed, which can effectively prevent instability in the model training process and generate more realistic images.
[0039] Furthermore, the style transfer model includes a generator and a discriminator, wherein the generator is used to generate a false image based on the image to be converted and the target style attribute label; the discriminator is used to judge and classify the attributes of the image to be converted and the false image, and output the target style image.
[0040] The generator includes a downsampling module, a dense frequency domain attention residual network, and an upsampling module. The image to be converted and the target style attribute label are downsampled by convolution in the downsampling module, then feature extracted by the dense frequency domain attention residual network, and finally upsampled by deconvolution in the upsampling module to output a false image that conforms to the target style.
[0041] Among them, a convolutional attention module CBAM is added to both the downsampling module and the upsampling module, and the convolutional attention module CBAM is used to enhance the editing ability of the style transfer model for key area attributes.
[0042] The dense frequency-domain attention residual network includes several densely connected residual blocks, in which a frequency-domain channel attention mechanism FcaNet is introduced. The frequency-domain channel attention mechanism FcaNet is used to divide the input into multiple parts along the channel dimension and assign a two-dimensional frequency component to each part to obtain a multi-spectrum compression vector.
[0043] The residual block includes a first convolutional layer, a first normalization layer, a first activation function, a second convolutional layer, a second normalization layer, and a second activation function connected in sequence;
[0044] The frequency domain channel attention mechanism FcaNet includes a two-dimensional discrete cosine transform layer, a first fully connected layer, a third activation function, a second fully connected layer, and a fourth activation function connected in sequence;
[0045] The frequency domain channel attention mechanism FcaNet is introduced into the residual block, that is, the frequency domain channel attention mechanism FcaNet is introduced after the second normalization layer of the residual block.
[0046] Furthermore, the discriminator includes a plurality of third convolutional layers and fourth convolutional layers, the third convolutional layers are used to perform layer-by-layer feature extraction on the image to be converted and the false image, a fifth activation function is connected after each third convolutional layer, and spectral normalization is embedded between every two third convolutional layers; the fourth convolutional layer is used to judge the authenticity and attribute category of the image to be converted and the false image based on the features extracted by the third convolutional layer.
[0047] Furthermore, the style transfer model is optimized through a loss function during training, and the loss function is:
[0048]
[0049] Among them, L D is the discriminator loss, L G is the generator loss, L adv is the adversarial loss, λ cls and λ rec is a hyperparameter, is the domain classification loss of the discriminator, is the domain classification loss of the generator, L rec To rebuild the losses.
[0050] This embodiment embeds convolutional attention in the shallow part of the generative network encoding and decoding to strengthen the learning of areas with large facial changes, and proposes a dense frequency domain attention residual network to enhance the depth perception and feature reuse of the model, making the model more efficient in style transfer tasks; and constructs a discriminator embedded with spectral normalization, which can effectively prevent instability in the model training process and generate more realistic images.
[0051] Combine the following Figure 1-Figure 5 The style conversion model constructed in this embodiment is described in detail as follows:
[0052] The overall structure of the style transfer model constructed in this embodiment, namely, the Dense Frequency Attention Residuals--Generative Adversarial Networks (DFR-GAN) based on the Dense Frequency Attention Residuals is as follows: Figure 1 As shown in the figure, it mainly includes two parts: the generator G that integrates convolutional attention and dense frequency domain attention residual network and the discriminator D embedded with spectral normalization. The generator G trains the labels of the real images from the source domain and the target domain attributes that are expected to be converted, and generates fake images conditioned on the target domain attribute labels. The convolutional block attention module (CBAM) is added to the generator to enhance the model's ability to edit the key ROI attributes of the eyes and mouth; at the same time, the frequency channel attention network (FcaNet) is embedded in the residual block, so that the generated image does not change the detailed features of the non-target attributes in the source domain image, and the improved residual block is densely connected to achieve feature reuse, forming a dense frequency domain attention residual network (Dense Frequency Attention Residuals Module, DFRM). The discriminator D can distinguish the authenticity of the generated image and can classify the domain to which the image belongs, but there is a problem of unstable training. By embedding spectral normalization (SN), the training process can be made more stable and the quality of the generated image can be improved.
[0053] (1) Generator that combines convolutional attention and dense frequency-domain attention residual networks:
[0054] The generator structure of DFR-GAN is as follows Figure 2As shown in the figure, taking the expression "neutral" as an example, if the "neutral" expression in the source domain is to be converted into an "angry" expression, the image corresponding to the "neutral" expression and the label corresponding to the "angry" expression are input into the generator together, first downsampled by convolution, then deep feature extraction by DFRM, and finally upsampled by deconvolution to obtain the output image of the "angry" expression. The generated "angry" expression image and the label corresponding to the "neutral" expression are input into the generator together to reconstruct the "neutral" expression image. The reconstruction loss between the reconstructed pseudo image and the input image ensures that the reconstructed image retains the content of the input image. CBAM is added before the generator performs downsampling and after upsampling, and the features are processed from the two dimensions of channel and space at the same time, which helps the generator better capture and utilize key feature information in different style conversion tasks, thereby improving the quality of generated images.
[0055] Frequency domain channel attention mechanism FcaNet:
[0056] FcaNet introduces channel attention from the frequency domain perspective and regards the channel representation problem as a compression process using frequency analysis. Its structure is as follows: Figure 3 First, the input X is split into multiple parts along the channel dimension, denoted as [X 0 ,X 1 ,…,X n-1 ], where X i =R C'×H×W , i∈{0,1,…,n-1}, And C should be divisible by n. For each part, the corresponding two-dimensional DCT frequency component is assigned, and the two-dimensional DCT result can be used as the compression result of channel attention, as follows:
[0057]
[0058] Among them, [u i ,v i ] corresponds to X i The 2D index of the frequency component, Freq i ∈R C ' is the C'-dimensional vector after compression. The entire compressed vector can be obtained by concat concatenation:
[0059] Freq=compress(X)=cat([Freq 0 ,Freq 1 ,……,Freq n-1 ])
[0060] Among them, Freq∈R C is the obtained multi-spectral vector. The entire multi-spectral channel attention framework can be written as follows:
[0061] ms_att=sigmoid(fc(Freq))
[0062] Dense Frequency Domain Attention Residual Network:
[0063] This embodiment combines the frequency channel attention FcaNet and the residual block to form a frequency channel attention residual unit (FRU), so that the generated image can improve the attribute migration ability of the model on the basis of maximizing the retention of non-target attribute features. The structure diagram of FRU is shown in Figure 4 As shown in the figure, after the residual block is normalized by the second InstanceNorm instance, the output feature map is [C, H, W], where H and W are the length and width of the input feature map, respectively, and C represents the dimension. The frequency domain channel performs a two-dimensional discrete cosine transform DCT on the [H, W] feature map to obtain a 1×1×C feature map, which is then passed through two fully connected layers and two activation functions. The ReLu activation function is used after the first FC layer, and the output feature map size is 1×1×C / r. The Sigmoid activation function is used after the second FC layer to normalize the values of each layer to the range of (0, 1) to represent the weight of each channel. Finally, the calculated weight is applied to the main channel output feature map [C, H, W], that is, each channel is multiplied by its own weight. When the weight is large, the value of the channel feature map increases accordingly, and the impact on the final output will also increase; when the weight is small, the value of the channel feature map will be smaller, and the impact on the final output will also decrease.
[0064] The generator of StarGAN simply connects the residual blocks in series, so that when the features are transmitted, they only focus on the information transmitted from the previous layer, while ignoring the information in the previous layer. In a dense network, the input of the later layers comes from all the previous layers, realizing feature reuse. Therefore, this embodiment draws on the idea of dense connection in a dense network, introduces connection operations of different distances between the frequency-attention residual blocks, and constructs a dense frequency-domain attention residual network. The features are reused through a small number of dense connections, ensuring the integrity of the feature information, so that the information pays more attention to the detailed features of different attributes of the face during transmission.
[0065] (2) Discriminator with embedded spectral normalization:
[0066] The discriminator of DFR-GAN is as follows Figure 5As shown. The real image and the generated fake image are sent to the discriminator together, and feature extraction is performed through multiple convolutional layers. Each convolutional layer is followed by a LeakyReLU activation function, and finally two 4×4 convolutional layers are used to output the final result. One output is the authenticity of the image, and the other output is to judge the attribute category of the input image. In this embodiment, spectral normalization is embedded between every two convolutional layers of the discriminator, which improves the stability and convergence speed of the training process.
[0067] (3) Loss function:
[0068] The loss functions of DFR-GAN include adversarial loss, domain classification loss, and reconstruction loss.
[0069] Adversarial loss: In order to make the images generated by the generator difficult to distinguish from real images, an adversarial loss is used, as shown in the following formula:
[0070] L adv =E x [logD src (x)]+E x,c [log(1-D src (G(x,c)))]
[0071] Where x is the input image, c is the target domain label, and D src (x) is the target distribution on the source domain given by the discriminator D.
[0072] Domain classification loss: In order to make the images generated by the generator be correctly classified as the target domain c, the domain classification loss is defined as follows:
[0073]
[0074] Where c' is the original domain corresponding to the input image, D cls (c'|x) represents the probability distribution over domain labels computed by the discriminator D.
[0075] Reconstruction loss. In order to ensure that the converted image only changes the domain-related information in the input image without changing the content of the input image, a reconstruction loss is added:
[0076] L rec =E x,c,c' [||xG(G(x,c),c')||1]
[0077] Total loss: The total loss of optimizing the discriminator and generator is:
[0078]
[0079] Among them, λ cls and λrec are hyperparameters that control the relative importance of domain classification loss and reconstruction loss. In this example and the following verification experiments, λ is used. cls =1,λ rec =10.
[0080] experiment:
[0081] (1) Experimental configuration;
[0082] The experiment uses PyTorch as the framework, the operating system is Ubuntu18.04, and is implemented on NVIDIA GeForce RTX 3080. During training, the batch size is set to 16, the iterations are 300,000 times, and the learning rate is 0.0001.
[0083] (2) Experimental datasets;
[0084] DFR-GAN uses two public datasets: CelebA (CelebFaces Attributes) and RaFD (Radboud Faces Database).
[0085] The CelebA dataset contains 202,599 images of 10,177 people, each of which contains 40 binary facial attribute labels. In this experiment, the original 178×218 images were resized to 128×128, 2,000 images were randomly selected as the test set, and the remaining images were used as training data.
[0086] The RaFD dataset contains 8 expressions of 67 participants, namely anger, disgust, fear, happiness, sadness, surprise, contempt, and neutrality, with a total of 4824 images, 681×1024 in size, shot from five different angles. In order to ensure the integrity of facial expressions, all the images used in the experiment are frontal face images, which are cropped to 256×256 with the face centered. 90% of the dataset samples are used for training and 10% for testing.
[0087] (3) Evaluation indicators;
[0088] DFR-GAN uses Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM) as quantitative evaluation indicators.
[0089] PSNR (Peak Signal-to-Noise Ratio) is an indicator to measure the quality of images, audio and other signals. The unit of PSNR is decibel (dB). The higher the PSNR value, the better the image quality. Its calculation formula is as follows:
[0090]
[0091] Among them, MAX I Indicates the maximum value of the color of the image point. MSE (Mean Squared Error) indicates the average value of the square of the difference between the actual pixel value and the original pixel value. The calculation formula is as follows:
[0092]
[0093] SSIM is used to measure the similarity between images. It takes into account three factors: brightness, contrast, and structure, and is more consistent with the human eye's perception of images. The value range of SSIM is [-1,1]. The closer the value is to 1, the more similar the two images are. The calculation formula of SSIM is as follows:
[0094]
[0095] where x and y are the two images to be compared, μ x and μ y are the mean of the pixel values of x and y, σ x and σ y are the standard deviations of the pixel values of x and y respectively, and c1, c2, and c3 are all constants that make the denominator non-zero.
[0096] (4) Experimental results;
[0097] Figure 6 and Figure 7 These are the visualization results of DFR-GAN on two public datasets, CelebA and RaFD. On the CelebA dataset, this model has a good effect on the conversion of different attributes such as hair color, gender, and age. On the RaFD dataset, it can generate 8 different expressions that are relatively clear and realistic.
[0098] Comparative experiment:
[0099] This example verifies the effectiveness of the proposed model from two perspectives: qualitative evaluation and quantitative evaluation.
[0100] (a) Qualitative assessment;
[0101] Figure 8 This is the visualization result of StarGAN and DFR-GAN on the CelebA dataset. StarGAN changes the background color to some extent when generating blonde hair, while the DFR-GAN model retains the background color well in the conversion of different attributes and does not change other irrelevant attributes.
[0102] (b) Ablation experiment;
[0103] This example uses StarGAN as the benchmark model for ablation experiments. The performance of StarGAN, the model with convolutional block attention, the model with dense frequency domain attention residual network, the model with spectral normalization, and the proposed DFR-GAN are compared on the RaFD dataset. The visualization results of the ablation experiment are shown in Figure 2. Fig. 9 shown.
[0104] When StarGAN generates happy expressions, the corners of the mouth are blurred; when generating surprised expressions, the eyebrows and mouth overlap. After adding the convolutional block attention, the blurred part is improved to a certain extent, but there is still overlap when generating large-scale expressions such as surprise. After adding the dense frequency domain attention residual network, the overlapping part is improved to a certain extent, which helps to generate expression details. After adding spectral normalization, the training becomes stable and the generated expressions are clearer. The proposed DFR-GAN has a certain degree of improvement in the overlapping and blurring of generated expressions. Regardless of the degree of expression change, the generated expressions are more realistic and natural.
[0105] This embodiment also performs a quantitative analysis on the model after adding different components, and calculates their PSNR and SSIM values respectively. As shown in Table 1, the PSNR and SSIM values are gradually increasing, indicating that the quality of the generated image is continuously improving after adding different modules, further illustrating the effectiveness of adding different modules.
[0106] Table 1
[0107]
[0108] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.
Claims
1. A multi-domain image style transfer method based on dense frequency domain attention residual, characterized in that: include: Get the image to be converted and the target style attribute label; The image to be converted and the target style attribute label are input into a preset style transfer model, and a target style image is output, wherein the style transfer model is obtained by training a training set, the training set contains images and attribute labels of several styles, and the style transfer model is constructed by fusing a dense frequency domain attention residual block and a spectral normalized feature extraction block based on the StarGAN network.
2. The image multi-domain style transfer method based on dense frequency domain attention residual according to claim 1 is characterized in that The style conversion model includes a generator and a discriminator. The generator is used to generate a false image based on the image to be converted and the target style attribute label; the discriminator is used to judge and classify the attributes of the image to be converted and the false image, and output the target style image.
3. The image multi-domain style transfer method based on dense frequency domain attention residual according to claim 2 is characterized in that: The generator includes a downsampling module, a dense frequency domain attention residual network, and an upsampling module. The image to be converted and the target style attribute label are downsampled by convolution through the downsampling module, and then feature extracted through the dense frequency domain attention residual network. Finally, they are upsampled by deconvolution through the upsampling module to output a false image that conforms to the target style.
4. The image multi-domain style transfer method based on dense frequency domain attention residual according to claim 3 is characterized in that: A convolutional attention module CBAM is added to both the downsampling module and the upsampling module. The convolutional attention module CBAM is used to enhance the editing capability of the style transfer model for key area attributes.
5. The method for image multi-domain style transfer based on dense frequency domain attention residual according to claim 3, characterized in that: The dense frequency domain attention residual network includes several densely connected residual blocks, and the frequency domain channel attention mechanism FcaNet is introduced into the residual block. The frequency domain channel attention mechanism FcaNet is used to divide the input into multiple parts along the channel dimension and assign a two-dimensional frequency component to each part to obtain a multi-spectrum compression vector.
6. The method for image multi-domain style transfer based on dense frequency domain attention residual according to claim 5, characterized in that: The residual block includes a first convolutional layer, a first normalization layer, a first activation function, a second convolutional layer, a second normalization layer, and a second activation function connected in sequence; The frequency domain channel attention mechanism FcaNet includes a two-dimensional discrete cosine transform layer, a first fully connected layer, a third activation function, a second fully connected layer, and a fourth activation function connected in sequence; The frequency domain channel attention mechanism FcaNet is introduced into the residual block, that is, the frequency domain channel attention mechanism FcaNet is introduced after the second normalization layer of the residual block.
7. The image multi-domain style transfer method based on dense frequency domain attention residual according to claim 2, characterized in that: The discriminator includes a plurality of third convolutional layers and fourth convolutional layers, wherein the third convolutional layers are used to extract features of the image to be converted and the false image layer by layer, a fifth activation function is connected after each third convolutional layer, and spectral normalization is embedded between every two third convolutional layers; The fourth convolutional layer is used to judge the authenticity and attribute category of the image to be converted and the false image based on the features extracted by the third convolutional layer.
8. The method for image multi-domain style transfer based on dense frequency domain attention residual according to any one of claims 1 to 7, characterized in that: The style conversion model is optimized through the loss function during the training process, and the loss function is: Among them, L D is the discriminator loss, L G is the generator loss, L adv is the adversarial loss, λ cls and λ rec is a hyperparameter, is the domain classification loss of the discriminator, is the domain classification loss of the generator, L rec To rebuild the losses.
Citation Information
Cited By
Image restoration method and device, equipment and medium
CN120912483A
Image inpainting method, apparatus, device, and medium
CN120912483B
