Training our Own InterFaceGAN Boundaries
rut00 opened this issue · 2 comments
Our objective is to edit original images without glasses with sample images with glasses.
I have trained the network using face images with glasses using the StyleGan3 repo.
And now to edit an image I am using instructions given by you to train boundary with my dataset in Kaggle from your repo. But facing the following error while generating latent and attribute scores from the generate_latents_and_attribute_scores.py script.
Loading generator from "/kaggle/input/pkl-file/network-snapshot-000010.pkl"...
Downloading: "https://hanlab.mit.edu/projects/anycost-gan/files/attribute_predictor.pt" to /root/.cache/torch/hub/checkpoints/attribute_predictor.pt
100%|██████████████████████████████████████| 90.6M/90.6M [00:02<00:00, 35.0MB/s]
Traceback (most recent call last):
File "interfacegan/generate_latents_and_attribute_scores.py", line 112, in <module>
run()
File "/opt/conda/lib/python3.7/site-packages/pyrallis/argparsing.py", line 158, in wrapper_inner
response = fn(cfg, args, *kwargs)
File "interfacegan/generate_latents_and_attribute_scores.py", line 40, in run
save_interval=opts.save_interval)
File "interfacegan/generate_latents_and_attribute_scores.py", line 57, in generate_images
age_estimator = AgeEstimator()
File "../editing/interfacegan/helpers/age_estimator.py", line 18, in _init_
ckpt = torch.load(model_paths["age_estimator"], map_location="cpu")['state_dict']
File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 699, in load
with _open_file_like(f, 'rb') as opened_file:
File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 231, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 212, in _init_
super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'pretrained_models/dex_age_classifier.pth'
If you can share the correct steps to train my custom boundaries to edit images it will be really helpful.
Thank You
The code does not find:
stylegan3-editing/configs/paths_config.py
Lines 26 to 27 in e2a63fc
Hence the error at:
I think you would need a "person with/without glasses" classifier rather than an age estimator, no?
Please take a look at this part of the README:
https://github.com/yuval-alaluf/stylegan3-editing#training-your-own-interfacegan-boundaries
There you will find a link for downloading the age classifier. Place the downloading pth
file in the directory pretrained_models
and you should be able to load the model.
(Similarly for the pose estimation model)