LeNet
1.网络架构
抛开SVM支持向量机和MLP多层感知机,接触的第一个CNN网络架构
如图所示可见其结构为:

输入的二维图像处理后,先经过两次卷积层到池化层,再经过全连接层,最后使用softmax分类作为输出层。
2.pytorch网络设计
网络构造代码部分:
class LeNet5(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 6, 5, padding=2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)
def forward(self, x):
x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2))
x = F.max_pool2d(F.relu(self.conv2(x)), (2, 2))
x = x.view(x.shape[0], -1)
x = F.relu(self.fc1(x))
x = F.relu(self.fc2

最低0.47元/天 解锁文章
335

被折叠的 条评论
为什么被折叠?



