# Art Style Transfer of Oil Painting Based on Parallel Convolutional Neural Network

Authors: Xin Jin
Journal: Security and Communication Networks
 (2022)

---

## Abstract

To generate a new ornamental image, add an image’s oil painting style information to any image while preserving the image’s semantic content. With the rapid advancement of deep learning (DL), image style transfer has become one of the most active areas of computer vision research (CV). This paper proposes an oil painting style transfer technique based on parallel convolutional neural networks to address the ineffective style transfer of locally similar regions in content images and the slow processing speed of existing methods. By incorporating Gaussian sampling and a parallelization algorithm, this method effectively transfers the style of an oil painting. The algorithm can combine the content of any image with a variety of well-known oil painting styles to create high-quality works of art. The experimental results indicate that, compared to existing methods, the proposed method can effectively reduce the style loss of the generated image, make the generated image’s overall style more uniform, and produce a more pleasing visual effect.


---

## Body

## 1. Introduction

The oil painting styles known as impressionism, pointillism, and Fauvism are distinct from one another and are frequently referred to by their respective names. The term doctrine encompasses Classicism, Impressionism, Romanticism, Expressionism, Dadaism, and other creative movements (or doctrine of art). Initially, we can observe that these genres bear the imprint of the era in which they were created. Classicism and Neoclassicism coexisted for a time, but they represent distinct phases of art historical development. Impressionism existed prior to Expressionism’s emergence. Cubism emerged in the early twentieth century and evolved gradually over time. In addition, we must remember that multiple genres emerged during the same era and that these eras are inextricably linked. During the twentieth century, there had been numerous distinct painting genres; for instance, styles were reflected in a vast array of musical genres [1–3].The categorizing of music into genres demonstrates how styles change over time. There are numerous diverse painting styles from various historical periods. Medieval and Renaissance art have distinct visual qualities that distinguish them from one another. Given that the average person’s height and weight were quite different in the past, an old man who was raised in the Middle Ages would be surprised to find Renaissance religious artworks depicting the Virgin Mary’s body with a different standard of beauty than the Virgin Mary’s body today [4, 5]. So as time progresses, the style of painting will evolve, resulting in the formation of a new genre. It occurs when a new epoch begins to establish. For the most part, the previous era has not been given enough time to exit the historical stage. When Monet’s Impression of Sunrise (1873) was displayed at the Salon, it was derided as a denial of beauty and reality and as a painting that could only convey an impression. However, it also demonstrates that beauty and truth in certain people’s views at the time were not just a foggy memory. This is how the term Impressionism came about. It is reasonable to argue that different epochs had their own specific aesthetics to distinguish them [6].Changes in painting styles will occur as a result of advancements in science and technology as time progresses. In order for Impressionism to arise, the advancement of color optics was required. In the wake of the application of optical principles and the development of color theory, an artistic movement known as pointillism was established. These proponents believe that feelings should be examined using rational and scientific approaches. In the design of the painting, strive for a sense of harmony and unification between Impressionism and Classicism was present. In response to this trend, futurism and speed became two of the most prominent types of beauty in the industrialized world, respectively. In addition, the introduction and widespread usage of photographic technology had a huge impact on the field.Generally, the average person will be incapable of completing a professional oil painting. As a result of the Internet’s rapid expansion, an increasing number of individuals are using computers to alter the appearance of their photographs. It is possible to convert photographs into oil paintings utilizing professional image editing software such as Photoshop. Picture stylization was utilized for the first time to create a photo editor that combines the styles of multiple oil painting painters into a single image that is both visually appealing and aesthetically pleasing. Due to the efforts of the PRISMA laboratory in Moscow, a free version of Prisma is currently available for download from the Google Play store. In oil on canvas, sexually explicit imagery and other subjects are depicted.In various contexts, the process of imparting a stylized appearance to an image is referred to as style transfer. Using mathematical or statistical models, brushstrokes, and textures as well as other techniques, the classic style transfer method stylizes photographs. Since the middle of the 1990s, computer scientists have been conducting research on visual style transfer. Although this method is limited to dealing with pixel-level image characteristics, it is the only method available at the time of writing. Neural style transfer was developed due to the rapid growth of deep learning and CNN feature extraction (NST) [7, 8] which is an image style transfer technique based on iterative optimization that has achieved significant success and injected fresh life into the field of image style transfer. The cornerstones of related research approaches are image iteration and model generation. By limiting the loss of both substance and style, the first solution solves the problem of styled images. Style loss can be seen in the Gram matrix, maximum mean difference, relaxation optimal transmission distance, and histogram difference, among other things. The loss function for this method, which trains an image modification model on a huge dataset and creates stylized images in the forward pass, can be defined using perceptual loss or Markov random field loss, depending on the circumstances. It is possible to transfer the style of images generated by generative adversarial networks (GANs) such as CycleGAN and DualGAN with great success [9–14]. But the dataset requirements and discriminative algorithms for GAN-based approaches are extremely rigorous. Additionally, because of the model’s lack of flexibility, it is impossible to obtain a generative model that is specific to a particular style according to the model’s setup [15, 16].Some academics have developed an automatic real-time picture abstraction framework that enables users to generate cartoon-style images by adjusting brightness and color contrast, but this framework is limited in its ability to generate images of a variety of styles. Also proposed is the use of two image analogy algorithms, one for the source image and one for the target image. The image analogy technique captures only low-level information, making it difficult to learn how to create a stylistically appropriate target image by comparing source images. We were unable to find a style that worked for me, so the final product is subpar. Other researchers have improved the technique by incorporating edge orientation data throughout the texture transfer procedure [17, 18]. In part, this is due to the fact that these algorithms only operate on low-level image properties found at the pixel level and thus have significant limitations in terms of flexibility, effectiveness, and diversity. Despite the fact that these procedures typically require human parameter adjustment, they are frequently the most efficient when performed properly.Even though the visual performance of the images generated by these methods has been excellent, it is difficult to strike a balance between speed and adaptability in the images generated by the aforementioned techniques. Due to the difficulty of balancing speed and adaptability, the existence of content images is also difficult to grasp. Due to the use of identical areas of the source image to transfer style, which is inconsistent with the overall style of the image, the produced image contains insufficient style feature information. As a result, we offer a CNN-inspired oil painting creative style transfer model. In a model that combines parallel approaches and Gaussian sampling techniques, the VGG network is used as an encoder to retrieve high-level features.


