Semi-Supervised Image-to-Image Translation
Manan Oza, Himanshu Vaghela, Sudhir Bagul

TL;DR
This paper introduces a semi-supervised, adversarial neural network model for image-to-image translation that preserves content and realism without relying on segmentation or extensive supervision.
Contribution
The proposed model is a semi-supervised, GAN-based approach that is independent of segmentation and content/style features, improving realism and content preservation in image translation.
Findings
Outperforms Multimodal Unsupervised Image-to-Image Translation
Produces more realistic and content-preserving translations
Operates independently of image segmentation
Abstract
Image-to-image translation is a long-established and a difficult problem in computer vision. In this paper we propose an adversarial based model for image-to-image translation. The regular deep neural-network based methods perform the task of image-to-image translation by comparing gram matrices and using image segmentation which requires human intervention. Our generative adversarial network based model works on a conditional probability approach. This approach makes the image translation independent of any local, global and content or style features. In our approach we use a bidirectional reconstruction model appended with the affine transform factor that helps in conserving the content and photorealism as compared to other models. The advantage of using such an approach is that the image-to-image translation is semi-supervised, independant of image segmentation and inherits the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Semi-Supervised Image-to-Image Translation
Manan Oza
Department of Computer Engineering
*D. J. Sanghvi College of Engineering
*Mumbai, India
Himanshu Vaghela
Department of Computer Engineering
*D. J. Sanghvi College of Engineering
*Mumbai, India
Prof. Sudhir Bagul
Department of Computer Engineering
*D. J. Sanghvi College of Engineering
*Mumbai, India
Abstract
Image-to-image translation is a long-established and a difficult problem in computer vision. In this paper we propose an adversarial based model for image-to-image translation. The regular deep neural-network based methods perform the task of image-to-image translation by comparing gram matrices and using image segmentation which requires human intervention. Our generative adversarial network based model works on a conditional probability approach. This approach makes the image translation independent of any local, global and content or style features. In our approach we use a bidirectional reconstruction model appended with the affine transform factor that helps in conserving the content and photorealism as compared to other models. The advantage of using such an approach is that the image-to-image translation is semi-supervised, independant of image segmentation and inherits the properties of generative adversarial networks tending to produce realistic. This method has proven to produce better results than Multimodal Unsupervised Image-to-image translation.
Index Terms:
GANs, image-to-image translation, style transfer
I Introduction
Image-to-image transfer has established itself as an important domain in computer vision since the first paper published by Gatys et al. [1]. Also known as Neural Style Transfer, it has had many variations over the years, image colorization [14], style transfer [1], image-to-image transfer [3] and so on. For which generally deep neural networks have been used with architectural variances. For instance, we can make a day time image (also known as the content image) of a city look like a night time image by selecting the appropriate style (reference) image. Likewise we can have diverse types of features transfered from one image to another which include time, color, seasonal translations as well.
Image-to-image translation is the process of translating one image onto another while preserving the content and photorealism of the original content image. Deep-learning techniques have proved excellent in faithful and photorealistic style translation [1, 2, 3, 7]. Our approach is built upon the idea of generative adversarial networks introduced by Goodfelow et al. [8]. The underlying concept of such a neural network architecture is that a GAN consists of a generator and a discriminator. The discriminator is trained to identify real images while the generator tries to fool the discriminator by creating counterfiet images from noise and passes them on to the discriminator. Which then returns a verdict on how close the counterfiet images are to a real one. Based on this feedback the generator improves itself and creates another image and the cycle repeats.
Here in our paper we make use of an improvised GAN architecture appended with an Affine Loss factor calculated from a Matting Laplacian matrix [6] in the final loss function. This additionl factor helps in maintaining spatial integrity and preserve photorealism in the content image. Since generative adversarial networks create images from noise they are prone to distortions and noisy images but provide with the biggest advantage, they do not form the basis of simple color and style mapping. They recreate the content image with the style variations.
II Related Work
Image-to-image style transfer has reached state-of-the-art [2, 3, 7] results. The current existing algorithms work in either of the two broadly divided classes: local translation and global translation. But neither of the algorithms excel in both photorealism and faithful style translation at the same time and for all test cases. One or the other factor gets compromised. Global stylization methods work by matching statistical factors of the pixel values [11] whereas local stylization is achieved by algorithms that find close and consistent relations between pixel values of the content and style images. Another classification is based on the algorithm’s ability to translate low-level and (or) high-level features. Low-level features translation involves preservation of the intricacies in the content image while modifying the color or position with respect to the style image. Whereas high-level feature translation is the mapping of broader features which by example means day to night, summer to winter translations.
The best works proposed by Luan et al. [2] and Li et al. [7] are based on the paradigm of matching the gram matrices and makes use of semantic segmentaions of the content and style images. Which take in only the content and style images as the inputs for the network. These algorithms perform post-processing like affine smoothing techniques thereby drastically improving the quality of the resultant images. Such methodologies make use of segmented images derived from the content and style images and then perform style translations from one segment to another by comparing the gram matrices of the input images. Other such algorithms based on a similar paradigm are proposed by Gatys et al. [1], Huang et al. [2] and many others, [1, 7, 12].
Promising results have been showcased by various GAN architectures namely Pix2pix by Isola et al. [13], Unsupervised Image-to-image Translation by Liu et al. [4], CycleGAN and BicycleGAn by Zhu et al. [5]. All of which take in a dataset consisting of multiple images similar to the content and the style domain. Multimodal Unsupervised Image-to-Image Translation by Huang et al. [3] provides an approach to the problem by narrowing down the content domain to only one image and a number of style images which constitute the style latent code [3]. They have proposed that to make the translation unsupervised the syle images are decomposd into a common style latent space. The content space is sampled from this style space based on a conditional distribution to perfom the translation.
In our proposal we narrow down our method to one content and one style image which does not make it completely unsupervised as there is only one target style image. We use the same architecture as proposed by Huang et al. [3] with an additional affine loss factor added to the loss function which adds to the smoothness and faithful style transfer which are combined with the properties of generative adversarial networks.
III Methodology
In addition to the model proposed by Huang et al. [3] we add the local affine transfrom also known as the photorealism factor of the content image calculated from the Matting Laplacian matrix proposed by Levin et al. [6].
III-A Assumptions
All assumptions are exactly the same as that made in the paper Multimodal Unsupervised Image-to-Image Translation by Huang et al. [3] which are as follows. The model assumes that the content and style images are composed of distinct image spaces * * where is the image and is its corresponding image space. Here our goal is to estimate the conditional distributions and leading to the learned translation models and respectively given that and are the marginal distributions of and respectively.
We make another assumption that * * is composed of a content latent space * * and a style latent space * * corresponding to every image from the dataset. Thus two images are generated from the individual generators by and . and are generator functions with and being their inverse encoders where and . Hence our aim is to train the encoder and generator functions using neural networks.
III-B Matting Laplacian
Image matting is the process of extracting the foreground and the background from an image with minimal possible user intervention. The Matting Laplacian [6] process produces an alpha matte which is the segmented image with the foreground object in white and the background in black or vice versa as per the requirements. Using this matting laplacian matrix we calculate the local affine transform factor also known as the photorealism factor.
[TABLE]
It is a summation of the affine losses of all the three channels of the image. is the least-squares penalty function that is dependant on the input image I. The dimensions of the matrix are (N N) and is the vectorized format of the input image O in the channel c having dimensions (N 1). Thus this factor proves crucial in preserving the photorealism and the content image in our proposal.
III-C Model
Our model given in figure 3 constitutes an encoder and a decoder and respctively for every domain , in our case = 1, 2. The encoder is factorized from the content and style latent codes and .
[TABLE]
Thus for image-to-image translation we interchange the encoders and decoders i.e. for translation we make use of the content code = and a randomly drawn style latent code from . Subsequently we use the decoder to generate the image.
[TABLE]
The loss function is composed of two factors, the bidirectional reconstruction loss and the adversarial loss. The bidirectional reconstruction loss is added to make sure that there is a two way reconstruction of images in the directions, image latent image and latent image latent. The image reconstruction loss is computed as the difference between the image reconstructed from the latent spaces and of image and the image which is given by (it is similar to for the image ):
[TABLE]
The latent reconstruction loss is the difference between the content encoding of the generated image and the content encoding of the image and is the difference between the style encoding of the generated image and the style encoding of the image they are given by the equations (which are similar for and ):
[TABLE]
[TABLE]
Here is defined as the prior (0, I) and is defined as where .
Since we use a GAN framework we encounter an adversarial loss which is supposed to be minimised so that the generated images are as identical as possible to the original images. This loss is given by:
[TABLE]
Here is the discriminator function that distinguishes between the real image and the translated images. The discriminator function and loss are defined in a similar way.
As mentioned earlier the architecture we use is essentially the same as that was proposed by Huang et al. [3]. The only difference being that in our approach we use only one style image and add the affine transform loss in the overall loss function. We assume [2] that the input images are photorealistic and we do not have to lose this property. Thus we penalize the loss fuction with the photorealism factor so as not to lose this property while minimizing the reconstruction losses from the image, content and style latent spaces. The overall loss fuction proposed by us is given by:
[TABLE]
Where , , are the weights that control the reconstruction, and is the photorealism regularization weight [2].
III-D Analysis
Our goal is to minimize the loss function defined in equation (8). This minima is the optimal state of of our model and at this point the following states are achieved:
[TABLE]
[TABLE]
[TABLE]
[TABLE]
The equation (12) is different from the one proposed by Huang et al. [3] because our model adds the local affine loss of the content images. Our model is constructed in such a way that when is the content image is taken as the style image and vice versa. Which is why the local affine loss of both the images is taken into consideration in equation (8) and also the content marginal distributions are added and taken into account when comparing the joint distributions and . At this state the content marginal distributions and also become equal. Also at this optimal state the style marginal distributions are equal to their prior distributions . The fact that we use one one-to-one image mapping makes our process sound like it follows the supervised learning paradigm, but it does not. Even though we have only one image in the content and style domain the images are encoded into a content and style latent space and translated on the basis of conditional probability. Thus our method is free from any deterministic translations as performed by the methods [1, 2, 7, 12, 14] which make use of image segmentation that helps in mapping regions of interest in both the content and style images.
IV Implementation Details
We have adapted the publicly available pytorch implementation of Multimodal Unsupervised Image-to-image Translation [3]. The architecture consists of an auto-encoder (generator) and a discriminator. The auto-encoder comprises of a separate content and style encoder and a combined decoder. The auto-encoder architecture consists of the following layers:
- •
The content encoder whose content makes up the content latent space (in the listed order):
- –
7 7 convolutional block with stride 1 and 64 filters.
- –
4 4 convolutional block with stride 2 and 128 filters.
- –
4 4 convolutional block with stride 2 and 256 filters.
- –
4 residual blocks each consisting of two 3 3 convolutional blocks with 256 filters.
- •
The style encoder whose output is added to the style latent space (in the listed order):
- –
7 7 convolutional block with stride 1 and 64 filters.
- –
4 4 convolutional block with stride 2 and 128 filters.
- –
3 4 4 convolutional block with stride 2 and 256 filters.
- –
Global average pooling layer.
- –
Fully connected layer with 8 filters.
- •
The decoder which reconstructs an image from the content and style latent code (in the listed order):
- –
4 residual blocks each consisting of two 3 3 convolutional blocks with 256 filters.
- –
2 2 nearest-neighbour upsampling layer followed by a 5 5 convolutional layer with stride 1 and 128 filters.
- –
2 2 nearest-neighbour upsampling layer followed by a 5 5 convolutional layer with stride 1 and 64 filters.
- –
7 7 convolutional block with stride 1 and 3 filters.
The discriminator used is a multi-scale discriminator proposed by Wang et al. [9] which makes use of the LSGAN objective function proposed by Mao et al. [10]. This helps to pilot the generator towards producing realistic and perfom effective translation while preserving the content. The architecture consists of the following layers in the listed order:
- •
4 4 convolutional block with stride 2 and 64 filters.
- •
4 4 convolutional block with stride 2 and 128 filters.
- •
4 4 convolutional block with stride 2 and 256 filters.
- •
4 4 convolutional block with stride 2 and 512 filters.
We use the python implementation to compute the Matting Laplacian matrix [16] from the tensorflow implementation of Deep Photo Style Transfer [2]. The image, content and style reconstruction weights and the photorealism regularization weight are experimentally set to = 10, = 1, = 1 and = [2] respectively. Our implementation is available on .
V Results
Our dataset is composed of only two 3 channel images with resolution 256 256. Thus we use a batch size of 1. Furthermore for every iteration both the images from the dataset are used once to train the respective parts of the network. At once when one image is used as the content image the other one is used as the style image and vice versa thereby completing the bidirectional reconstruction process. All images used for experimental purposes are taken from the implementation of Deep Photo Style Transfer [2].
The images fig. 4e, 4f, 4k, 4l, 4q and 4r shown in fig. 4 are the results generated from our code whereas the images 4c, 4d, 4i, 4j, 4o and 4p are the results generated using the code of Huang et al. [3]. The results shown by us are the optimal results beyond which the images tend to converge to their respective style images. The optimal solution is the one where the resultant image holds the properties of both the content and style images while still being recognised by the discriminator as a constituent image of the dataset. This optimal state is mentioned in eq. (12).
This optimal state clearly shows an improvement in content preservation and image smoothness over the proposal of Huang et al. [3]. It is achieved due to the addition of the affine transform factors and . Thus our proposed methodology generates results that are better in comparison to the results from the method used by Huang et al. [3].
VI Conclusion
We have proposed an architecture that performs the task of unsupervised image-to-image translation with better accuracy and results. The future work includes reducing the noise and making the results more accurate even for low resolutions. Another future scope lies in broadening this architecture for the generation of music, text and videos.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] L. A. Gatys, A. S. Ecker, and M. Bethge. Image style transfer using convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2414–2423, 2016.
- 2[2] Luan, F., Paris, S., Shechtman, E., Bala, K.: Deep photo style transfer. In: CVPR. (2017)
- 3[3] Huang, X., Liu, M.Y., Belongie, S., Kautz, J.: Multimodal unsupervised image-toimage translation. In: ECCV. (2018)
- 4[4] Liu, M.Y., Breuel, T., Kautz, J.: Unsupervised image-to-image translation networks. In: NIPS. (2017)
- 5[5] Almahairi, A., Rajeswar, S., Sordoni, A., Bachman, P., Courville, A.: Augmented cyclegan: Learning many-to-many mappings from unpaired data. ar Xiv preprint ar Xiv:1802.10151 (2018)
- 6[6] A. Levin, D. Lischinski, and Y. Weiss. A closed-form solution to natural image matting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(2):228–242, 2008.
- 7[7] Y. Li, M.-Y. Liu, X. Li, M.-H. Yang, and J. Kautz, “A closed-form solution to photorealistic image stylization,” ar Xiv:1802.06474, 2018.
- 8[8] Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., Bengio, Y.: Generative adversarial nets. In: NIPS. (2014)
