MCPcopy Create free account
hub / github.com/JunlinHan/DCLGAN / modify_commandline_options

Method modify_commandline_options

models/fastcut_model.py:19–48  ·  view source on GitHub ↗

Configures options specific for FASTCUT model

(parser, is_train=True)

Source from the content-addressed store, hash-verified

17 """
18 @staticmethod
19 def modify_commandline_options(parser, is_train=True):
20 """ Configures options specific for FASTCUT model
21 """
22 parser.add_argument('--lambda_GAN', type=float, default=1.0, help='weight for GAN loss:GAN(G(X))')
23 parser.add_argument('--lambda_NCE', type=float, default=1.0, help='weight for NCE loss: NCE(G(X), X)')
24 parser.add_argument('--lambda_IDT', type=float, default=10.0, help='weight for NCE loss: NCE(G(X), X)')
25 parser.add_argument('--nce_idt', type=util.str2bool, nargs='?', const=True, default=False, help='use NCE loss for identity mapping: NCE(G(Y), Y))')
26 parser.add_argument('--nce_layers', type=str, default='0,4,8,12,16', help='compute NCE loss on which layers')
27 parser.add_argument('--nce_includes_all_negatives_from_minibatch',
28 type=util.str2bool, nargs='?', const=True, default=False,
29 help='(used for single image translation) If True, include the negatives from the other samples of the minibatch when computing the contrastive loss. Please see models/patchnce.py for more details.')
30 parser.add_argument('--netF', type=str, default='mlp_sample', choices=['sample', 'reshape', 'mlp_sample'], help='how to downsample the feature map')
31 parser.add_argument('--netF_nc', type=int, default=256)
32 parser.add_argument('--nce_T', type=float, default=0.07, help='temperature for NCE loss')
33 parser.add_argument('--num_patches', type=int, default=256, help='number of patches per layer')
34 parser.add_argument('--flip_equivariance',
35 type=util.str2bool, nargs='?', const=True, default=False,
36 help="Enforce flip-equivariance as additional regularization. It's used by FastCUT, but not CUT")
37
38 parser.set_defaults(pool_size=0) # no image pooling
39
40 opt, _ = parser.parse_known_args()
41
42 # Set default parameters for CUT and FastCUT
43 parser.set_defaults(
44 nce_idt=False, lambda_NCE=10.0, flip_equivariance=True,
45 n_epochs=150, n_epochs_decay=50
46 )
47
48 return parser
49
50 def __init__(self, opt):
51 BaseModel.__init__(self, opt)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected