Skip to content

Commit

Permalink
add instructions for test_model
Browse files Browse the repository at this point in the history
  • Loading branch information
junyanz committed Nov 9, 2018
1 parent 1fa94d7 commit fe3bc52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions models/pix2pix_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions models/test_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from .base_model import BaseModel
from . import networks
from .cycle_gan_model import CycleGANModel


class TestModel(BaseModel):
Expand All @@ -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')
Expand Down

0 comments on commit fe3bc52

Please sign in to comment.