Comments (25)
I got you. Here's a 256px model (StyleGAN2 config-f) that I derived from the weights for FFHQ released by @NVlabs. All I did was cut off the top few layers of G and D, then finetune the 256x256 layers (especially the toRGB layer). Then I finetuned the whole network for just a few kimg, which helped get a tiny bit of improvement for the perceptual quality of samples.
Download link. Let me know if that works for you, or if you encounter any issues. I haven't tested it out thoroughly or computed FID, and it is possible there are problems with the performance of D.
from awesome-pretrained-stylegan2.
I restricted the trainable variables by modifying the list of trainables for G and D, by filtering using this line here. Only the variables named in self.trainables for a dnnlib network will be trained (e.g., in the tensorflow computation graph, only those vars will be updated during backprop), all others will be "frozen" and remain the same.
For example, I think I used self.trainables = OrderedDict((name, var) for name, var in self.vars.items() if var.trainable and '256x256' in name)
or something close to it.
from awesome-pretrained-stylegan2.
OK so after training for a while the best I get for a 256x256 config-e trained from scratch is a FID of
11.2
I'll add it to the repo soon, but for now here is a Google Drive link: https://drive.google.com/open?id=1BUL-RIzXC7Bpnz2cn230CbA4eT7_Etp0
from awesome-pretrained-stylegan2.
thanks, will give it one more go. i tried modifying this line to freeze D at finetuning [for this] but didn't succeed (can't recall now what was wrong)
from awesome-pretrained-stylegan2.
Just find the solution. Use
Gs_target.copy_vars_from(Gs_source)
from awesome-pretrained-stylegan2.
post issue in that repo.
from awesome-pretrained-stylegan2.
A while back I tried to train one starting from an adapted version of the 1024x model, but the transferring process seemed to cripple it a bit, so gave up.
The only one I've seen is in the pytorch stylegan2 repo: https://github.com/rosinality/stylegan2-pytorch But this was trained without the learnable noise parameters, so is a little different to "official" StyleGAN2.
I might try training a 256x256 model on ffhq, but this might take me a little while as my computing resources are limited. If anyone has one already it would be great to know about it!
from awesome-pretrained-stylegan2.
Interesting, wonder what can make that happen. it seems like the last two scales, and their style vectors, make only minor changes in the output image so wouldn't expect them to affect the training process so much 🤔.
I've actually tried the one in the rosinality repo but it has a worse FID score, maybe the missing noise you mentioned, or some other small variant in the training process.
Hopefully someone will find the time and resources to release a tuned model :-)
from awesome-pretrained-stylegan2.
@aydao could you please explain a bit more, how did you manage to finetune only select (toRGB) layers in F config?
from awesome-pretrained-stylegan2.
Just checked the fid of the model trained above and it's 19.2520
from awesome-pretrained-stylegan2.
@aydao tried freezing vars again, recalled the question - how did you replace G/D network, loaded from the source pkl, with the modified one (loaded from the code)? did you save the source weights as standard TF checkpoint, or..?
UPD: pardon for stupidity, have been missing resume_with_new_nets
param all this time.. fixed now.
from awesome-pretrained-stylegan2.
If anyone ever trains a version to a better FID (or a config-f) or tries out the above model for transfer learning then I'd love to hear about it.
For now I'll close this issue.
from awesome-pretrained-stylegan2.
@aydao Could you explain how you cut off the top few layers of G and D? You mean create a new model in 256x256 resolusion, then load the weights? I can not find a way to load the weights to a new model in lower resolusion in stylegan2. Could you explain how you did this? Thank you in advance.
from awesome-pretrained-stylegan2.
@aydao Would you mind elaborating about how you train the ffhq 256 or sharing the code? I can not reproduce the results. You mention that finetune the 256x256 layers (especially the toRGB layer). What do you mean by especially the toRGB layer, you mean first finetune the 256x256 toRGB layers of G and the 256x256 fromRGB layers of D, then finetune the whole layers of 256x256 of both G and D? Did you change the learning rate?
Since you highlight the toRGB layers, I believe you treat them differently compared to regular feature layers.
Thank you for your help.
from awesome-pretrained-stylegan2.
@betterze I honestly do not remember exactly what I did, however I'm hoping it should be straightforward to figure out. Here's how I would do it again.
Use the scripts in my repo here https://github.com/aydao/stylegan2-surgery specifically create_initial_network_pkl.py
to create a freshly initialized StyleGAN2 at 256px resolution, then copy the weights from the source stylegan pkl into that new target pkl using copy_weights_portable.py
. At that point, you can simply train on FFHQ and it should learn quickly and stably, no need to freeze or anything.
Since I wanted to keep the pkl I shared above as close to the original weights as possible, I decided to freeze all layers except the 256x256 toRGB and 256x256 fromRGB. I trained (synonymously 'finetuned' / 'transferred') on FFHQ for a few steps. Because the perceptual quality of samples degraded somewhat at that point, I then also trained (finetuned) the whole network (all layers, no freezing) for a few more kimgs, just enough to bring back some perceptual quality.
from awesome-pretrained-stylegan2.
@aydao Thank you for your detailed reply. It helps a lot. I will try the way you described.
from awesome-pretrained-stylegan2.
Hi,
I was wondering if you're aware of a pretrained 256x256 FFHQ StyleGANv2 model trained using Tensorflow 2.0?
from awesome-pretrained-stylegan2.
I was wondering if you're aware of a pretrained 256x256 FFHQ StyleGANv2 model trained using Tensorflow 2.0?
What about the official pre-trained networks?
TensorFlow:
PyTorch:
from awesome-pretrained-stylegan2.
Isn't this model using TF1?
from awesome-pretrained-stylegan2.
Isn't this model using TF1?
My bad! You must be right!
from awesome-pretrained-stylegan2.
@Akila-Ayanthi tf2? is it compatibility mode? Tensorflow has been abandoned by Nvidia labs / no plans to go to tf2
https://github.com/rosasalberto/StyleGAN2-TensorFlow-2.x
from awesome-pretrained-stylegan2.
@Akila-Ayanthi tf2? is it compatibility mode? Tensorflow has been abandoned by Nvidia labs / no plans to go to tf2
https://github.com/rosasalberto/StyleGAN2-TensorFlow-2.x
Here there is a 1024x1024 model. I want a 256x256 FFHQ because of the limited resources I have.
from awesome-pretrained-stylegan2.
Or does anyone know of a way to convert StyleGAN2 TF1 256x256 weights to TF2?
from awesome-pretrained-stylegan2.
cf. rosasalberto/StyleGAN2-TensorFlow-2.x#10
https://github.com/NeuralSec/Generator-Zoo-Tensorflow-2.x#ffhq-256x256x3
from awesome-pretrained-stylegan2.
I was wondering if you're aware of a pretrained 256x256 FFHQ StyleGANv2 model trained using Tensorflow 2.0?
What about the official pre-trained networks?
TensorFlow:
PyTorch:
Can you tell me where this pytorch weight corresponds to yes code? Thank you.
from awesome-pretrained-stylegan2.
Related Issues (20)
- Add fine tuned from field
- https://github.com/streamlit/demo-face-gan HOT 1
- About blending 'ffhq' model and 'anime face' model HOT 2
- please explain how can i use these to make videos. im a newbie HOT 1
- Add models from Stylegan2 ADA HOT 3
- Several StyleGAN2 models to add HOT 3
- Add architecture model HOT 2
- Add corgi model HOT 1
- [Noob question] What is the difference between config-f and config-e ? HOT 3
- Beach model
- Cannot process pkl files using legacy.load_network_pkl HOT 8
- stylegan3 HOT 18
- Getting permissions to use in professional work HOT 1
- How to run the script? HOT 1
- Impressionist landscape painting
- generated images using the provided pretrained model contain colorful specks.??? HOT 2
- Clothing (lookbook) model
- StyleGAN Human
- Is there any pre-trained model for lsun bedroom and landscpae?
- I resume training and init fakes has wrong colours HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome-pretrained-stylegan2.