PyTorch-StudioGAN icon indicating copy to clipboard operation
PyTorch-StudioGAN copied to clipboard

How to run the predict process

Open liushanyuan18 opened this issue 3 years ago • 10 comments

thank you for your awesome work! could you please tell me how can i run the predict process?i don't want to run the train or eval process,but only want to run some generated images out

liushanyuan18 avatar Feb 21 '22 11:02 liushanyuan18

After downloading a pre-trained checkpoint,

CUDA_VISIBLE_DEVICES=0 python3 src/main.py -cfg CONFIG_PATH -save SAVE_DIR -ckpt CKPT_PATH -sf

will lead you to watch awesome results.

mingukkang avatar Feb 21 '22 12:02 mingukkang

After downloading a pre-trained checkpoint,

CUDA_VISIBLE_DEVICES=0 python3 src/main.py -cfg CONFIG_PATH -save SAVE_DIR -ckpt CKPT_PATH -sf

will lead you to watch awesome results.

飞书20220222-092951 I can't get the results. I have such a problem that data sets are required, but inference process does not require data sets

liushanyuan18 avatar Feb 22 '22 01:02 liushanyuan18

There's little bit of problem in saving fake images with current master branch. I've tweaked few codes to make -sf option work temporarily. You can use the branch in https://github.com/alex4727/PyTorch-StudioGAN with following command. CUDA_VISIBLE_DEVICES=0 python3 src/main.py -cfg CONFIG_PATH -save SAVE_DIR -ckpt CKPT_PATH -sf -sf_num NUMBER_OF_IMAGES_TO_GENERATE -metrics none Note that although StudioGAN saves only "-sf_num" specified numbers of images, StudioGAN produces images using batch_size specified in config since a lot of GANs heavily rely on batch statistics. Thus, if you encounter gpu memory problem try lowering batch_size specified in config. We'll try to fix problems in current master branch as soon as possible.

alex4727 avatar Feb 22 '22 08:02 alex4727

There's little bit of problem in saving fake images with current master branch. I've tweaked few codes to make -sf option work temporarily. You can use the branch in https://github.com/alex4727/PyTorch-StudioGAN with following command. CUDA_VISIBLE_DEVICES=0 python3 src/main.py -cfg CONFIG_PATH -save SAVE_DIR -ckpt CKPT_PATH -sf -sf_num NUMBER_OF_IMAGES_TO_GENERATE -metrics none Note that although StudioGAN saves only "-sf_num" specified numbers of images, StudioGAN produces images using batch_size specified in config since a lot of GANs heavily rely on batch statistics. Thus, if you encounter gpu memory problem try lowering batch_size specified in config. We'll try to fix problems in current master branch as soon as possible.

thanks!now I can get the result

liushanyuan18 avatar Feb 22 '22 09:02 liushanyuan18

I will reflect the suggestion by Alex ASAP.

Thank you.

mingukkang avatar Feb 25 '22 11:02 mingukkang

Hello,sir! I use the command:

CUDA_VISIBLE_DEVICES=0 python3 src/main.py -cfg ./src/configs/CIFAR10/ReACGAN-CR.yaml -save ./SAVE -ckpt ./model=G-best-weights-step=82000.pth -sf -sf_num 10 -metrics none

I want to run some generated images out, not to run the train or eval process, but there happens :

TypeError: expected str, bytes or os.PathLike object, not NoneType image

could you know what can I do to deal with it? Thanks

StarBlue98 avatar May 25 '22 13:05 StarBlue98

@alex4727 it seems the issue still exists for generating samples

DongChen06 avatar Aug 10 '22 15:08 DongChen06

Hello, have you fixed the issue?

DongChen06 avatar Aug 23 '22 01:08 DongChen06

Can you do the process again after pulling the master branch to your local?

Thanks.

mingukkang avatar Aug 24 '22 08:08 mingukkang

Hi, I have tried again to sample from the latest version of the code present in the repository but I still get the same issue. Running : python3 src/main.py -cfg ./configs/ImageNet/BigGAN-256.yaml -save ./SAVE -ckpt ./ImageNet_tailored/ImageNet-BigGAN-256-train-2022_02_13_09_14_45/model=G-best-weights-step=200000.pth -sf -sf_num 10 -metrics none I get the following error: TypeError: expected str, bytes or os.PathLike object, not NoneType in the same line as the previous user.

RCorvi avatar Feb 17 '23 14:02 RCorvi