From fe3bc52c8265f157c754334fd47c6f96571ee1e4 Mon Sep 17 00:00:00 2001 From: junyanz Date: Thu, 8 Nov 2018 22:11:15 -0500 Subject: [PATCH] add instructions for test_model --- README.md | 1 + models/pix2pix_model.py | 4 ++-- models/test_model.py | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b20c06..2acb98a 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ The option `--model test` is used for generating results of CycleGAN only for on - If you would like to apply a pre-trained model to a collection of input images (rather than image pairs), please use `--dataset_mode single` and `--model test` options. Here is a script to apply a model to Facade label maps (stored in the directory `facades/testB`). ``` bash #!./scripts/test_single.sh +#This script only works for CycleGAN; For pix2pix, you should use `--model pix2pix`. python test.py --dataroot ./datasets/facades/testB/ --name {your_trained_model_name} --model test ``` You might want to specify `--netG` to match the generator architecture of the trained model. diff --git a/models/pix2pix_model.py b/models/pix2pix_model.py index 466de4f..efe3c63 100644 --- a/models/pix2pix_model.py +++ b/models/pix2pix_model.py @@ -13,10 +13,10 @@ def modify_commandline_options(parser, is_train=True): # changing the default values to match the pix2pix paper # (https://phillipi.github.io/pix2pix/) - parser.set_defaults(pool_size=0, no_lsgan=True, norm='batch') + parser.set_defaults(norm='batch', netG='unet_256') parser.set_defaults(dataset_mode='aligned') - parser.set_defaults(netG='unet_256') if is_train: + parser.set_defaults(pool_size=0, no_lsgan=True) parser.add_argument('--lambda_L1', type=float, default=100.0, help='weight for L1 loss') return parser diff --git a/models/test_model.py b/models/test_model.py index 4b4de4e..6b9a18b 100644 --- a/models/test_model.py +++ b/models/test_model.py @@ -1,6 +1,5 @@ from .base_model import BaseModel from . import networks -from .cycle_gan_model import CycleGANModel class TestModel(BaseModel): @@ -10,9 +9,8 @@ def name(self): @staticmethod def modify_commandline_options(parser, is_train=True): assert not is_train, 'TestModel cannot be used in train mode' - parser = CycleGANModel.modify_commandline_options(parser, is_train=False) parser.set_defaults(dataset_mode='single') - + parser.set_defaults(no_dropout=True) parser.add_argument('--model_suffix', type=str, default='', help='In checkpoints_dir, [epoch]_net_G[model_suffix].pth will' ' be loaded as the generator of TestModel')