未验证 提交 e3f8dd16 编写于 作者: W wangguanzhong 提交者: GitHub

update rcnn fit for paddle 2.2 (#7707)

上级 96571ec8
...@@ -88,15 +88,11 @@ class RoIAlign(object): ...@@ -88,15 +88,11 @@ class RoIAlign(object):
k_min = self.start_level + offset k_min = self.start_level + offset
k_max = self.end_level + offset k_max = self.end_level + offset
if hasattr(paddle.vision.ops, "distribute_fpn_proposals"): if hasattr(paddle.vision.ops, "distribute_fpn_proposals"):
rois_dist, restore_index, rois_num_dist = paddle.vision.ops.distribute_fpn_proposals( distribute_fpn_proposals = getattr(paddle.vision.ops,
roi, "distribute_fpn_proposals")
k_min,
k_max,
self.canconical_level,
self.canonical_size,
rois_num=rois_num)
else: else:
rois_dist, restore_index, rois_num_dist = ops.distribute_fpn_proposals( distribute_fpn_proposals = ops.distribute_fpn_proposals
rois_dist, restore_index, rois_num_dist = distribute_fpn_proposals(
roi, roi,
k_min, k_min,
k_max, k_max,
......
...@@ -63,20 +63,11 @@ class ProposalGenerator(object): ...@@ -63,20 +63,11 @@ class ProposalGenerator(object):
top_n = self.pre_nms_top_n if self.topk_after_collect else self.post_nms_top_n top_n = self.pre_nms_top_n if self.topk_after_collect else self.post_nms_top_n
variances = paddle.ones_like(anchors) variances = paddle.ones_like(anchors)
if hasattr(paddle.vision.ops, "generate_proposals"): if hasattr(paddle.vision.ops, "generate_proposals"):
rpn_rois, rpn_rois_prob, rpn_rois_num = paddle.vision.ops.generate_proposals( generate_proposals = getattr(paddle.vision.ops,
scores, "generate_proposals")
bbox_deltas,
im_shape,
anchors,
variances,
pre_nms_top_n=self.pre_nms_top_n,
post_nms_top_n=top_n,
nms_thresh=self.nms_thresh,
min_size=self.min_size,
eta=self.eta,
return_rois_num=True)
else: else:
rpn_rois, rpn_rois_prob, rpn_rois_num = ops.generate_proposals( generate_proposals = ops.generate_proposals
rpn_rois, rpn_rois_prob, rpn_rois_num = generate_proposals(
scores, scores,
bbox_deltas, bbox_deltas,
im_shape, im_shape,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册