Face2webtoon
Introduction
Despite its importance, there are few previous works applying I2I translation to webtoon. I collected dataset from naver webtoon 연애혁명 and tried to transfer human faces to webtoon domain.
Webtoon Dataset
I used anime face detector. Since face detector is not that good at detecting the faces from webtoon, I could gather only 1400 webtoon face images.
Baseline 0(U-GAT-IT)
I used U-GAT-IT official pytorch implementation. U-GAT-IT is GAN for unpaired image to image translation. By using CAM attention module and adaptive layer instance normalization, it performed well on image translation where considerable shape deformation is required, on various hyperparameter settings. Since shape is very different between two domain, I used this model.
For face data, i used AFAD-Lite dataset from https://github.com/afad-dataset/tarball-lite.
Some results look pretty nice, but many result have lost attributes while transfering.
Missing of Attributes
Gender
Gender information was lost.
Glasses
A model failed to generate glasses in the webtoon faces.
Result Analysis
To analysis the result, I seperated webtoon dataset to 5 different groups.
group number | group name | number of data |
---|---|---|
0 | woman_no_glasses | 1050 |
1 | man_no_glasses | 249 |
2 | man_glasses | 17->49 |
3 | woman_glasses | 15->38 |
Even after I collected more data for group 2 and 3, there are severe imbalances between groups. As a result, model failed to translate to few shot groups, for example, group 2 and 3.
U-GAT-IT + Few Shot Transfer
Few shot transfer : https://arxiv.org/abs/2007.13332
Paper review : https://yun905.tistory.com/48
In this paper, authors successfully transfered the knowledge from group with enough data to few shot groups which have only 10~15 data. First, they trained basic model, and made branches for few shot groups.
Basic model
For basic model, I trained U-GAT-IT between only group 0.
Baseline 1 (simple fine-tuning)
For baseline 1, I freeze the bottleneck layers of generator and tried to fine-tune the basic model. I used 38 images(both real/fake) of group 1,2,3, and added 8 images of group 0 to prevent forgetting. I trained for 200k iterations.
Model randomly mapped between groups.
Baseline 2 (group classification loss + selective backprop)
I attached additional group classifier to discriminator and added group classification loss according to original paper. Images of group 0,1,2,3 were feeded sequentially, and bottleneck layers of generator were updated for group 0 only.
With limited data, bias of FID score is too big. Instead, I used KID
KID*1000 |
---|
25.95 |
U-GAT-IT + group classification loss + adaptive discriminator augmentation
ADA is very useful data augmentation method for training GAN with limited data. Although original paper only handles unconditional GANs, I applied ADA to U-GAT-IT which is conditional GAN. Augmentation was applied to both discriminators, because it is expected that preventing the discriminator of the face domain from overfitting would improve the performance of the face generator and therefore the cycle consistency loss would be more meaningful. Only pixel blitting and geometric transformation have been implemented, as the effects of other augmentation methods are minimal according to paper. The rest will be implemented later.
To achieve better result, I changed face dataset to more diverse one(CelebA).
ADA makes training longer. It took 8 days with single 2070 SUPER, but did not converged completely.
KID*1000 |
---|
12.14 |
Start training
python main.py --dataset dataset_name --useADA True --group 0,1,2,3 --use_grouploss True --neptune False
If --neptune is True, the experiment is transmitted to neptune ai, which is experiment management tool. You must set your API token. --group 0,1,3 make group 2 out of training.