## 2. Related Work

### 2.1. Image Iteration and Generation Methods

By recursively optimizing white noise images, it is possible to create stylized images using a backpropagation method that minimizes both content and style losses in the feature space while maintaining high quality. The Gram matrix was developed by Gatys et al. to describe the visual style of a photograph or other visual medium. They formalized image style transfer as an optimal transfer problem. In addition, they demonstrated that matching the Gram matrix is equivalent in theory to employing the maximum mean difference of the quadratic polynomial kernel. The inherent instability of the Gram matrix is mitigated by the addition of a matching histogram difference, which enhances the visual appearance of stylized images [3, 7, 9]. Gatys also investigated what happens to generated images as a result of perceptual factors during style transfer as well as what happens to generated images afterward. The application of stylized images in real-world scenarios is severely constrained by the sluggishness of iterative optimization processes [10–13] due to the excessively slow rate at which stylized images are generated.Some researchers propose that large-scale datasets can be used to train an image transformation model, solve stylized images in the forward propagation process, and optimize the model parameters rather than the images themselves to improve the generation speed of stylized images. It was decided to abandon the batch normalization method in favor of a normalization method that improves the image conversion model’s quality. Although this method greatly accelerates the generation of stylized images, it requires the use of a conversion model that is tied to a specific style and thus is not very flexible. Alternatively, the results are unsatisfactory. There is no way to use the same model and a few different styles to generate stylized images of multiple styles for more than a few different styles [15–17]. Conditional GAN is also used by some researchers to help them with their research. Loss of L1 as well as loss due to opposition is proposed to use the supervised learning method to create a unified framework for dealing with the image transfer problem. For image style transfer to be successful, the GAN-based method relies on iterative optimization and confrontation based on the overall divergence distribution of images in the dataset. Training should be prioritized over the content, texture, and color of a single photograph. As a result, in order to train an appropriate generation model, a large number of images in a variety of styles must be included in the training set, and the model’s flexibility is severely limited [19–22]. The schematic diagram of the generative GAN is shown in Figure 1.Figure 1
Diagram of GAN.Researchers all over the world have recently focused their attention on the topic of automatic image translation. This question appears to be illogical at first glance due to its reliance on additional conditions. Unsupervised image style transfer, on the other hand, is currently possible using a variety of different approaches. Some researchers have proposed a Bayesian framework that incorporates prior knowledge through the use of Markov random fields and a likelihood term known as the Markov likelihood term [23]. Do not overlook the visual aspect. Another study employs variational autoencoders and coupled generative adversarial networks (GANs) in tandem to map image features from different image domains into a common space, where the generators share weights to learn the joint distribution of cross-domain image features. Cycle-consistent networks, unlike previous methods, do not require the use of a task-specific predefined similarity function between the input and output nor do they require the input and output to be located in the same low-dimensional space. The Internet can be used to convert images into images [24, 25]. CNNs have a vast array of image processing applications and generate the most precise results. DenseNet is the best classic network structure because each layer employs the dense connection method to incorporate the previous layer’s output into the current layer, thereby significantly enhancing the modeling capabilities of the network. Due to its prevalence, DenseNet is the most popular classic network structure. In contrast to ResNet, DenseNet proposes feature sharing, which reduces the number of parameters while avoiding the gradient disappearance defect that plagues conventional neural networks [26, 27, 28]. DenseNet has a number of advantages over ResNet, the most significant being its faster speed.


