# 100天深度学习--PartA：Week1-day4 VGG

AI基础 经典网络  收藏
0 / 694

## 简介

VGG-Net是2014年ILSVRC classification第二名，top-5 错误率7.32%(第一名是GoogLeNet)，ILSVRC localization 第一名。VGG-Net是由牛津大学视觉几何小组（Visual Geometry Group, VGG）提出,因此得名.

## 网络结构

VGG-Net 有五个stage，VGG-11 VGG-13 VGG-16 VGG-19

VGG的网络结构 分为五个stage， 不同层数的VGG，每个stage中的卷积层数目不同。

VGG16

## 源码

caffe ：

class VGG(nn.Module):
def __init__(self, vgg_name):
super(VGG, self).__init__()
self.features = self._make_layers(cfg[vgg_name])
self.classifier = nn.Linear(512, 10)

def forward(self, x):
out = self.features(x)
out = out.view(out.size(0), -1)
out = self.classifier(out)
return out

def _make_layers(self, cfg):
layers = []
in_channels = 3
for x in cfg:
if x == 'M':
layers += [nn.MaxPool2d(kernel_size=2, stride=2)]
else:
layers += [nn.Conv2d(in_channels, x, kernel_size=3, padding=1),
nn.BatchNorm2d(x),
nn.ReLU(inplace=True)]
in_channels = x
layers += [nn.AvgPool2d(kernel_size=1, stride=1)]
return nn.Sequential(*layers)


VGG11 BEST ACC. PERFORMANCE: 87.970%
VGG13 BEST ACC. PERFORMANCE: 90.200%
VGG16 BEST ACC. PERFORMANCE: 90.580%
VGG19 BEST ACC. PERFORMANCE: 90.610%