1.文章原文地址

ImageNet Classification with Deep Convolutional Neural Networks

2.文章摘要

我们训练了一个大型的深度卷积神经网络用于在ImageNet LSVRC-2010竞赛中,将120万(12百万)的高分辨率图像进行1000个类别的分类。在测试集上,网络的top-1和top-5误差分别为37.5%和17.0%,这结果极大的优于先前的最好结果。这个拥有6千万(60百万)参数和65万神经元的神经网络包括了五个卷积层,其中一些卷积层后面会跟着最大池化层,以及三个全连接层,其中全连接层是以1000维的softmax激活函数结尾的。为了可以训练的更快,我们使用了非饱和神经元(如Relu,激活函数输出没有将其限定在特定范围)和一个非常高效的GPU来完成卷积运算,为了减少过拟合,我们在全连接层中使用了近期发展起来的一种正则化方式,即dropout,它被证明是非常有效的。我们也使用了该模型的一个变体用于ILSVRC-2012竞赛中,并且以top-5的测试误差为15.3赢得比赛,该比赛中第二名的top-5测试误差为26.2%。

3.网络结构

4.Pytorch实现

 import torch.nn as nn
from torchsummary import summary try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url model_urls = {
'alexnet': 'https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth',
} class AlexNet(nn.Module):
def __init__(self,num_classes=1000):
super(AlexNet,self).__init__()
self.features=nn.Sequential(
nn.Conv2d(3,96,kernel_size=11,stride=4,padding=2), #(224+2*2-11)/4+1=55
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3,stride=2), #(55-3)/2+1=27
nn.Conv2d(96,256,kernel_size=5,stride=1,padding=2), #(27+2*2-5)/1+1=27
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3,stride=2), #(27-3)/2+1=13
nn.Conv2d(256,384,kernel_size=3,stride=1,padding=1), #(13+1*2-3)/1+1=13
nn.ReLU(inplace=True),
nn.Conv2d(384,384,kernel_size=3,stride=1,padding=1), #(13+1*2-3)/1+1=13
nn.ReLU(inplace=True),
nn.Conv2d(384,256,kernel_size=3,stride=1,padding=1), #13+1*2-3)/1+1=13
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3,stride=2), #(13-3)/2+1=6
) #6*6*256=9126 self.avgpool=nn.AdaptiveAvgPool2d((6,6))
self.classifier=nn.Sequential(
nn.Dropout(),
nn.Linear(256*6*6,4096),
nn.ReLU(inplace=True),
nn.Dropout(),
nn.Linear(4096,4096),
nn.ReLU(inplace=True),
nn.Linear(4096,num_classes),
) def forward(self,x):
x=self.features(x)
x=self.avgpool(x)
x=x.view(x.size(0),-1)
x=self.classifier(x)
return x def alexnet(pretrain=False,progress=True,**kwargs):
r"""
Args:
pretrained(bool):If True, retures a model pre-trained on IMageNet
progress(bool):If True, displays a progress bar of the download to stderr
"""
model=AlexNet(**kwargs)
if pretrain:
state_dict=load_state_dict_from_url(model_urls['alexnet'],
progress=progress)
model.load_state_dict(state_dict)
return model if __name__=="__main__":
model=alexnet()
print(summary(model,(3,224,224)))
 Output:
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 96, 55, 55] 34,944
ReLU-2 [-1, 96, 55, 55] 0
MaxPool2d-3 [-1, 96, 27, 27] 0
Conv2d-4 [-1, 256, 27, 27] 614,656
ReLU-5 [-1, 256, 27, 27] 0
MaxPool2d-6 [-1, 256, 13, 13] 0
Conv2d-7 [-1, 384, 13, 13] 885,120
ReLU-8 [-1, 384, 13, 13] 0
Conv2d-9 [-1, 384, 13, 13] 1,327,488
ReLU-10 [-1, 384, 13, 13] 0
Conv2d-11 [-1, 256, 13, 13] 884,992
ReLU-12 [-1, 256, 13, 13] 0
MaxPool2d-13 [-1, 256, 6, 6] 0
AdaptiveAvgPool2d-14 [-1, 256, 6, 6] 0
Dropout-15 [-1, 9216] 0
Linear-16 [-1, 4096] 37,752,832
ReLU-17 [-1, 4096] 0
Dropout-18 [-1, 4096] 0
Linear-19 [-1, 4096] 16,781,312
ReLU-20 [-1, 4096] 0
Linear-21 [-1, 1000] 4,097,000
================================================================
Total params: 62,378,344
Trainable params: 62,378,344
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.57
Forward/backward pass size (MB): 11.16
Params size (MB): 237.95
Estimated Total Size (MB): 249.69
----------------------------------------------------------------

参考

