diff --git a/ppdet/modeling/heads/solov2_head.py b/ppdet/modeling/heads/solov2_head.py index 9104b7d2aaf11ed494074d1eda9f10f8a3c3855c..ac5ebe7df79426045e2b4d8057b54c78968ef89f 100644 --- a/ppdet/modeling/heads/solov2_head.py +++ b/ppdet/modeling/heads/solov2_head.py @@ -462,7 +462,8 @@ class SOLOv2Head(nn.Layer): # cate_labels & kernel_preds cate_labels = inds[:, 1] kernel_preds = paddle.gather(kernel_preds, index=inds[:, 0]) - cate_score_idx = paddle.add(inds[:, 0] * 80, cate_labels) + cate_score_idx = paddle.add(inds[:, 0] * self.cate_out_channels, + cate_labels) cate_scores = paddle.gather(cate_preds, index=cate_score_idx) size_trans = np.power(self.seg_num_grids, 2) diff --git a/static/ppdet/modeling/anchor_heads/solov2_head.py b/static/ppdet/modeling/anchor_heads/solov2_head.py index 17473110dfc5a7877e6d732031a7beb2c689024e..590b428e8ae46bd3065a7ef44844b4f787c5b12f 100644 --- a/static/ppdet/modeling/anchor_heads/solov2_head.py +++ b/static/ppdet/modeling/anchor_heads/solov2_head.py @@ -367,8 +367,8 @@ class SOLOv2Head(object): # cate_labels & kernel_preds cate_labels = inds[:, 1] kernel_preds = fluid.layers.gather(kernel_preds, index=inds[:, 0]) - cate_score_idx = fluid.layers.elementwise_add(inds[:, 0] * 80, - cate_labels) + cate_score_idx = fluid.layers.elementwise_add( + inds[:, 0] * self.cate_out_channels, cate_labels) cate_scores = fluid.layers.gather(cate_preds, index=cate_score_idx) size_trans = np.power(self.seg_num_grids, 2)