LeNet, AlexNet, VGG-16, SENet.zip
大小:871.21KB
价格:39积分
下载量:0
评分:
5.0
上传者:2403_88021836
更新日期:2024-10-23

LeNet, AlexNet, VGG-16, SENet.zip

资源文件列表(大概)

文件名
大小
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 torchimport torch.nn as nnclass 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 xx = torch.randn(4, 3, 224, 224).cuda()model = VGG16().cuda()output = model(x)print(output.shape)

用户评论 (0)

发表评论

captcha