### 2.2. Encoder-Based Approach

In the model generation approach, there are a number of options. The encoder-decoder model abstracts away three aspects of the image style transmission task: feature extraction, feature transformation, and feature reconstruction. The encoder-decoder model is then used to extract and reconstruct image features using the encoder-decoder model, which is then used to extract and reconstruct image features. A feature transformation that employs an adaptive instance normalization technique, according to certain theories, treats each channel of the feature map as a separate Gaussian distribution, with each channel being used to establish the style of the content feature. Consistency in terms of both the standard deviations of attributes and the means of those traits is necessary; however, the channels of the feature map should be linked together in order to function properly [6, 11, 13]. The WCT feature transformation approach was developed by other researchers, and it considers the feature map as a multivariate Gaussian distribution, with the content features and the style features all treated as Gaussian distribution functions. Some researchers use knowledge distillation to condense the encoder-decoder model employed by these algorithms, which helps to increase the speed and flexibility of feature extraction and reconstruction even more. They also make use of deep feature perturbation to increase the flexibility of the features in their system. In this study, the researchers developed a theoretical formulation for the optimal transmission of feature transformations, improved the feature transformation technique to better preserve the shape of the image content, and utilized style transfer to the fabrication of photorealistic images [17, 19]. Transferring the style from one image to another is challenging, but it is possible to do so successfully. However, this may result in a lack of style or insufficient style in the appropriate portions of the generated image, which is incompatible with the style of the overall image where there is a disparity, as depicted in Figure 2.Figure 2
Inadequate style transfer diagrams.


## 2.1. Image Iteration and Generation Methods

