未验证 提交 be4269fb 编写于 作者: G Guanghua Yu 提交者: GitHub

fix RCNN model deploy infer (#2276)

上级 84e79e87
...@@ -79,7 +79,6 @@ class RoIAlign(object): ...@@ -79,7 +79,6 @@ class RoIAlign(object):
sampling_ratio=self.sampling_ratio, sampling_ratio=self.sampling_ratio,
rois_num=rois_num_dist[lvl], rois_num=rois_num_dist[lvl],
aligned=self.aligned) aligned=self.aligned)
if roi_feat.shape[0] > 0:
rois_feat_list.append(roi_feat) rois_feat_list.append(roi_feat)
rois_feat_shuffle = paddle.concat(rois_feat_list) rois_feat_shuffle = paddle.concat(rois_feat_list)
rois_feat = paddle.gather(rois_feat_shuffle, restore_index) rois_feat = paddle.gather(rois_feat_shuffle, restore_index)
......
...@@ -85,9 +85,6 @@ class BBoxPostProcess(object): ...@@ -85,9 +85,6 @@ class BBoxPostProcess(object):
scale_y, scale_x = scale_factor[i][0], scale_factor[i][1] scale_y, scale_x = scale_factor[i][0], scale_factor[i][1]
scale = paddle.concat([scale_x, scale_y, scale_x, scale_y]) scale = paddle.concat([scale_x, scale_y, scale_x, scale_y])
expand_scale = paddle.expand(scale, [bbox_num[i], 4]) expand_scale = paddle.expand(scale, [bbox_num[i], 4])
# TODO: Because paddle.expand transform error when dygraph
# to static, use reshape to avoid mistakes.
expand_scale = paddle.reshape(expand_scale, [bbox_num[i], 4])
origin_shape_list.append(expand_shape) origin_shape_list.append(expand_shape)
scale_factor_list.append(expand_scale) scale_factor_list.append(expand_scale)
...@@ -158,7 +155,7 @@ class MaskPostProcess(object): ...@@ -158,7 +155,7 @@ class MaskPostProcess(object):
# TODO: support bs > 1 and mask output dtype is bool # TODO: support bs > 1 and mask output dtype is bool
pred_result = paddle.zeros( pred_result = paddle.zeros(
[num_mask, origin_shape[0][0], origin_shape[0][1]], dtype='int32') [num_mask, origin_shape[0][0], origin_shape[0][1]], dtype='int32')
if bboxes.shape[0] == 0: if bbox_num == 1 and bboxes[0][0] == -1:
return pred_result return pred_result
# TODO: optimize chunk paste # TODO: optimize chunk paste
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册