Photorealistic Style Transfer for Videos

07/01/2018 ∙ by Michael Honke, et al. ∙ 0

Photorealistic style transfer is a technique which transfers colour from one reference domain to another domain by using deep learning and optimization techniques. Here, we present a technique which we use to transfer style and colour from a reference image to a video.



There are no comments yet.


page 1

page 2

page 3

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

It entails huge amount of time for a professional artist to re-draw an image manually in a particular artistic style. Far more difficult than this is to accomplish this task for a certain video sequence. Nowadays, the advancement in computing technology has revolutionalized many aspects of problem solving. In this project we show how to transfer the style from one photorealistic image to a whole video sequence using deep learning. We make use of two of the most prominent works in style transfer which are as follows:

  • Ruder et al. [1] - They portrayed a technique which enables to transfer the style from an artistic image (for instance, a painting) to a complete video sequence. Basically, they extended the previous research by Gatys et al. [2] and Johnson et al. [3] to complete video sequences. Their technique transferred the style captured from an artistic image to the entire video. They deduced that independently processing each frame of the video leads to glimmering and untrue irregularities. This was because the solution of the style transfer task was not steady. With the goal of stabilizing the transfer process and preserving an even changeover between independent video frames, they established a temporal constraint that penalized divergence between two consecutive frames. The temporal constraint introduced by them considered the optical flow present in the original video and in place of inflicting a penalty to the deviations from the previous frame, they applied penalty to the divergence along the trajectories of points. The regions which were not concealed and the boundaries of the motion were eliminated from the penalizer. This imparted the liberty to rerender the unconcealed regions and deformed motion boundaries while conserving the look of the rest of the image.

  • Luan et al. [4] - They portrayed a deep-learning technique particularly for style transfer in photorealistic images that was able to control a huge diversity of image content while reliably transplanting the style from reference image. Their cardinal contribution was to impel the process of conversion from the input to the output to be locally affine in colorspace, and to depict this restriction as a custom and completely differentiable loss function (which they call as energy term). They proved that their technique successfully subdues the deformations and produces convincing photorealistic style transfers in a wide variety of outlines, including transfer of the parameters like time of day, season, weather and artistic edits. They utilised the Matting Laplacian to restrict the conversion from the input to the output to be locally affine in colorspace. Furthermore, they used semantic segmentation which instigated more meaningful style transfer.

In the implementation of this project we merge the loss functions used by Luan et al. [4] and Ruder et al. [1] to get a cumulative loss function used for optimizing the style transimmision from photorealistic image to video.

2 Loss Functions

  • Ruder et al. [1] - The main aim is to render a stylized image x describing the style of an image a and the content of an image p. Gatys et al. [2] devised an energy minimization problem consisting of a content loss and a style loss. The central concept is that attributes extracted by a convolutional neural network contain details about the content of the image, whereas the correlations of these attributes store the details related to style. Johnson et al. [3] depicted that in lieu of solving an optimization problem, a faster technique would be to straightaway learn a function for style transfer for one specific style mapping through an input image to its corresponding stylized image. Convolutional Neural Network could be used to express such a function using the parameters w. The expected loss can be minimized by tranining the network over a random image. Ruder et al. proposed two losses by considering the approaches proposed by Gatys and Johnson:

    • Short term loss:

      where i denotes index of a frame, f(i) is the ith frame of the video, a is the style image, x(i) is the ith

      stylized frame to be generated , c denotes weight, w is the function that warps a given frame using the optical flow field that was estimated between two images.

    • Long term loss:

      all other notations are same as defined previously, J denote the set of indices each frame should take into account relative to the frame number, e.g., with J = 1, 2, 4, frame i takes frames i1, i2, and i4 into account.

    In both of the above short and long term losses, Lcontent and Lstyle are defined by Gatys et al. [2]

  • Luan et al. [4] - Apart from the Lcontent and Lstyle described above, they explained how to regularize these losses to preserve the structure of the input image and generate outputs that are photorealistic. Rather than directly imposing this constraint on the output image they applied it on the transformation which has been applied to the input image. Describing the space of photorealistic images is a probelm that remains unsolved. However, the authors proposed that we don’t actually require to solve it if we leverage the fact that the input that would be fed into the model is already photorealistic. Their plan was to assure that this fact should not get lost during the transfer process by attaching a term to the equation of original loss function which penalizes image deformations. The proposed solution was to search for the transform of an image that is locally affine in color space. That means to search a function such that for every output spot there exists an affine function that maps the corresponding RGB components in input to their output equivalents. They build upon the Matting Laplacian of Levin et al. [5]. They came up with the following Loss function:

    where Mi is a standard linear system that only depends on the input image I and Vc

    [O] is the vectorized version (N × 1) of the output image O.

    One limitation of the style loss presented by Gatys et al. [2] was that the Gram matrix is computed over the entire image. A precise distribution of neural responses is completely encoded by Gram matrix as it computes its vector components uptill an isometry. However, this can cause “spillovers” as that limits its power to adapt to variations in semantic context. The solution to this problem was that keeping the set of labels constant (i.e. sky, buildings, water, etc.) we can render image segmentation masks for both the input as well as reference images. This solution was similar to Neural Doodle [6] and semantic segmentation method [7]. Hence, they included the masks to the input image as supplementary channels and by appending the segmentation channels they built up the neural style algorithm. Finally that style loss was updated as follows

    where C is the number of channels in the semantic segmentation mask. Finally they formulated the photorealistic style transfer loss function by combining all 3 components losses together as:

    where L is the total number of convolutional layers and l indicates the lth convolutional layer of the deep neural network, is a weight that controls the style loss. and are the weights to configure layer preferences. is a weight that controls the photorealism regularization.

3 Merging and Challenges

To implement the style transfer from one photorealistic image to a whole video sequence using deep learning we merged the concepts from both the works i.e from Ruder et al. [1] and Luan et al. [4]. Precisely, we accomplished this in two parts:

  • We integrate the the loss functions used in style transfer in photorealistic images [4] to the loss functions used in artistic style transfer in videos [1].

  • The semantic segmentation used by Luan et al. [4] was done manually. We use the semantic segmentation technique proposed by Zhou et al. [7]. This helped us to automate the task of segmentation which can then be used in computing the overall loss for the videos.

4 Results

5 References

[1] Ruder, M., Dosovitskiy, A., & Brox, T. (2016, September). Artistic style transfer for videos. In German Conference on Pattern Recognition (pp. 26-36). Springer International Publishing.

[2] Gatys, L. A., Ecker, A. S., & Bethge, M. (2016). Image style transfer using convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (pp. 2414-2423).

[3] Johnson, J., Alahi, A., & Fei-Fei, L. (2016, October). Perceptual losses for real-time style transfer and super-resolution. In European Conference on Computer Vision (pp. 694-711). Springer International Publishing.

[4] Luan, F., Paris, S., Shechtman, E., & Bala, K. (2017). Deep Photo Style Transfer. arXiv preprint arXiv:1703.07511.

[5] A. Levin, D. Lischinski, & Y. Weiss. A closed-form solution to natural image matting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(2):228–242, 2008.

[6] S. Bae, S. Paris, & F. Durand. Two-scale tone management for photographic look. In ACM Transactions on Graphics (TOG), volume 25, pages 637–645. ACM, 2006

[7] Zhou, B., Zhao, H., Puig, X., Fidler, S., Barriuso, A., & Torralba, A. (2017). Scene parsing through ade20k dataset. In Proc. CVPR.