未验证 提交 93de5e5f 编写于 作者: U ucsk 提交者: GitHub

fix 2 bugs (#7409)

* fix transposed convolution in_channels

* fix when deep_supervision is false
上级 1ee80501
...@@ -80,7 +80,7 @@ class MaskFeat(nn.Layer): ...@@ -80,7 +80,7 @@ class MaskFeat(nn.Layer):
mask_conv.add_sublayer( mask_conv.add_sublayer(
'conv5_mask', 'conv5_mask',
nn.Conv2DTranspose( nn.Conv2DTranspose(
in_channels=self.in_channel, in_channels=self.out_channel if num_convs > 0 else self.in_channel,
out_channels=self.out_channel, out_channels=self.out_channel,
kernel_size=2, kernel_size=2,
stride=2, stride=2,
......
...@@ -242,6 +242,8 @@ class SparseRCNNHead(nn.Layer): ...@@ -242,6 +242,8 @@ class SparseRCNNHead(nn.Layer):
loss_func="SparseRCNNLoss", loss_func="SparseRCNNLoss",
roi_input_shape=None, ): roi_input_shape=None, ):
super().__init__() super().__init__()
assert head_num_heads > 0, \
f'At least one RoI Head is required, but {head_num_heads}.'
# Build RoI. # Build RoI.
box_pooler = self._init_box_pooler(roi_input_shape) box_pooler = self._init_box_pooler(roi_input_shape)
...@@ -337,11 +339,11 @@ class SparseRCNNHead(nn.Layer): ...@@ -337,11 +339,11 @@ class SparseRCNNHead(nn.Layer):
inter_class_logits = [] inter_class_logits = []
inter_pred_bboxes = [] inter_pred_bboxes = []
for rcnn_head in self.head_series: for stage, rcnn_head in enumerate(self.head_series):
class_logits, pred_bboxes, proposal_features = rcnn_head( class_logits, pred_bboxes, proposal_features = rcnn_head(
features, bboxes, proposal_features, self.box_pooler) features, bboxes, proposal_features, self.box_pooler)
if self.return_intermediate: if self.return_intermediate or stage == len(self.head_series) - 1:
inter_class_logits.append(class_logits) inter_class_logits.append(class_logits)
inter_pred_bboxes.append(pred_bboxes) inter_pred_bboxes.append(pred_bboxes)
bboxes = pred_bboxes.detach() bboxes = pred_bboxes.detach()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册