POSTECH-CVLab / PyTorch-StudioGAN

StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.
https://github.com/MINGUKKANG
Other
3.42k stars 342 forks source link

classes confusion #20

Closed Johnson-yue closed 3 years ago

Johnson-yue commented 4 years ago

Hi , I found a interesting thing, about 'classes confusion'

I train the font dataset , which contain 50 content classes and 755 different style samples every content class. data | - content_1 | - | --- style1_char | - | --- style755_char | - content_2 | - | --- style1_char | - | --- style755_char

and I used contraGAN trained with big_resnet network, but the result is very interesting. Screenshot from 2020-09-17 10-48-41

log is here: ContraGAN_font50-train-2020_09_16_09_48_12.log

Every line must be the same class, but it not, why ??

mingukkang commented 4 years ago

Hi Johnson:)

Conditional GANs(ACGAN, ProjGAN, and ContraGAN) sometimes confront the class confusion problem.

I think this is because there are many classes to train but, less dataset.

To alleviate this problem, you can raise the temperature of contrastive learning, which will lead the contrastive learner to give higher gradients to the discriminator. Also, you can control the margin coefficient to push and pull all datasets equally.

Especially, I recommend you to set the start_tempearue: 2, end_temperature: 1, tempering_step: 1, tempering_type: "discrete", and margin: 1.

Thank you!

Sincerely,

Minguk Kang

mingukkang commented 4 years ago

Incidentally, your model seems to suffer from overfitting right now.

It's a good idea to plot the generated image canvas using the best moment checkpoint.

The command is as follows(Plz git pull first!):

CUDA_VISIBLE_DEVICES=0 python3 main.py -iv -std_stat --standing_step STANDING_STEP -c CONFIG_PATH --checkpoint_folder CHECKPOINT_FOLDER --log_output_path LOG_OUTPUT_PATH

Also, DiffAugment is a great choice to overcome overfitting!

I will keep my fingers crossed for you!