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

How to create your own data set #30

Open
AKclown opened this issue Jul 24, 2021 · 4 comments
Open

How to create your own data set #30

AKclown opened this issue Jul 24, 2021 · 4 comments

Comments

@AKclown
Copy link

AKclown commented Jul 24, 2021

I have a face picture, and I want to generate the corresponding .pt file from it, which is the same as the data set provided by the demo. How do I generate a 3D model of my own picture?
Can you give me a hint? thank

@XingangPan
Copy link
Owner

Hi, you need to first perform GAN inversion to get the latent code of the images. To do this you may use code from https://github.com/rosinality/stylegan2-pytorch/blob/master/projector.py or use our code here https://drive.google.com/file/d/1pCfnDiHZNnRoEVZ4RhcLfZyPrJgUWEYk/view?usp=sharing.
Next, you can run this GAN2Shape code to get the 3D shape. You need to revise the config file accordingly by changing the input image path and latent code path.

@leonel-rocks
Copy link

Hi, you need to first perform GAN inversion to get the latent code of the images. To do this you may use code from https://github.com/rosinality/stylegan2-pytorch/blob/master/projector.py or use our code here https://drive.google.com/file/d/1pCfnDiHZNnRoEVZ4RhcLfZyPrJgUWEYk/view?usp=sharing. Next, you can run this GAN2Shape code to get the 3D shape. You need to revise the config file accordingly by changing the input image path and latent code path.

Hi @XingangPan I'm using your code from https://drive.google.com/file/d/1pCfnDiHZNnRoEVZ4RhcLfZyPrJgUWEYk/view?usp=sharing. However when I run sh project_dist.sh I keep getting the following error:

Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.
*****************************************
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'
Traceback (most recent call last):
  File "/home/jgutierrez/anaconda3/envs/gan2/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/jgutierrez/anaconda3/envs/gan2/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/jgutierrez/anaconda3/envs/gan2/lib/python3.7/site-packages/torch/distributed/launch.py", line 246, in <module>
    main()
  File "/home/jgutierrez/anaconda3/envs/gan2/lib/python3.7/site-packages/torch/distributed/launch.py", line 242, in main
    cmd=cmd)
subprocess.CalledProcessError: Command '['/home/jgutierrez/anaconda3/envs/gan2/bin/python', '-u', 'projector.py', '--local_rank=7', '--ckpt', 'checkpoints/stylegan2-synface40k-config-e.pt', '--size', '128', '--step', '1001', '--channel_multiplier', '1', '--synface', '--with_vgg', '--lr', '0.1', '--noise', '0.05', '--no_noise', '--list_path', '/home/xgpan/projects/GAN/unsup3d/data/synface/train/img_list_200.txt', '--img_root', '/home/xgpan/projects/GAN/unsup3d/data/synface/train/image', '--save_path', 'project/synface_train_40k', '--batch_size', '25', '--distributed']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'
Traceback (most recent call last):
  File "projector.py", line 15, in <module>
    from model import Generator, Discriminator
ModuleNotFoundError: No module named 'model'

Can you help me?

@XingangPan
Copy link
Owner

XingangPan commented Oct 25, 2021

@DarKayserLeo Hi, please run the script under https://github.com/rosinality/stylegan2-pytorch or https://github.com/XingangPan/GAN2Shape/tree/main/gan2shape/stylegan2/stylegan2-pytorch

@leonel-rocks
Copy link

Thanks!

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

No branches or pull requests

3 participants