argparse包用于解析命令行参数,
import argparse
# parse parameter
parser = argparse.ArgumentParser(description='Client')
parser.add_argument('--ckpt', type=str,
help='test vid list file',default='.')
parser.add_argument('--tsbd', type=str,
help='test vid list file',default='.')
parser.add_argument('--img-shape', type=str,
help='test vid list file',default='56,56,3')
parser.add_argument('--batchsize', type=int,
help='test vid list file',default=5)
parser.add_argument('--model-name', type=str,
help='basemodel',default='resnet50')
parser.add_argument('--datagenerator-nb-workers',type = int,default=10,
help='the number of datagenerator-workers')
parser.add_argument('--max_queue_size',type = int,default=50,
help='t')
parser.add_argument('--GPU',type = str,default= '0',
help="cpuid,such as 0 for single; 0,1,2,3 for multi")
parser.add_argument('--loadweightpath',type = str,default= None,
help="preloadweights")
parser.add_argument('--loadbranchmodelweightpath',type = str,default= None,
help="preloadweights")
parser.add_argument('--loss-ratio',type = str,default= '1,1,1,1',
help="cls1loss:cls2loss:cls3loss:tripleloss")
parser.add_argument('--epoch',type = int,default=20,
help="train epoch")
parser.add_argument('--freeze',type = int ,default=0,
help="freeze=1 :freeze all except fc")
parser.add_argument('--lr',type = float ,default=0.005,
help="learning rate")
parser.add_argument('--max_steps',type = int ,default=50000,
help="steps of iterations")
parser.add_argument('--store_step',type = int ,default=10000,
help="steps of iterations")
parser.add_argument('--last-train',type = bool,default=False,help ="when last train for submit set True")
args = parser.parse_args()
lr = args.lr
loadweightpath = args.loadweightpath
batchsize = args.batchsize
nb_workers = args.datagenerator_nb_workers
max_steps = args.max_steps
store_step = args.store_step
if not loadweightpath == None:
saver.restore(loadweightpath)
print("load weights")