MCPcopy Create free account
hub / github.com/NVlabs/SPADE / BaseOptions

Class BaseOptions

options/base_options.py:16–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15
16class BaseOptions():
17 def __init__(self):
18 self.initialized = False
19
20 def initialize(self, parser):
21 # experiment specifics
22 parser.add_argument('--name', type=str, default='label2coco', help='name of the experiment. It decides where to store samples and models')
23
24 parser.add_argument('--gpu_ids', type=str, default='0', help='gpu ids: e.g. 0 0,1,2, 0,2. use -1 for CPU')
25 parser.add_argument('--checkpoints_dir', type=str, default='./checkpoints', help='models are saved here')
26 parser.add_argument('--model', type=str, default='pix2pix', help='which model to use')
27 parser.add_argument('--norm_G', type=str, default='spectralinstance', help='instance normalization or batch normalization')
28 parser.add_argument('--norm_D', type=str, default='spectralinstance', help='instance normalization or batch normalization')
29 parser.add_argument('--norm_E', type=str, default='spectralinstance', help='instance normalization or batch normalization')
30 parser.add_argument('--phase', type=str, default='train', help='train, val, test, etc')
31
32 # input/output sizes
33 parser.add_argument('--batchSize', type=int, default=1, help='input batch size')
34 parser.add_argument('--preprocess_mode', type=str, default='scale_width_and_crop', help='scaling and cropping of images at load time.', choices=("resize_and_crop", "crop", "scale_width", "scale_width_and_crop", "scale_shortside", "scale_shortside_and_crop", "fixed", "none"))
35 parser.add_argument('--load_size', type=int, default=1024, help='Scale images to this size. The final image will be cropped to --crop_size.')
36 parser.add_argument('--crop_size', type=int, default=512, help='Crop to the width of crop_size (after initially scaling the images to load_size.)')
37 parser.add_argument('--aspect_ratio', type=float, default=1.0, help='The ratio width/height. The final height of the load image will be crop_size/aspect_ratio')
38 parser.add_argument('--label_nc', type=int, default=182, help='# of input label classes without unknown class. If you have unknown class as class label, specify --contain_dopntcare_label.')
39 parser.add_argument('--contain_dontcare_label', action='store_true', help='if the label map contains dontcare label (dontcare=255)')
40 parser.add_argument('--output_nc', type=int, default=3, help='# of output image channels')
41
42 # for setting inputs
43 parser.add_argument('--dataroot', type=str, default='./datasets/cityscapes/')
44 parser.add_argument('--dataset_mode', type=str, default='coco')
45 parser.add_argument('--serial_batches', action='store_true', help='if true, takes images in order to make batches, otherwise takes them randomly')
46 parser.add_argument('--no_flip', action='store_true', help='if specified, do not flip the images for data argumentation')
47 parser.add_argument('--nThreads', default=0, type=int, help='# threads for loading data')
48 parser.add_argument('--max_dataset_size', type=int, default=sys.maxsize, help='Maximum number of samples allowed per dataset. If the dataset directory contains more than max_dataset_size, only a subset is loaded.')
49 parser.add_argument('--load_from_opt_file', action='store_true', help='load the options from checkpoints and use that as default')
50 parser.add_argument('--cache_filelist_write', action='store_true', help='saves the current filelist into a text file, so that it loads faster')
51 parser.add_argument('--cache_filelist_read', action='store_true', help='reads from the file list cache')
52
53 # for displays
54 parser.add_argument('--display_winsize', type=int, default=400, help='display window size')
55
56 # for generator
57 parser.add_argument('--netG', type=str, default='spade', help='selects model to use for netG (pix2pixhd | spade)')
58 parser.add_argument('--ngf', type=int, default=64, help='# of gen filters in first conv layer')
59 parser.add_argument('--init_type', type=str, default='xavier', help='network initialization [normal|xavier|kaiming|orthogonal]')
60 parser.add_argument('--init_variance', type=float, default=0.02, help='variance of the initialization distribution')
61 parser.add_argument('--z_dim', type=int, default=256,
62 help="dimension of the latent z vector")
63
64 # for instance-wise features
65 parser.add_argument('--no_instance', action='store_true', help='if specified, do *not* add instance map as input')
66 parser.add_argument('--nef', type=int, default=16, help='# of encoder filters in the first conv layer')
67 parser.add_argument('--use_vae', action='store_true', help='enable training with an image encoder.')
68
69 self.initialized = True
70 return parser
71
72 def gather_options(self):
73 # initialize parser with basic options

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected