未验证 提交 7b6758b4 编写于 作者: W wanghuancoder 提交者: GitHub

support stride and speed up (#8489)

* support stride and speed up

* refine
上级 76c86efa
......@@ -241,8 +241,8 @@ class SimOTAAssigner(object):
pos_inds, neg_inds, pos_gt_bboxes, pos_assigned_gt_inds \
= self.get_sample(assigned_gt_inds, gt_bboxes.numpy())
bbox_target = np.zeros_like(flatten_bboxes)
bbox_weight = np.zeros_like(flatten_bboxes)
bbox_target = np.zeros(flatten_bboxes.shape, paddle.common_ops_import.convert_dtype(flatten_bboxes.dtype))
bbox_weight = np.zeros_like(bbox_target)
label = np.ones([num_bboxes], dtype=np.int64) * self.num_classes
label_weight = np.zeros([num_bboxes], dtype=np.float32)
......
......@@ -175,6 +175,12 @@ class HungarianMatcher(nn.Layer):
C = C.reshape([bs, num_queries, -1])
C = [a.squeeze(0) for a in C.chunk(bs)]
sizes = [a.shape[0] for a in gt_bbox]
if hasattr(paddle.Tensor, "contiguous"):
indices = [
linear_sum_assignment(c.split(sizes, -1)[i].contiguous().numpy())
for i, c in enumerate(C)
]
else:
indices = [
linear_sum_assignment(c.split(sizes, -1)[i].numpy())
for i, c in enumerate(C)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册