Skip to content
Twin-GAN -- Unpaired Cross-Domain Image Translation with Weight-Sharing GANs
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
datasets Open Sourcing! Jul 18, 2018
demo Adds web interface. Sep 25, 2018
deployment Open Sourcing! Jul 18, 2018
inference Remove duplicate import of "os". Aug 12, 2018
interface Fix small bug where images with the same id are not updated under web… Oct 14, 2018
libs Open Sourcing! Jul 18, 2018
model Fixes wrong training script and some comments * 2 Aug 8, 2018
nets Fixes wrong training script and some comments. Aug 7, 2018
requirement.txt adding fix for cannot import util_io and adding requirement.txt for p… Aug 10, 2018 Open Sourcing! Jul 18, 2018

TwinGAN -- Unsupervised Image Translation for Human Portraits

result identity_preservation search_engine search_engine

Use Pretrained Model.

We provide two pre-trained models: human to anime and human to cats.

Run the following command to translate the demo inputs.

python inference/ \

The input_image_path can be either one single image or a path containing images.

For more information, see the documentation on inference and eval and on the web interface.


Download CelebA and the Getchu dataset by following the datasets guide. Then train your model using script from the training guide.

Blog and Technical report.

An English blog and a Chinese 中文 blog are published in early April 2018 and are available for readers with less technical background.

Network setup: network_structure

Conv layer structure: network_structure

Please refer to the technical report for details on the network structure and losses.

Extra materials:

Presentation Slides at Anime Expo 2018

Related works

Our idea of using adaptive normalization parameters for image translation is not unique. To the best of our knowledge, at least two more work have similar ideas: MUNIT and EG-UNIT. Our model is developed around the same time period as these models.

Some key differences between our model and the two mentioned are -- we find UNet to be extremely helpful in maintaining semantic correspondence across domain, and we found that sharing all convolution filter weights speeds up training while maintaining the same output quality.


More documentations can be found under docs/


A lot of the code are adapted from online. Here is a non-exhaustive list of the repos where I borrowed code from extensively.

TF-Slim image models library


Anime related repos and datasets

Shameless self promotion of my AniSeg anime object detection & segmentation model.

Sketch coloring using PaintsTransfer and PaintsChainer.

Create anime portraits at Crypko and MakeGirlsMoe

The all-encompassing anime dataset Danbooru2017 by gwern.

My hand-curated sketch-colored image dataset.


This personal project is developed and open sourced when I am working for Google, therefore you see Copyright 2018 Google LLC in each file. This is not an officially supported Google product. See License and Contributing for more details.

You can’t perform that action at this time.