rosinality / stylegan2-pytorch

Implementation of Analyzing and Improving the Image Quality of StyleGAN (StyleGAN 2) in PyTorch
MIT License
2.74k stars 623 forks source link

Ask for pre-trained models #2

Open sangwoomo opened 4 years ago

sangwoomo commented 4 years ago

Hi, thank you for sharing your code! Do you have any plan to share your pre-trained models?

rosinality commented 4 years ago

Yes, I will after training is finished. But it requires a lot of time... (about 2 weeks)

sangwoomo commented 4 years ago

Thanks!

linghai06 commented 4 years ago

@rosinality By the way, which dataset did you use for training. You training results seem pretty good.

rosinality commented 4 years ago

@linghai06 It's trained on FFHQ.

JNUChenYiHong commented 4 years ago

@linghai06 It's trained on FFHQ.

Thank you for your code. Looking forward to your pretraining model. The image of your training is really amazing.

apchenstu commented 4 years ago

Hi there, thank for this amazing reproduction! It would be really helpful if you could share your pre-train model or a more detailed train setting(e.g., number of GPUs, resolution, training time, batch size, etc.), thank you in advance!

rosinality commented 4 years ago

@apchenstu I have used 4 P40 with batch 32. (8 batch per GPU) If fully train 256px model with 800k iterations it will require about 15 days. I have trained about 600k iters, but FID was not satisfactory. (about 4.5)

rosinality commented 4 years ago

@apchenstu You can use this: https://drive.google.com/open?id=1PQutd-JboOCOZqmd95XWxWrO8gGEvRcO

yejinyou commented 4 years ago

Hi When I am trying to load the .pt model with torch.load in python 3.6 I am getting the following error _pickle.UnpicklingError: invalid load key, '<'. I was wondering if you could help me out? Thank you.

caandewiel commented 4 years ago

@yejinyou Which PyTorch version are you using? I am on 1.4.0 and it loads fine for me. Maybe try downloading the file again?

@rosinality Thanks for sharing this checkpoint. Is it correct that this checkpoint does not contain the noise weights for the synthesis network? I got it working by manually removing the noise layers, but it does not seem right to me. :)

rosinality commented 4 years ago

@caandewiel Yes, this checkpoints doesn't have noises as it is trained before support of fixed noises. But you can just load it with load_state_dict(strict=False).

terrybroad commented 4 years ago

Hi @rosinality thanks for the excellent work! Would you also consider sharing the converted model weights? I was able to convert them using your script but I do not have a 16GB GPU and I am unsure as to whether something went wrong in the conversion process, as I was getting memory errors and about 50% of the samples have some kind of artifact in them.

caandewiel commented 4 years ago

@terrybroad I converted them on 11GB, worked fine :) Which CUDA and PyTorch version are you using?

terrybroad commented 4 years ago

The machine I used for conversion had Tensorflow 1.14.0, PyTorch 1.4.0 and Cuda 10.0 using a 12GB GPU.

Maybe this is normal but a number of samples have artifacts like the ones below, do you get the same artifacts in your samples? 000014

000018

caandewiel commented 4 years ago

Hmmm, that looks interesting. Are you using truncation? I just converted the model again. Not all samples are super realistic, but none of them contain these artifacts. Some of the generated samples: 000000 000002 000012

terrybroad commented 4 years ago

Truncation during inference in PyTorch or during conversion?

Would you mind sharing your converted weights (if possible) so I can see if I am getting the same problem with them on my end?

rosinality commented 4 years ago

@terrybroad You can may use this: https://drive.google.com/open?id=173WmV5EhFfMQTeDpYkLAJi3qhPtZOQs5 But I think converted weights itself will not be problematic. Samples without truncation trick could have some artifacts. You need to use truncation tricks during inference if you want visually pleasing samples.

terrybroad commented 4 years ago

Ah OK sorry, I missed that. I have copied your code for handling truncation in fid.py into generate.py and the samples I am getting are much better now. @rosinality would you like me to do a PR so this is handled in generate.py?

rosinality commented 4 years ago

@terrybroad Yes! Thank you.

terrybroad commented 4 years ago

Will do! Also @rosinality I am building on your code in my current research (both this repo and the original StyleGAN PyTorch implementation). How would you like to be cited if this ends up in a publication?

rosinality commented 4 years ago

@terrybroad I don't know it is worth to cite this repository as this is just a reimplementation or port from official repositories. But if you add footnote/cite url (https://github.com/rosinality/stylegan2-pytorch), than it would be a great honor for me. :)

terrybroad commented 4 years ago

@rosinality Will do! In fact, I already have cited the original StyleGAN PyTorch repo in a footnote in this pre-print: https://arxiv.org/pdf/2002.06890.pdf (page 3). But I realised I should ask for future work / camera-ready publications. If you want I can also include your real name as well in the future? :)

rosinality commented 4 years ago

@terrybroad If you want you can include real names, but for me url for repos is enough. Thank you.

Daic115 commented 4 years ago

The machine I used for conversion had Tensorflow 1.14.0, PyTorch 1.4.0 and Cuda 10.0 using a 12GB GPU.

Maybe this is normal but a number of samples have artifacts like the ones below, do you get the same artifacts in your samples? 000014

000018

Setting t--truncation to 0.5, this is official setting in StyleGan2

pkuanjie commented 4 years ago

Thank you for your sharing! Could you please share the pre-trained model on the MetFace dataset?

justimyhxu commented 4 years ago

Can you share the training script with args? I really want to know the exact bs, lr and other hyperparameters.

rosinality commented 4 years ago

@justimyhxu You only need to change batch sizes so batch size * n_gpu to be 32.