By recursively optimizing white noise images, it is possible to create stylized images using a backpropagation method that minimizes both content and style losses in the feature space while maintaining high quality. The Gram matrix was developed by Gatys et al. to describe the visual style of a photograph or other visual medium. They formalized image style transfer as an optimal transfer problem. In addition, they demonstrated that matching the Gram matrix is equivalent in theory to employing the maximum mean difference of the quadratic polynomial kernel. The inherent instability of the Gram matrix is mitigated by the addition of a matching histogram difference, which enhances the visual appearance of stylized images [3, 7, 9]. Gatys also investigated what happens to generated images as a result of perceptual factors during style transfer as well as what happens to generated images afterward. The application of stylized images in real-world scenarios is severely constrained by the sluggishness of iterative optimization processes [10–13] due to the excessively slow rate at which stylized images are generated.Some researchers propose that large-scale datasets can be used to train an image transformation model, solve stylized images in the forward propagation process, and optimize the model parameters rather than the images themselves to improve the generation speed of stylized images. It was decided to abandon the batch normalization method in favor of a normalization method that improves the image conversion model’s quality. Although this method greatly accelerates the generation of stylized images, it requires the use of a conversion model that is tied to a specific style and thus is not very flexible. Alternatively, the results are unsatisfactory. There is no way to use the same model and a few different styles to generate stylized images of multiple styles for more than a few different styles [15–17]. Conditional GAN is also used by some researchers to help them with their research. Loss of L1 as well as loss due to opposition is proposed to use the supervised learning method to create a unified framework for dealing with the image transfer problem. For image style transfer to be successful, the GAN-based method relies on iterative optimization and confrontation based on the overall divergence distribution of images in the dataset. Training should be prioritized over the content, texture, and color of a single photograph. As a result, in order to train an appropriate generation model, a large number of images in a variety of styles must be included in the training set, and the model’s flexibility is severely limited [19–22]. The schematic diagram of the generative GAN is shown in Figure 1.Figure 1
Diagram of GAN.Researchers all over the world have recently focused their attention on the topic of automatic image translation. This question appears to be illogical at first glance due to its reliance on additional conditions. Unsupervised image style transfer, on the other hand, is currently possible using a variety of different approaches. Some researchers have proposed a Bayesian framework that incorporates prior knowledge through the use of Markov random fields and a likelihood term known as the Markov likelihood term [23]. Do not overlook the visual aspect. Another study employs variational autoencoders and coupled generative adversarial networks (GANs) in tandem to map image features from different image domains into a common space, where the generators share weights to learn the joint distribution of cross-domain image features. Cycle-consistent networks, unlike previous methods, do not require the use of a task-specific predefined similarity function between the input and output nor do they require the input and output to be located in the same low-dimensional space. The Internet can be used to convert images into images [24, 25]. CNNs have a vast array of image processing applications and generate the most precise results. DenseNet is the best classic network structure because each layer employs the dense connection method to incorporate the previous layer’s output into the current layer, thereby significantly enhancing the modeling capabilities of the network. Due to its prevalence, DenseNet is the most popular classic network structure. In contrast to ResNet, DenseNet proposes feature sharing, which reduces the number of parameters while avoiding the gradient disappearance defect that plagues conventional neural networks [26, 27, 28]. DenseNet has a number of advantages over ResNet, the most significant being its faster speed.


## 2.2. Encoder-Based Approach

In the model generation approach, there are a number of options. The encoder-decoder model abstracts away three aspects of the image style transmission task: feature extraction, feature transformation, and feature reconstruction. The encoder-decoder model is then used to extract and reconstruct image features using the encoder-decoder model, which is then used to extract and reconstruct image features. A feature transformation that employs an adaptive instance normalization technique, according to certain theories, treats each channel of the feature map as a separate Gaussian distribution, with each channel being used to establish the style of the content feature. Consistency in terms of both the standard deviations of attributes and the means of those traits is necessary; however, the channels of the feature map should be linked together in order to function properly [6, 11, 13]. The WCT feature transformation approach was developed by other researchers, and it considers the feature map as a multivariate Gaussian distribution, with the content features and the style features all treated as Gaussian distribution functions. Some researchers use knowledge distillation to condense the encoder-decoder model employed by these algorithms, which helps to increase the speed and flexibility of feature extraction and reconstruction even more. They also make use of deep feature perturbation to increase the flexibility of the features in their system. In this study, the researchers developed a theoretical formulation for the optimal transmission of feature transformations, improved the feature transformation technique to better preserve the shape of the image content, and utilized style transfer to the fabrication of photorealistic images [17, 19]. Transferring the style from one image to another is challenging, but it is possible to do so successfully. However, this may result in a lack of style or insufficient style in the appropriate portions of the generated image, which is incompatible with the style of the overall image where there is a disparity, as depicted in Figure 2.Figure 2
Inadequate style transfer diagrams.


