下面代码是终端输入的
parser.add_argument(
"--draw_center_traj",
action='store_true',
help="Whether drawing the trajectory of center")
下面代码是 不激活在终端的输入
for action in parser._actions:
if action.dest in [
'rec_char_dict_path', 'table_char_dict_path', 'layout_dict_path'
]:
action.default = None
inference_args_dict = {}
for action in parser._actions:
inference_args_dict[action.dest] = action.default
argparse.Namespace(**inference_args_dict)
汇总:
def argsparser():
parser.add_argument(
"--draw_center_traj",
action='store_true',
help="Whether drawing the trajectory of center")
for action in parser._actions:
if action.dest in [
'rec_char_dict_path', 'table_char_dict_path', 'layout_dict_path'
]:
action.default = None
inference_args_dict = {}
for action in parser._actions:
inference_args_dict[action.dest] = action.default
return argparse.Namespace(**inference_args_dict)