未验证 提交 268760a5 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix_3d_save_load (#4419)

上级 7b61e8be
......@@ -109,8 +109,9 @@ def eval():
exe = fluid.Executor(place)
exe.run(startup)
assert os.path.exists("{}.pdparams".format(args.weights)), \
"Given resume weight {}.pdparams not exist.".format(args.weights)
if not os.path.isdir(args.weights):
assert os.path.exists("{}.pdparams".format(args.weights)), \
"Given resume weight {}.pdparams not exist.".format(args.weights)
fluid.load(eval_prog, args.weights, exe)
eval_compile_prog = fluid.compiler.CompiledProgram(eval_prog)
......
......@@ -108,8 +108,9 @@ def eval():
exe = fluid.Executor(place)
exe.run(startup)
assert os.path.exists("{}.pdparams".format(args.weights)), \
"Given resume weight {}.pdparams not exist.".format(args.weights)
if not os.path.isdir(args.weights):
assert os.path.exists("{}.pdparams".format(args.weights)), \
"Given resume weight {}.pdparams not exist.".format(args.weights)
fluid.load(eval_prog, args.weights, exe)
eval_compile_prog = fluid.compiler.CompiledProgram(eval_prog)
......
......@@ -184,12 +184,11 @@ def train():
exe.run(startup)
if args.resume:
assert os.path.exists("{}.pdparams".format(args.resume)), \
"Given resume weight {}.pdparams not exist.".format(args.resume)
assert os.path.exists("{}.pdopt".format(args.resume)), \
"Given resume optimizer state {}.pdopt not exist.".format(args.resume)
assert os.path.exists("{}.pdmodel".format(args.resume)), \
"Given resume model parameter list {}.pdmodel not exist.".format(args.resume)
if not os.path.isdir(args.resume):
assert os.path.exists("{}.pdparams".format(args.resume)), \
"Given resume weight {}.pdparams not exist.".format(args.resume)
assert os.path.exists("{}.pdopt".format(args.resume)), \
"Given resume optimizer state {}.pdopt not exist.".format(args.resume)
fluid.load(train_prog, args.resume, exe)
build_strategy = fluid.BuildStrategy()
......
......@@ -183,12 +183,11 @@ def train():
exe.run(startup)
if args.resume:
assert os.path.exists("{}.pdparams".format(args.resume)), \
"Given resume weight {}.pdparams not exist.".format(args.resume)
assert os.path.exists("{}.pdopt".format(args.resume)), \
"Given resume optimizer state {}.pdopt not exist.".format(args.resume)
assert os.path.exists("{}.pdmodel".format(args.resume)), \
"Given resume model parameter list {}.pdmodel not exist.".format(args.resume)
if not os.path.isdir(args.resume):
assert os.path.exists("{}.pdparams".format(args.resume)), \
"Given resume weight {}.pdparams not exist.".format(args.resume)
assert os.path.exists("{}.pdopt".format(args.resume)), \
"Given resume optimizer state {}.pdopt not exist.".format(args.resume)
fluid.load(train_prog, args.resume, exe)
build_strategy = fluid.BuildStrategy()
......
......@@ -165,9 +165,10 @@ def eval():
exe.run(startup)
# load weights
assert os.path.exists("{}.pdparams".format(args.weights)), \
"Given resume weight {}.pdparams not exist.".format(args.weights)
fluid.load(eval_prog, args.weights)
if not os.path.isdir(args.weights):
assert os.path.exists("{}.pdparams".format(args.weights)), \
"Given resume weight {}.pdparams not exist.".format(args.weights)
fluid.load(eval_prog, args.weights, exe)
kitti_feature_dir = os.path.join(args.output_dir, 'features')
kitti_output_dir = os.path.join(args.output_dir, 'detections', 'data')
......
......@@ -187,12 +187,11 @@ def train():
exe.run(startup)
if args.resume:
assert os.path.exists("{}.pdparams".format(args.resume)), \
"Given resume weight {}.pdparams not exist.".format(args.resume)
assert os.path.exists("{}.pdopt".format(args.resume)), \
"Given resume optimizer state {}.pdopt not exist.".format(args.resume)
assert os.path.exists("{}.pdmodel".format(args.resume)), \
"Given resume model parameter list {}.pdmodel not exist.".format(args.resume)
if not os.path.isdir(args.resume):
assert os.path.exists("{}.pdparams".format(args.resume)), \
"Given resume weight {}.pdparams not exist.".format(args.resume)
assert os.path.exists("{}.pdopt".format(args.resume)), \
"Given resume optimizer state {}.pdopt not exist.".format(args.resume)
fluid.load(train_prog, args.resume, exe)
build_strategy = fluid.BuildStrategy()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册