Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about other models #27

Open
Anecdote-Lee opened this issue Apr 11, 2024 · 8 comments
Open

Question about other models #27

Anecdote-Lee opened this issue Apr 11, 2024 · 8 comments
Assignees
Labels
question Further information is requested

Comments

@Anecdote-Lee
Copy link

Hello,
I am using this model to train and test my datasets.
Like the paper of this code, I want to compare this model with other models such as CycleGAN or other GANs.
Is there any provided code in this github to run other models to compare?
(The reason why I thought it is provided is that I saw 'model' parameter to select)
캡처

@usert5432
Copy link
Collaborator

Hi @Anecdote-Lee,

We have documents how to run alternative GAN models here: https://github.com/LS4GAN/benchmarking . Please, check out that repository -- it has information on how we trained and evaluated models in CelebA and Anime datasets.

As for the CelebA-HQ and AFHQ datasets -- we relied on the results reported by EGSDE.

@usert5432 usert5432 self-assigned this Apr 11, 2024
@usert5432 usert5432 added the question Further information is requested label Apr 11, 2024
@Anecdote-Lee
Copy link
Author

Good, thank you!

@Anecdote-Lee
Copy link
Author

Anecdote-Lee commented Apr 22, 2024

Hello again! @usert5432
I have few more questions about the codes.

  1. In pretrain_anime2selfie.py, it is training dataset with 2 domains.
    However in other pretraining codes, they don't use any domains even though they also have several domain. What's difference between them?
    (

    args_dict = {
    'batch_size' : cmdargs.batch_size,
    'data' : {
    'datasets' : [
    {
    'dataset' : {
    'name' : 'cyclegan',
    'domain' : domain,
    'path' : 'anime2selfie',
    },
    'shape' : (3, 256, 256),
    'transform_train' : [
    { 'name' : 'resize', 'size' : 286, },
    { 'name' : 'random-rotation', 'degrees' : 10, },
    { 'name' : 'random-crop', 'size' : 256, },
    'random-flip-horizontal',
    {
    'name' : 'color-jitter',
    'brightness' : 0.2,
    'contrast' : 0.2,
    'saturation' : 0.2,
    'hue' : 0.2,
    },
    ],
    'transform_test' : None,
    } for domain in [ 'a', 'b' ]
    ],
    'merge_type' : 'unpaired',
    'workers' : 1,
    },
    )

  2. I am just using hundreds of images for training. It is very small compared with your dataset.
    So, is there any recommendation to get better training? Like, do more augmentation or changing these hyperparameters...?

@usert5432
Copy link
Collaborator

Hi @Anecdote-Lee,

In pretrain_anime2selfie.py, it is training dataset with 2 domains.
However in other pretraining codes, they don't use any domains even though they also have several domain. What's difference between them?

The difference in configuration options is purely cosmetic and just a historical artifact. All the datasets use all the domains for the pre-training. The reason for this cosmetic difference is that:

  1. The anime2selfie is a very old dataset and has an old CycleGAN-like structure:
anime2selfie:
-- trainA/
-- trainB/
-- testA/
-- testB/

The standard pytorch loaders cannot handle this dataset, so it requires a custom dataset implementation with explicit domain specifications. The other datasets have more modern structure, e.g.:

cat2dog:
-- train/
---- cat/
---- dog/
-- test/
---- cat/
---- dog/

and can be read by the default pytorch data loaders, without specifying domains.

I am just using hundreds of images for training. It is very small compared with your dataset.
So, is there any recommendation to get better training? Like, do more augmentation or changing these hyperparameters...?

Unfortunately, I cannot give any concrete suggestions here. I do not think the small dataset size should be a problem by itself, although having more data augmentations may benefit (as long as you are ok with these augmentations to leak into the generated images (https://arxiv.org/pdf/2006.06676.pdf).)

From my experience -- if you dataset is "good" then the CycleGAN-like models will work with minimal modifications (even with small datasets). If your dataset is "bad", then you would need to do a lot of hyperparameter tunes and data augmentations to make it work. And, unfortunately, the easiest way to find out if your dataset is "good" or "bad" is to run the training and see if it works.

@Anecdote-Lee
Copy link
Author

Thank you for your help and suggestion. It will be very helpful!

@Anecdote-Lee
Copy link
Author

Hello! I want to ask the other question.
In the Generator pretraining(pretexting) process, I think both domain datasets(A&B) should adapted to the process.
So, my understanding is that when domain B is used for pretraining, it trains generator A->B, and when domain A is used, it trains generator B->A, is that correct?

@usert5432
Copy link
Collaborator

Hi @Anecdote-Lee,

Sure.

So, my understanding is that when domain B is used for pretraining, it trains generator A->B, and when domain A is used, it trains generator B->A, is that correct?

During the pre-training process we actually train a single joint generator for A and B domains simultaneously. Then we use that single generator to initialize both A->B and B->A translations. Here is the corresponding configuration:

'transfer_map' : {
'gen_ab' : 'encoder',
'gen_ba' : 'encoder',
},

Both, gen_ab and gen_ba are initialized from a single pre-trained encoder.

@Anecdote-Lee
Copy link
Author

Thanks for your kind explanation.
I was mistaken. I think i know now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants