经典CNN卷积神经网络架构全解析:LeNet、AlexNet、GoogleNet、ResNet、DenseNet

经典CNN卷积神经网络架构全解析:LeNet、AlexNet、GoogleNet、ResNet、DenseNet

卷积神经网络 (CNN)深度学习中的一种神经网络架构,用于从结构化数组中识别模式。然而,多年来,CNN 架构已经发展起来。基本 CNN 架构的许多变体已经开发出来,从而为不断发展的深度学习领域带来了惊人的进步。

下面,让我们讨论一下 CNN 架构是如何随着时间的推移而发展和成长的。

1.LeNet-5

  • 第一个LeNet-5架构是最广为人知的CNN架构。它于1998年推出,广泛用于手写方法数字识别。

  • LeNet-5 有 2 个卷积层和 3 个完整层。

  • 这个LeNet-5架构有60,000个参数。结构如下:

  • LeNet-5 能够处理需要更大、更多 CNN 卷积层的更高分辨率图像。

  • leNet-5 技术是通过所有计算资源的可用性来衡量的

LeNet-5网络构建

LeNet-5 代码示例

import torch 
from torchsummary import summary 
import torch.nn as nn 
import torch.nn.functional as F class LeNet5(nn.Module): 
 def __init__(self): 
  # Call the parent class's init method 
  super(LeNet5, self).__init__()     # First Convolutional Layer 
  self.conv1 = nn.Conv2d(in_channels=1, out_channels=6, kernel_size=5, stride=1)     # Max Pooling Layer 
  self.pool = nn.MaxPool2d(kernel_size=2, stride=2)     # Second Convolutional Layer 
  self.conv2 = nn.Conv2d(in_channels=6, out_channels=16, kernel_size=5, stride=1)     # First Fully Connected Layer 
  self.fc1 = nn.Linear(in_features=16 * 5 * 5, out_features=120)     # Second Fully Connected Layer 
  self.fc2 = nn.Linear(in_features=120, out_features=84)     # Output Layer 
  self.fc3 = nn.Linear(in_features=84, out_features=10)  def forward(self, x): 
  # Pass the input through the first convolutional layer and activation function 
  x = self.pool(F.relu(self.conv1(x)))     # Pass the output of the first layer through 
  # the second convolutional layer and activation function 
  x = self.pool(F.relu(self.conv2(x)))     # Reshape the output to be passed through the fully connected layers 
  x = x.view(-1, 16 * 5 * 5)     # Pass the output through the first fully connected layer and activation function 
  x = F.relu(self.fc1(x))     # Pass the output of the first fully connected layer through 
  # the second fully connected layer and activation function 
  x = F.relu(self.fc2(x))     # Pass the output of the second fully connected layer through the output layer 
  x = self.fc3(x)     # Return the final output 
  return x  lenet5 = LeNet5() 
print(lenet5)

输出:

LeNet5(
  (conv1): Conv2d(1, 6, kernel_size=(5, 5), stride=(1, 1))
  (pool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  (conv2): Conv2d(6, 16, kernel_size=(5, 5), stride=(1, 1))
  (fc1): Linear(in_features=400, out_features=120
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jack_pirate

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值