论文要点:AlexNet(模型M+公式F+代码C)

# AlexNet

论文:ImageNet classification with deep convolutional neural networks by By Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton

1. 模型:

2. 代码:

# 代码来自动手学深度学习 by 李沐
# 实现AlexNet
import torch
from d2l import torch as d2l
from torch import nn

net = nn.Sequential(nn.Conv2d(1, 96, kernel_size=11, stride=4, padding=1), nn.ReLU(), 
                    nn.MaxPool2d(3, stride=2), 
                    nn.Conv2d(96, 256, kernel_size=5, padding=2), nn.ReLU(), 
                    nn.MaxPool2d(3, stride=2), 
                    nn.Conv2d(256, 384, kernel_size=3, padding=1), nn.ReLU(),
                    nn.Conv2d(384, 384, kernel_size=3, padding=1), nn.ReLU(),
                    nn.Conv2d(384, 384, kernel_size=3, padding=1), nn.ReLU(),
                    nn.MaxPool2d(3, stride=2), 
                    nn.Flatten(),
                    nn.Linear(9600, 4096), nn.ReLU(), nn.Dropout(p=0.5),
                    nn.Linear(4096, 4096), nn.ReLU(), nn.Dropout(p=0.5),
                    nn.Linear(4096, 10)
                   )

batch_size = 128
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size, resize=224)

lr, num_epochs = 0.01, 10
d2l.train_ch6(net, train_iter, test_iter, num_epochs, lr, d2l.try_gpu())

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值