ofnote / TryOnGAN

TryOnGAN: Unofficial Implementation
Other
88 stars 17 forks source link

projector error #3

Open JianfengYin opened 2 years ago

JianfengYin commented 2 years ago

Hi,

When try to project an image to latent space by running " python projector.py --outdir=./ --target=../images/xxx.png --posefile=../images/pose-annotations.csv --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/ffhq.pkl",

I got an error like this:

TypeError: forward() takes 2 positional arguments but 3 were given

stack is:


Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/pdb.py", line 1704, in main
    pdb._runscript(mainpyfile)
  File "/opt/conda/lib/python3.8/pdb.py", line 1573, in _runscript
    self.run(statement)
  File "/opt/conda/lib/python3.8/bdb.py", line 580, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/workspace/TryOnGAN/projector.py", line 9, in <module>
    """Project given image to the latent space of pretrained network pickle."""
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/workspace/TryOnGAN/projector.py", line 227, in run_projection
    projected_w_steps = project(
  File "/workspace/TryOnGAN/projector.py", line 97, in project
    synth_images = G.synthesis(ws, pose, ret_pose=False, noise_mode='const')
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 744, in _call_impl
    result = self.forward(*input, **kwargs)
TypeError: forward() takes 2 positional arguments but 3 were given

Any idea what is going wrong? Thanks.

yukistavailable commented 2 years ago

The solution would be to use a network for PC such as PC-add-scratch-network-snapshot-002040.pkl. You can't use the network for stylegan2. You can find pre-trained networks for TryOnGAN here. https://drive.google.com/drive/folders/1_GxdMeMDhGcFlGowQg10dANO1liS0v4Z