## 3. The Proposed Method

For the convenience of expression, the encoder-decoder is abbreviated as EN-DE in this paper. The method in this paper is based on the EN-DE framework and incorporates parallel CNN and Gaussian sampling techniques. The specific framework is shown in Figure3.Figure 3
Framework of our method.The features of the EN are shown as follows:(1)fN=ENαNfN−1.At the intersection of EN and DE, the regional diversified feature transformation strategy is initially employed to combine content features and style features. The structure of DE and EN are identical. In order to reassemble stylized featuresfSN using content and style characteristics, the following formula performs a feature transformation:(2)fFUN=FDEβNfFUN+1,fSN,where fREN is the fusion feature.The final output of DE is(3)IFU=DEβIfFUI.Given an oil painting imageIco and an oil painting style image Ist. Input it into EN for feature extraction and obtain content feature fco and style feature fst. The process of EN extracting image features is regarded as sampling from the Gaussian distribution where the image is located in the feature space process:(4)fco∼Nμco,σco,fst∼Nμst,σst.The feature transformation formula is as follows:(5)fFU=Wfco−μco+μst,where W⋅ is the transformation matrix. Then we have(6)EfFUfFUT=σst,EWfco−μcoWfco−μcoT=σst,EWfco−μcofco−μcoTWT=σst,WσcoWT=σst.Finally, we get the solution of the transformation matrix as(7)W=σst1/2Oσco−1/2,where O is the orthogonal matrix.Due to the nature of their models, it is difficult for existing EN-DE model strategies to effectively transfer style to the content image’s geographically equivalent regions. Locally comparable regions are areas with a single hue and no high-frequency data. Figure4 depicts the reduction of the content characteristics of EN to a two-dimensional space using standard data dimensionality reduction techniques. Using the encoder, it is possible to extract feature vectors from locally similar portions of the image’s content. If you use the encoder for this purpose, the extracted feature vectors will be located in the feature space, where a large number of people are grouped together.Figure 4
Feature maps of locally similar regions.In order to address the aforementioned issues, this paper applies the feature transformation process to style features sampled from the style image’s Gaussian distribution, ensuring that the stacked stylized features are distributed fairly evenly in the feature space before creating the stylized image. Style characteristics of the location are more prominent, making the entire impression more consistent. Then we have(11)fco′=EcoDco−1/2EcoTfco−μco,where Dco−1/2 and EcoT are obtained by singular value decomposition. Coloring transformation of the above formula, we get(12)fFU′=EstDst−1/2EstTfco′+μst.The final feature transformation formula is(13)fFU=εfFU′+1−εR,where R stands for random style features and ε is the weight parameter.


## 4. Results

