weixin_39747049
2020-12-28 10:09 阅读 16

fpn_head的疑惑

在fpn_head中, 已经通过叠加conv + upsample 2*, 到4倍特征图大小了, 为什么在forwad函数还会再进行一次upsample? 是有相关的考虑, 还是代码冗余?

该提问来源于开源项目:open-mmlab/mmsegmentation

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39633455 weixin_39633455 2020-12-28 10:09

    So the question is: in the fpn_head, there's already upsampled the feature maps to stride 4 sizes by stacked conv + upsample 2*. Why use upsample again in the forward? Answer: because the stacked conv +upsample are only defined in the init and is not working. In the forward phase, the stacked conv & upsample are performed to process the feature maps. Hope this helps.

    点赞 评论 复制链接分享
  • weixin_39747049 weixin_39747049 2020-12-28 10:09

    So the question is: in the fpn_head, there's already upsampled the feature maps to stride 4 sizes by stacked conv + upsample 2. Why use upsample again in the forward? Answer: because the stacked conv +upsample are only defined in the init* and is not working. In the forward phase, the stacked conv & upsample are performed to process the feature maps. Hope this helps.

    I didn't mean that. I understand what you said. Conv + upsample defined in init with scale_head and in forward phase, it works. But after scale_head operator, another reisze operation follows.That's where I wonder.

    ` output = self.scale_heads0

        for i in range(1, len(self.feature_strides)):
    
            # non inplace
    
            output = output + resize(
    
                self.scale_heads[i](x[i]),
    
                size=output.shape[2:],
    
                mode='bilinear',
    
                align_corners=self.align_corners)`
    
    点赞 评论 复制链接分享
  • weixin_39633455 weixin_39633455 2020-12-28 10:09

    So the question is: in the fpn_head, there's already upsampled the feature maps to stride 4 sizes by stacked conv + upsample 2. Why use upsample again in the forward? Answer: because the stacked conv +upsample are only defined in the init* and is not working. In the forward phase, the stacked conv & upsample are performed to process the feature maps. Hope this helps.

    I didn't mean that. I understand what you said. Conv + upsample defined in init with scale_head and in forward phase, it works. But after scale_head operator, another reisze operation follows.That's where I wonder.

    ` output = self.scale_heads0

    
        for i in range(1, len(self.feature_strides)):
    <pre><code>    # non inplace
    
        output = output + resize(
    
            self.scale_heads[i](x[i]),
    
            size=output.shape[2:],
    
            mode='bilinear',
    
            align_corners=self.align_corners)`
    

    Well, I got your point. I think this is generalized to different resolutions. For example, if your inputs offpn_head have a shape with [100, 50, 25, 12]. Consider the 4th-level feature map, after stacked conv & 2x upsample, it become 12*8=96, which is not matched with the first output(100). Thus, the resize is necessary here. Hope this helps.

    点赞 评论 复制链接分享
  • weixin_39747049 weixin_39747049 2020-12-28 10:09

    是的, 你是对的, 非常感谢您的回复!

    点赞 评论 复制链接分享

相关推荐