未验证 提交 0eab5c08 编写于 作者: X Xin Pan 提交者: GitHub

Merge pull request #1362 from panyx0718/fix2

fix model to use different names for train and test so that var name …
...@@ -92,13 +92,14 @@ def build_program(main_prog, startup_prog, train_params, is_train): ...@@ -92,13 +92,14 @@ def build_program(main_prog, startup_prog, train_params, is_train):
image, gt_box, gt_label, difficult = fluid.layers.read_file(py_reader) image, gt_box, gt_label, difficult = fluid.layers.read_file(py_reader)
locs, confs, box, box_var = mobile_net(class_num, image, image_shape) locs, confs, box, box_var = mobile_net(class_num, image, image_shape)
if is_train: if is_train:
with fluid.unique_name.guard("train"):
loss = fluid.layers.ssd_loss(locs, confs, gt_box, gt_label, box, loss = fluid.layers.ssd_loss(locs, confs, gt_box, gt_label, box,
box_var) box_var)
loss = fluid.layers.reduce_sum(loss) loss = fluid.layers.reduce_sum(loss)
optimizer = optimizer_setting(train_params) optimizer = optimizer_setting(train_params)
optimizer.minimize(loss) optimizer.minimize(loss)
else: else:
with fluid.unique_name.guard("inference"):
nmsed_out = fluid.layers.detection_output( nmsed_out = fluid.layers.detection_output(
locs, confs, box, box_var, nms_threshold=0.45) locs, confs, box, box_var, nms_threshold=0.45)
loss = fluid.evaluator.DetectionMAP( loss = fluid.evaluator.DetectionMAP(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册