BicycleGAN icon indicating copy to clipboard operation
BicycleGAN copied to clipboard

test_before_push is a great rapid test file, but seems outdated?

Open NataliaDiaz opened this issue 5 years ago • 3 comments

https://github.com/junyanz/BicycleGAN/blob/master/scripts/test_before_push.py

BicycleGAN$ python ./scripts/test_before_push.pybash

./datasets/download_cyclegan_dataset.sh mini_pix2pix bash: ./datasets/download_cyclegan_dataset.sh: No such file or directory

NataliaDiaz avatar Jul 01 '20 13:07 NataliaDiaz

I updated it with 7ef3acd. Could you give a try?

junyanz avatar Jul 02 '20 04:07 junyanz

thanks! it works now. However, if I adapt the same template to run it over another dataset, e.g. facades, as follows:

if not os.path.exists('./datasets/facades'):
        run('bash ./datasets/download_dataset.sh facades')
    
    # template train/test for Facades:
    run('python train.py --model facades --name temp_facades --dataroot ./datasets/facades --niter 1 --niter_decay 0 --save_latest_freq 10 --display_id -1')
      
    run('bash ./scripts/test_facades.sh')
    run('bash ./scripts/test_facades.sh --sync')
    run('bash ./scripts/video_facades.sh')

I get an error:

python ./scripts/test_before_push_facades.py python train.py --model facades --name temp_facades --dataroot ./datasets/facades --niter 1 --niter_decay 0 --save_latest_freq 10 --display_id -1 Traceback (most recent call last): File "train.py", line 22, in <module> opt = TrainOptions().parse() # get training options File "/home/jupyter/BicycleGAN/options/base_options.py", line 122, in parse opt = self.gather_options() File "/home/jupyter/BicycleGAN/options/base_options.py", line 82, in gather_options model_option_setter = models.get_option_setter(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 46, in get_option_setter model_class = find_model_using_name(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 29, in find_model_using_name modellib = importlib.import_module(model_filename) File "/opt/conda/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'models.facades_model' jupyter@eie-week1-ml-bicyclegan-tesla:~/BicycleGAN$ python ./scripts/test_before_push_facades.py python train.py --model facades --name temp_facades --dataroot ./datasets/facades --niter 1 --niter_decay 0 --save_latest_freq 10 --display_id -1 Traceback (most recent call last): File "train.py", line 22, in <module> opt = TrainOptions().parse() # get training options File "/home/jupyter/BicycleGAN/options/base_options.py", line 122, in parse opt = self.gather_options() File "/home/jupyter/BicycleGAN/options/base_options.py", line 82, in gather_options model_option_setter = models.get_option_setter(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 46, in get_option_setter model_class = find_model_using_name(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 29, in find_model_using_name modellib = importlib.import_module(model_filename) File "/opt/conda/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'models.facades_model'

and if I run the https://github.com/junyanz/BicycleGAN/blob/master/scripts/train_facades.sh where I update NITER to be 1, I get:

----------------- End ------------------- dataset [AlignedDataset] was created initialize network with xavier model [BiCycleGANModel] was created loading the model from ./pretrained_models/facades/latest_net_G.pth Traceback (most recent call last): File "./video.py", line 30, in <module> model.setup(opt) File "/home/jupyter/BicycleGAN/models/base_model.py", line 90, in setup self.load_networks(opt.epoch) File "/home/jupyter/BicycleGAN/models/base_model.py", line 196, in load_networks net.load_state_dict(state_dict) File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 830, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for G_Unet_add_all: size mismatch for model.down.0.weight: copying a param with shape torch.Size([64, 11, 4, 4]) from checkpoint, the shape in current model is torch.Size([64, 9, 4, 4]).

any hints? thanks

NataliaDiaz avatar Jul 06 '20 08:07 NataliaDiaz

You should use --model pix2pix or --model bicycle_gan. This script is mostly for development. Please refer to README on how to test a pre-trained model.

junyanz avatar Jul 06 '20 20:07 junyanz