提交 56192f10 编写于 作者: J jerrywgz 提交者: qingqing01

no padding for eval (#1263)

上级 a9a834bc
......@@ -74,8 +74,7 @@ def prep_im_for_blob(im, pixel_means, target_size, max_size):
fy=im_scale,
interpolation=cv2.INTER_LINEAR)
im_height, im_width, channel = im.shape
padding_im = np.zeros((max_size, max_size, im_shape[2]), dtype=np.float32)
padding_im[:im_height, :im_width, :] = im
padding_im = im
#print(padding_im[10:, 10:, :])
channel_swap = (2, 0, 1) #(batch, channel, height, width)
#im = im.transpose(channel_swap)
......
......@@ -72,7 +72,8 @@ def eval(args):
is_train=False,
use_random=False)
model.build_model(image_shape)
rpn_rois, confs, locs = model.eval_out()
rpn_rois, scores, locs = model.eval_out()
confs = fluid.layers.softmax(scores, use_cudnn=False)
place = fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace()
exe = fluid.Executor(place)
# yapf: disable
......@@ -90,12 +91,23 @@ def eval(args):
start = time.time()
#image, gt_box, gt_label, is_crowd, im_info, im_id = data[0]
im_info = []
image = []
for i in range(len(data)):
im_info.append(data[i][4])
image.append(data[i][0])
image_t = fluid.core.LoDTensor()
image_t.set(image, place)
im_info_t = fluid.core.LoDTensor()
im_info_t.set(im_info, place)
feeding = {}
feeding['image'] = image_t
feeding['im_info'] = im_info_t
rpn_rois_v, confs_v, locs_v = exe.run(
fetch_list=[v.name for v in fetch_list],
feed=feeder.feed(data),
#feed=feeder.feed(data),
feed=feeding,
return_numpy=False)
new_lod, nmsed_out = get_nmsed_box(args, rpn_rois_v, confs_v, locs_v,
class_nums, im_info,
......
......@@ -65,7 +65,7 @@ def train(cfg):
add_conv_body_func=resnet.add_ResNet50_conv4_body,
add_roi_box_head_func=resnet.add_ResNet_roi_conv5_head,
use_pyreader=cfg.use_pyreader,
use_random=False)
use_random=True)
model.build_model(image_shape)
loss_cls, loss_bbox, rpn_cls_loss, rpn_reg_loss = model.loss()
loss_cls.persistable=True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册