First, we first determine the weight parametersε.We can determine the degree of geographic variation in our data by modifying the hyperparameters. By increasing the step size by 0.3 each time, the size can be increased from 0 to 0.3. Figure5 depicts the outcomes of the experiments. The local region style of the stylized image tends to diversify as the hyperparameter is increased; however, as the hyperparameter is increased further, the stylized image as a whole tends to diversify. Figure 5 depicts a pattern of observed stylistic diversity. The difference between the value and the actual number is insufficient. As a result of the style feature of the stylized image, the feature vector will undergo a significant change across the entire feature space, which may compromise the content integrity of the image in certain circumstances. If a lot of style components are applied to a lot of different regions of an image, the image’s content may be compromised. On the basis of extensive research, the hyperparameter = 0.3 was designed to improve the performance of the vast majority of inputs. The content of the displayed photographs is unaffected by the region’s transferability.Figure 5
Feature extraction map for differentε.In the DL framework of this paper, the GPU version of PyTorch 0.4.3 is used rather than the CPU version. Facades and monet2photo datasets are used as examples in the datasets. The facades dataset contains approximately two hundred authentic images and two hundred semantic images that can be used for both training and testing. The images within the monet2photo dataset can be categorized as either landscape or portrait. The photographs in the training set are a combination of Monet-inspired oil paintings and digitally captured landscapes. There are 512512 images in the Monet oil painting style training set, while there are 1500 images in the landscape painting style training set. It is estimated that there are 8,500 512512 images in the test set. There are two distinct types of images included in the test set. In the test set for Monet’s oil painting style, 256256 images were used, while 800 256256 images were used for the landscape style.As part of the training process to generate both semantic and real-world imagery, images in the Monet, Van Gogh, and landscape painting styles are utilized. Compared to the older cycle consistency network training method, the method outlined in this study requires only 42 minutes per iteration.Comparing WCT and CycleGAN outputs for converting Monet’s oil painting styles and landscape styles to each other using the facades and vangogh2photo datasets, respectively, is said to demonstrate the generalization potential of the model. Figure6 compares the oil painting and landscape painting styles of Claude Monet. The first column contains the image input, the second column contains WCT, the third column contains CycleGAN, and the fourth column contains this method. The purpose of this article is to transform Claude Monet-style oil paintings into landscapes. When experimental results are as similar as possible to the real-world condition being studied, the effectiveness of the results increases. Although WCT in Figure 6 transforms the straw pile into an oil painting while retaining the red hue and distorting the CycleGAN results, the approach utilized in this piece is more similar to the actual khaki color, and the shape has not been altered. The results obtained by CycleGAN and WCT in the second row indicate that the color of sea water is green. In terms of sky color and grass detail, it has been demonstrated that the findings generated by this research are superior to those obtained by the two previous methods.Figure 6
Comparative experiments of different methods on the Monet-style dataset.The photographs in Figure7 were taken during field studies of landscape-type datasets. To transform a landscape photograph into an image resembling a Monet oil painting, it is necessary to first understand the style. Figure 7 demonstrates that the images generated by CycleGAN and WCT are akin to altering the landscape’s hue. The first row of green trees lacks strong details and the second row’s background colors lack good generation. The three rows of roadside flowers had vanished for whatever reason. This study’s methodology yields results that more closely resemble an authentic oil painting while retaining a greater number of minute details.Figure 7
Comparative experiments of different methods on the landscape-type dataset.Also selected is the FID evaluation indicator [7, 14, 26]which measures the distance between generated and real images in feature space. When the FID score is lower, indicating a better match between the generated and actual data distributions, an image that is more aesthetically pleasing is produced. Figure 8 depicts the comparison of average FID scores. Clearly, our analysis outperforms the competing algorithm when both datasets are considered.Figure 8
Comparison of different algorithms on FID indicators.


## 5. Conclusion

The oil painting style information from one image can be applied to another image to create a new ornamental image while preserving the original’s semantic content. As a result of the rapid growth of DL, image style transfer has become a hot topic in CV. This paper proposes an oil painting style transfer technique based on parallel convolutional neural networks to address the shortcomings of existing methods in transferring style to locally similar regions in content images as well as the slow processing speed. Utilizing a Gaussian sampling and parallelization algorithm permits the efficient transfer of the oil painting style. By combining any image with a variety of well-known oil painting styles, the algorithm enables the creation of high-quality works of art. Experiment results indicate that the proposed method effectively reduces style loss in the generated image and produces a more pleasing visual effect than existing methods [27, 28].



---

*Source: 5087129-2022-07-30.xml*