Closed hcl-aa closed 1 year ago
Hi, it seems that you don't set the model to test in your options when you run the code. Try this: !python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra --model test --no_dropout
I updated the readme with the correct instructions, let me know if it solves your issue.
so when I test my model, I can't choose the option '--model cycle_gan'?
When you test your model you don't need to specify cyclegan, because you don't need the discriminator during the inference part, but only the generator., You only need your generator checkpoints in a folder with this structure:
(Supposing you are using horse2zebra dataset) chekpoints_dir_name -> horse2zebra -> latest_net_G.pth (checkpoints for the generator from horse to zebra) chekpoints_dir_name -> zebra2horse -> latest_net_G.pth (checkpoints for the generator from zebra to horse)
So the command will be: !python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra --model test --no_dropout --checkpoints_dir PATH_OF_CHECKPOINTS_DIR
I have solved my problem,thank you very much.
Traceback (most recent call last): File "test.py", line 46, in
model = create_model(opt) # create a model given opt.model and other options
File "G:\download\Avoiding-Shortcuts-in-Unpaired-Image-to-Image-Translation-main\models__init__.py", line 65, in create_model
instance = model(opt)
File "G:\download\Avoiding-Shortcuts-in-Unpaired-Image-to-Image-Translation-main\models\cycle_gan_model.py", line 97, in init
self.gradcamG_A = GradCam(model=self.netG_A, discriminator=self.netD_A, feature_module=self.netG_A.module.model, use_cuda=True)
AttributeError: 'CycleGANModel' object has no attribute 'netD_A'