小编Naz*_*zzz的帖子

为什么VGG-16采用输入大小512 * 7 * 7?

根据https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py

我不明白为什么 VGG 模型采用 512 * 7 * 7 全连接层的 input_size 。最后一个卷积层是

  • nn.Conv2d(512, 512, kernel_size=3, padding=1),
  • nn.ReLU(True),
  • nn.MaxPool2d(kernel_size=2, stride=2, dilation=1)

代码在上面的链接中。

class VGG(nn.Module):

    def __init__(self, features, num_classes=1000, init_weights=True):
        super(VGG, self).__init__()
        self.features = features
        self.classifier = nn.Sequential(
            nn.Linear(512 * 7 * 7, 4096),
            nn.ReLU(True),
            nn.Dropout(),
            nn.Linear(4096, 4096),
            nn.ReLU(True),
            nn.Dropout(),
            nn.Linear(4096, num_classes),
        )
Run Code Online (Sandbox Code Playgroud)

neural-network pytorch vgg-net

2
推荐指数
2
解决办法
6404
查看次数

标签 统计

neural-network ×1

pytorch ×1

vgg-net ×1