语义分割中的上采样 [英] Upsampling in Semantic Segmentation
问题描述
我正在尝试实施有关语义分割的论文,并且对如何对分割网络生成的预测图进行升采样以匹配输入图像大小感到困惑.
I am trying to implement a paper on Semantic Segmentation and I am confused about how to Upsample the prediction map produced by my segmentation network to match the input image size.
例如,我使用Resnet101的变体作为细分网络(如本文所用).通过这种网络结构,大小为321x321(在本文中再次使用)的输入会生成大小为41x41xC(C是类别数)的最终预测图.由于必须进行像素级的预测,因此需要将其上采样到321x321xC.Pytorch提供向上采样功能,使输出尺寸为预测图尺寸的倍数.因此,我不能在这里直接使用该方法.
For example, I am using a variant of Resnet101 as the segmentation network (as used by the paper). With this network structure, an input of size 321x321 (again used in the paper) produces a final prediction map of size 41x41xC (C is the number of classes). Because I have to make pixel-level predictions, I need to upsample it to 321x321xC. Pytorch provides function to Upsample to an output size which is a multiple of the prediction map size. So, I can not directly use that method here.
由于此步骤涉及每个语义细分网络,因此我确信应该有一种标准的方法来实现此目的.
Because this step is involved in every semantic segmentation network, I am sure there should be a standard way to implement this.
任何指针,我将不胜感激.预先感谢.
I would appreciate any pointers. Thanks in advance.
推荐答案
也许您可以尝试的最简单的方法是:
Maybe the simpliest thing you can try is:
- 上采样8次.然后您将41x41输入变成328x328
- 执行中心裁剪以得到所需的形状321x321(例如,类似以下输入[3:,3:,:-4,:-4])
这篇关于语义分割中的上采样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!