【发布时间】:2020-11-23 02:48:18
【问题描述】:
主要问题是我不明白上采样的工作原理。 AlexNet 架构具有以下分类器
Dropout(),
Linear(in_features=9216, out_features=4096),
ReLU(),
Dropout(),
Linear(in_features=4096, out_features=4096),
ReLU(),
Linear(in_features=4096, out_features=1000)
上面是在 cifar 上使用的,所以类数是 1000。如果我们将分类器更改为使用 FCN(遵循FCN for Semantic Segmentation)并使用 VOC,我们将有 20 个类(为什么图中显示 21 个通道?)。图像大小调整为 256x256。论文中的架构如下所示
使用 pytorch 我有以下内容
class AlexNetFCN(nn.Module):
def __init__(self):
super().__init__()
self.features = AlexNet().features
self.classifier = nn.Sequential(
nn.Dropout(),
nn.Conv2d(256, 4096, kernel_size=6),
nn.ReLU(),
nn.Dropout(),
nn.Conv2d(4096, 4096, kernel_size=1),
nn.ReLU(),
nn.Conv2d(4096, 20, kernel_size=1),
)
def forward(self, x):
x = self.features(x)
x = self.classifier(x)
return x
我知道在特征部分之后我的图像是 7x7。如何上采样到 256x256?可能是nn.Bilinear,但我在论文中并不清楚。
【问题讨论】:
标签: python deep-learning computer-vision pytorch semantic-segmentation