parser-action

Action

举例1:

self.parser.add_argument(--'lr_use', action='store_true', default=False, help='if or not use lr_loss')

当在终端运行的时候,如果不加入--lr_use, 那么程序running的时候,lr_use的值为default:False

self.parser.add_argument('--no_flip', action='store_false', help='....')

当在终端运行的时候,并没有加入no_flip,数据集中的图片并不会翻转,打印出来看到no_flip的值为True

Note:

有default值的时候,running时不声明就为默认值

没有的话,如果是store_false,则默认值是True, 如果是store_true,则默认值是False