This class includes training options. It also includes shared options defined in BaseOptions.
| 2 | |
| 3 | |
| 4 | class TrainOptions(BaseOptions): |
| 5 | """This class includes training options. |
| 6 | |
| 7 | It also includes shared options defined in BaseOptions. |
| 8 | """ |
| 9 | |
| 10 | def initialize(self, parser): |
| 11 | parser = BaseOptions.initialize(self, parser) |
| 12 | # visdom and HTML visualization parameters |
| 13 | parser.add_argument('--display_freq', type=int, default=400, help='frequency of showing training results on screen') |
| 14 | parser.add_argument('--display_ncols', type=int, default=4, help='if positive, display all images in a single visdom web panel with certain number of images per row.') |
| 15 | parser.add_argument('--display_id', type=int, default=None, help='window id of the web display. Default is random window id') |
| 16 | parser.add_argument('--display_server', type=str, default="http://localhost", help='visdom server of the web display') |
| 17 | parser.add_argument('--display_env', type=str, default='main', help='visdom display environment name (default is "main")') |
| 18 | parser.add_argument('--display_port', type=int, default=8097, help='visdom port of the web display') |
| 19 | parser.add_argument('--update_html_freq', type=int, default=1000, help='frequency of saving training results to html') |
| 20 | parser.add_argument('--print_freq', type=int, default=100, help='frequency of showing training results on console') |
| 21 | parser.add_argument('--no_html', action='store_true', help='do not save intermediate training results to [opt.checkpoints_dir]/[opt.name]/web/') |
| 22 | # network saving and loading parameters |
| 23 | parser.add_argument('--save_latest_freq', type=int, default=5000, help='frequency of saving the latest results') |
| 24 | parser.add_argument('--save_epoch_freq', type=int, default=50, help='frequency of saving checkpoints at the end of epochs') |
| 25 | parser.add_argument('--evaluation_freq', type=int, default=5000, help='evaluation freq') |
| 26 | parser.add_argument('--save_by_iter', action='store_true', help='whether saves model by iteration') |
| 27 | parser.add_argument('--continue_train', action='store_true', help='continue training: load the latest model') |
| 28 | parser.add_argument('--epoch_count', type=int, default=1, help='the starting epoch count, we save the model by <epoch_count>, <epoch_count>+<save_latest_freq>, ...') |
| 29 | parser.add_argument('--phase', type=str, default='train', help='train, val, test, etc') |
| 30 | parser.add_argument('--pretrained_name', type=str, default=None, help='resume training from another checkpoint') |
| 31 | # training parameters |
| 32 | parser.add_argument('--n_epochs', type=int, default=200, help='number of epochs with the initial learning rate') |
| 33 | parser.add_argument('--n_epochs_decay', type=int, default=200, help='number of epochs to linearly decay learning rate to zero') |
| 34 | parser.add_argument('--beta1', type=float, default=0.5, help='momentum term of adam') |
| 35 | parser.add_argument('--beta2', type=float, default=0.999, help='momentum term of adam') |
| 36 | parser.add_argument('--lr', type=float, default=0.0002, help='initial learning rate for adam') |
| 37 | parser.add_argument('--gan_mode', type=str, default='hinge', help='the type of GAN objective. [vanilla| lsgan | wgangp| hinge]. vanilla GAN loss is the cross-entropy objective used in the original GAN paper.') |
| 38 | parser.add_argument('--pool_size', type=int, default=50, help='the size of image buffer that stores previously generated images') |
| 39 | parser.add_argument('--lr_policy', type=str, default='linear', help='learning rate policy. [linear | step | plateau | cosine]') |
| 40 | parser.add_argument('--lr_decay_iters', type=int, default=50, help='multiply by a gamma every lr_decay_iters iterations') |
| 41 | |
| 42 | self.isTrain = True |
| 43 | return parser |