https://github.com/pytorch/vision/tree/master/torchvision/models

AlexNet网络的Pytorch实现的更多相关文章

  1. AlexNet 网络详解及Tensorflow实现源码

    版权声明:本文为博主原创文章,未经博主允许不得转载. 1. 图片数据处理 2. 卷积神经网络 2.1. 卷积层 2.2. 池化层 2.3. 全链层 3. AlexNet 4. 用Tensorflow搭 ...

  2. 第十六节,卷积神经网络之AlexNet网络实现(六)

    上一节内容已经详细介绍了AlexNet的网络结构.这节主要通过Tensorflow来实现AlexNet. 这里做测试我们使用的是CIFAR-10数据集介绍数据集,关于该数据集的具体信息可以通过以下链接 ...

  3. 第十五节,卷积神经网络之AlexNet网络详解(五)

    原文 ImageNet Classification with Deep ConvolutionalNeural Networks 下载地址:http://papers.nips.cc/paper/4 ...

  4. Caffe训练AlexNet网络,精度不高或者为0的问题结果

    当我们使用Caffe训练AlexNet网络时,会遇到精度一值在低精度(30%左右)升不上去,或者精度总是为0,如下图所示: 出现这种情况,可以尝试使用以下几个方法解决: 1.数据样本量是否太少,最起码 ...

  5. 如何使用 libtorch 实现 AlexNet 网络?

    如何使用 libtorch 实现 AlexNet 网络? 按照图片上流程写即可.输入的图片大小必须 227x227 3 通道彩色图片 // Define a new Module. struct Ne ...

  6. pytorch实现AlexNet网络

    直接上图吧 写网络就像搭积木

  7. 群等变网络的pytorch实现

    CNN对于旋转不具有等变性,对于平移有等变性,data augmentation的提出就是为了解决这个问题,但是data augmentation需要很大的模型容量,更多的迭代次数才能够在训练数据集合 ...

  8. AlexNet网络

    AlexNet 中包含了比较新的技术点,首次在CNN中成功应用了 ReLu .Dropout和LRN等Trick. 1.成功使用了Relu作为CNN的激活函数,并验证其效果在较深的网络中超过了Sigm ...

  9. U-Net网络的Pytorch实现

    1.文章原文地址 U-Net: Convolutional Networks for Biomedical Image Segmentation 2.文章摘要 普遍认为成功训练深度神经网络需要大量标注 ...

随机推荐

  1. 【嵌入式硬件Esp32】ESP32使用visual studio cod界面

     如何下载安装IDE Visual Studio Code大家可以在微软的官网上根据自身的开发平台下载,至于安装方法就是无脑式地按Next就好了,下载地址如下所示: Visual Studio Cod ...

  2. IP通信学习心得03

    三.TCP.三次握手.四次挥手 1.TCP数据包结构 注: A:序列号字段是所发字节的第一个字节的序号. B:报头最大长度为60个字节(4bits),最小为20个字节. C:  发送窗口由接收窗口决定 ...

  3. ubuntu mysql5.7设置Open Files Limit

    目的:解决Too many open files异常 方式:设置Open Files Limit 环境:(MySQL)Server version: 5.7.27-0ubuntu0.16.04.1 ( ...

  4. Markdown 语法 (转载)

    Markdown 语法整理大集合2017   1.标题 代码 注:# 后面保持空格 # h1 ## h2 ### h3 #### h4 ##### h5 ###### h6 ####### h7 // ...

  5. (转)基于FFPMEG2.0版本的ffplay代码分析

    ref:http://zzhhui.blog.sohu.com/304810230.html 背景说明 FFmpeg是一个开源,免费,跨平台的视频和音频流方案,它提供了一套完整的录制.转换以及流化音视 ...

  6. Linux磁盘管理系列 — 磁盘配额管理

    一.磁盘管理的概念 Linux系统是多用户任务操作系统,在使用系统时,会出现多用户共同使用一个磁盘的情况,如果其中少数几个用户占用了大量的磁盘空间,势必压缩其他用户的磁盘的空间和使用权限.因此,系统管 ...

  7. 递推问题 hdu 2046 与1143的比对

    2046 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数.例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图:   Input 输入数据由多行组成,每行 ...

  8. springboot项目实用代码整理

    // 判断JSONOBJECT是否为空 CommonUtils.checkJSONObjectIsEmpty(storeInfo) // 判断字符串是否为空," "也为空 Stri ...

  9. metasploit情报收集

    1.msf连接数据库 service postgresql start(postgresql默认用户名scott,密码tiger) msf > db_connect 用户名:密码@127.0.0 ...

  10. BASIS小问题汇总1

    try to start SAP system but failed 2019-04-04 Symptom: when i tried to start SAP system, using the c ...