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

what is differ projector_gray.py and projector.py ? #3

Open
limhasic opened this issue Apr 19, 2024 · 5 comments
Open

what is differ projector_gray.py and projector.py ? #3

limhasic opened this issue Apr 19, 2024 · 5 comments

Comments

@limhasic
Copy link

it looks like same

@gunahn
Copy link
Owner

gunahn commented Apr 22, 2024

@limhasic I think projector_gray is for the image that only has 1 channel and projector.py is for image for 3 channels (RGB).

Thank you.

@limhasic
Copy link
Author

limhasic commented Apr 22, 2024

I used pkl, which trained on gray_scaled images resized to 512x512.

!python projector.py
--outdir=/mnt/stylegan2-ada-pytorch/new_test
--target=/noisy_gray_image.png
--network=/auto4-kimg1000/network-snapshot-001000.pkl

But the following error occurred

> - [ ] - Loading networks from "/mnt/stylegan2-ada-pytorch/results/00007-new_image_grayscale-auto4-kimg1000/network-snapshot-001000.pkl"...
> - [ ] - target.shape :  torch.Size([3, 512, 512])
> - [ ] - G.img_channels 1
> - [ ] - G.img_resolution 512
> - [ ] - Traceback (most recent call last):
> - [ ] - File "projector_gray.py", line 213, in <module>
> - [ ] - run_projection() # pylint: disable=no-value-for-parameter
> - [ ] - 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 "projector_gray.py", line 180, in run_projection
> - [ ] - projected_w_steps = project(
> - [ ] - File "projector_gray.py", line 45, in project
> - [ ] - assert target.shape == (G.img_channels, G.img_resolution, G.img_resolution)
> - [ ] - AssertionError
> - [ ] 

why target channel is 3?

@limhasic
Copy link
Author

and i fix some codes but still occur error

Loading networks from "/mnt/stylegan2-ada-pytorch/results/00008-new_image_grayscale-auto4-kimg10/network-snapshot-000010.pkl"...
Traceback (most recent call last):
  File "projector_gray.py", line 215, in <module>
    run_projection() # pylint: disable=no-value-for-parameter
  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 "projector_gray.py", line 184, in run_projection
    target=torch.tensor(target_uint8.transpose([2, 0, 1]), device=device), # pylint: disable=not-callable
ValueError: axes don't match array

@limhasic
Copy link
Author

i changed some code

The source and dest orders of dataset_tool_gray are reversed, and is it correct to recompress the results and train the zip file?

like under

!python dataset_tool_gray.py 
--source=/mnt/StyleGAN2-ADA-pytorch-for-gray-images/data_raw.zip 
--dest=/mnt/StyleGAN2-ADA-pytorch-for-gray-images/empty --width=512 --height=512  
--resize-filter=box

!python train.py 
--outdir=/mnt/stylegan2-ada-pytorch/results 
--gpus=4 
--data=/mnt/StyleGAN2-ADA-pytorch-for-gray-images/empty.zip 
--kimg 10 
--cfg=auto

@limhasic
Copy link
Author

So why is the code the same?

!python projector_gray.py --outdir=out --target=~/mytargetimg.png --network= path to netwrok

Has it ever been executed?

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

2 participants