ZIPLeNet, AlexNet, VGG-16, SENet.zip2403_88021836871.21KB需要积分:1立即下载资源文件列表: LeNet, AlexNet, VGG-16, SENet.zip 大约有8个文件 AlexNet.py 1.5KB AlexNet_2.png 391.04KB lenet.png 320.05KB lenet.py 1.2KB SEBlock.png 40.57KB SEBlock.py 664B VGG-16.png 155.11KB vgg16.py 1.82KB 资源介绍: LeNet, AlexNet, VGG-16, SENet.zip import torch import torch.nn as nn class VGG16(nn.Module): def __init__(self): super(VGG16, self).__init__() self.features = nn.Sequential( nn.Conv2d(3, 64, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(64, 64, 3, 1, 1), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2), nn.Conv2d(64, 128, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(128, 128, 3, 1, 1), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2), nn.Conv2d(128, 256, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(256, 256, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(256, 256, 3, 1, 1), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2), nn.Conv2d(256, 512, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(512, 512, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(512, 512, 3, 1, 1), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2), nn.Conv2d(512, 512, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(512, 512, 3, 1, 1), nn.ReLU(inplace=True), nn.Conv2d(512, 512, 3, 1, 1), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2), ) self.fc = nn.Sequential( nn.Linear(7*7*512, 4096), nn.ReLU(inplace=True), nn.Linear(4096, 4096), nn.ReLU(inplace=True), nn.Linear(4096, 1000), ) def forward(self, x): x = self.features(x) x = x.reshape(x.shape[0], -1) x = self.fc(x) return x x = torch.randn(4, 3, 224, 224).cuda() model = VGG16().cuda() output = model(x) print(output.shape)