Skip to content

Commit f4181d7

Browse files
authored
Merge pull request #6 from PaddlePaddle/master
update
2 parents 4520879 + 1c1b703 commit f4181d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2828
-270
lines changed

README.md

+57-30
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,106 @@
1-
## 简介
1+
# 一、简介
22

33
本项目是深度学习赋能材料获取一站式平台,内容涵盖深度学习教程、理论知识点解读、产业实践案例、常用Tricks和前沿论文复现等。从理论到实践,从科研到产业应用,各类学习材料一应俱全,旨在帮助开发者高效学习和掌握深度学习知识,快速成为AI跨界人才。
44

5-
- **内容全面**
5+
* **内容全面**:无论您是深度学习初学者,还是资深用户,都可以在本项目中快速获取到需要的学习材料。
66

7-
无论您是深度学习初学者,还是资深用户,都可以在本项目中快速获取到需要的学习材料
7+
* **形式丰富** :赋能材料形式多样,包括可在线运行的notebook、视频、书籍、B站直播等,满足您随时随地学习的需求
88

9-
- **形式丰富**
9+
* **实践代码实时更新**:本项目中涉及到的代码均匹配Paddle最新发布版本,开发者可以实时学习最新的深度学习任务实现方案。
1010

11-
赋能材料形式多样,包括可在线运行的notebook、视频、书籍、B站直播等,满足您随时随地学习的需求。
12-
13-
- **实践代码实时更新**
14-
15-
本项目中涉及到的代码均匹配Paddle最新发布版本,开发者可以实时学习最新的深度学习任务实现方案。
16-
17-
- **前沿知识分享**
18-
19-
定期分享顶会最新论文解读和代码复现,开发者可以实时掌握最新的深度学习算法。
11+
* **前沿知识分享** :定期分享顶会最新论文解读和代码复现,开发者可以实时掌握最新的深度学习算法。
2012

2113

2214

2315
## 最新动态
2416

2517
2021年5月14日-5月20日,B站《零基础实践深度学习》7日打卡课,扫描下方二维码快速入群,了解最新的课程信息。
2618

27-
<center><img src="https://github.com/ZhangHandi/images-for-paddledocs/blob/main/images/readme/qr_code.png?raw=true"/></center><br></br>
19+
<center><img src="https://github.com/ZhangHandi/images-for-paddledocs/blob/main/images/readme/qr_code.png?raw=true"/></center>
20+
<br></br>
2821

2922

3023

31-
## 内容概览
24+
# 二、内容概览
3225

33-
* ### 零基础实践深度学习
26+
## 1. 零基础实践深度学习
3427

35-
- **[AI Studio在线课程:《零基础实践深度学习》](https://aistudio.baidu.com/aistudio/course/introduce/1297
28+
- **[AI Studio在线课程:《零基础实践深度学习》](https://aistudio.baidu.com/aistudio/course/introduce/1297
3629
)**:理论和代码结合、实践与平台结合,包含20小时视频课程,由百度杰出架构师、飞桨产品负责人和资深研发人员共同打造。
3730

3831
<center><img src="https://github.com/ZhangHandi/images-for-paddledocs/blob/main/images/readme/aistudio.png?raw=true"/></center><br></br>
3932

40-
41-
42-
4333

4434
- **《零基础实践深度学习》书籍**:由清华出版社2020年底发行,京东/当当等电商均有销售。
4535

4636
<center><img src="https://github.com/ZhangHandi/images-for-paddledocs/blob/main/images/readme/book.png?raw=true"/></center><br></br>
4737

4838

4939

50-
* ### 深度学习100问
51-
52-
已完成的内容,请补充目录和链接
53-
40+
## 2. [深度学习1000问](https://paddlepedia.readthedocs.io/en/latest/index.html)
41+
42+
* [深度学习](https://paddlepedia.readthedocs.io/en/latest/tutorials/deep_learning/index.html#)
43+
* [优化策略](https://paddlepedia.readthedocs.io/en/latest/tutorials/deep_learning/optimizers/index.html)(包括什么是优化器,GD,SGD,BGD,鞍点,Momentum,NAG,Adagrad,AdaDelta,RMSProp,Adam,AdaMax,Nadam,AMSGrad,AdaBound,AdamW,RAdam,Lookahead等18个知识点)
44+
* [激活函数](https://paddlepedia.readthedocs.io/en/latest/tutorials/deep_learning/loss_functions/index.html)
45+
* [常用损失函数](https://paddlepedia.readthedocs.io/en/latest/tutorials/deep_learning/loss_functions/index.html)
46+
* [模型调优](https://paddlepedia.readthedocs.io/en/latest/tutorials/deep_learning/model_tuning/index.html#)
47+
* [正则化](https://paddlepedia.readthedocs.io/en/latest/tutorials/deep_learning/model_tuning/regularization/index.html)(包括什么是正则化?正则化如何帮助减少过度拟合?数据增强,L1 L2正则化介绍,L1和L2的贝叶斯推断分析法,Dropout,DropConnect,早停法等8个知识点)
48+
* [计算机视觉](https://paddlepedia.readthedocs.io/en/latest/tutorials/computer_vision/index.html)
49+
* [卷积算子](https://paddlepedia.readthedocs.io/en/latest/tutorials/computer_vision/convolution_operator/index.html)
50+
* [图像增广](https://paddlepedia.readthedocs.io/en/latest/tutorials/computer_vision/image_augmentation/index.html)
51+
* [卷积神经网络](https://paddlepedia.readthedocs.io/en/latest/tutorials/computer_vision/convolution_network/index.html)
52+
* [图像分类](https://paddlepedia.readthedocs.io/en/latest/tutorials/computer_vision/classification/index.html)
53+
* [目标检测](https://paddlepedia.readthedocs.io/en/latest/tutorials/computer_vision/object_detection/index.html)
54+
* [自然语言处理](https://paddlepedia.readthedocs.io/en/latest/tutorials/natural_language_processing/index.html)
55+
* [词表示](https://paddlepedia.readthedocs.io/en/latest/tutorials/natural_language_processing/word_representation/index.html)
56+
* [序列模型](https://paddlepedia.readthedocs.io/en/latest/tutorials/natural_language_processing/sequence_model/index.html)(包括GRU,LSTM,RNN等3个知识点)
57+
* [命名实体识别](https://paddlepedia.readthedocs.io/en/latest/tutorials/natural_language_processing/ner/index.html)
58+
* [预训练模型](https://paddlepedia.readthedocs.io/en/latest/tutorials/pretrain_model/index.html)
59+
* [预训练模型是什么](https://paddlepedia.readthedocs.io/en/latest/tutorials/pretrain_model/pretrain_model_description.html)
60+
* [预训练分词Subword](https://paddlepedia.readthedocs.io/en/latest/tutorials/pretrain_model/subword.html)(包括BPE,WordPiece,ULM等3个知识点)
61+
* [Transformer](https://paddlepedia.readthedocs.io/en/latest/tutorials/pretrain_model/transformer.html)(包括self-attention,multi-head Attention,Position Encoding, Transformer Encoder, Transformer Decoder等5个知识点)
62+
* [BERT](https://paddlepedia.readthedocs.io/en/latest/tutorials/pretrain_model/bert.html)(包括BERT预训练任务,BERT微调等2个知识点)
63+
* [ERNIE](https://paddlepedia.readthedocs.io/en/latest/tutorials/pretrain_model/erine.html)
64+
* [推荐系统](https://paddlepedia.readthedocs.io/en/latest/tutorials/recommendation_system/index.html)
65+
* [推荐系统基础](https://paddlepedia.readthedocs.io/en/latest/tutorials/recommendation_system/recommender_system.html)(包括协同过滤推荐,内容过滤推荐,组合推荐,用户画像,召回,排序等6个知识点)
66+
* [DSSM模型](https://paddlepedia.readthedocs.io/en/latest/tutorials/recommendation_system/dssm.html)(包括DSSM模型等1个知识点)
67+
* [对抗神经网络](https://paddlepedia.readthedocs.io/en/latest/tutorials/generative_adversarial_network/index.html)
68+
* [encoder-decoder](https://paddlepedia.readthedocs.io/en/latest/tutorials/generative_adversarial_network/encoder_decoder/index.html)
69+
* [GAN基本概念](https://paddlepedia.readthedocs.io/en/latest/tutorials/generative_adversarial_network/basic_concept/index.html)
70+
* [GAN评价指标](https://paddlepedia.readthedocs.io/en/latest/tutorials/generative_adversarial_network/gan_metric/index.html)
71+
* [GAN应用](https://paddlepedia.readthedocs.io/en/latest/tutorials/generative_adversarial_network/gan_applications/index.html)
72+
* [强化学习](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/index.html)
73+
* [强化学习基础知识点](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/basic_information.html)
74+
* [马尔可夫决策过程](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/markov_decision_process.html)
75+
* [策略梯度定理](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/policy_gradient.html)
76+
* [蒙特卡洛策略梯度定理](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/policy_gradient.html)
77+
* [REINFORCE算法](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/policy_gradient.html#reinforce)
78+
* [SARSA](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/Sarsa.html)(包括SARSA的公式,优缺点等2个知识点)
79+
* [Q-Learning](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/Q-learning.html)(包括Q-Learning的公式,优缺点等2个知识点)
80+
* [DQN](https://paddlepedia.readthedocs.io/en/latest/tutorials/reinforcement_learning/DQN.html#)
5481

82+
详细信息请参阅[Paddle知识点文档平台](https://paddlepedia.readthedocs.io/en/latest/index.html)
83+
5584

56-
* ### 产业实践深度学习(开发中)
85+
## 3. 产业实践深度学习(开发中)
5786

5887

5988

60-
## 技术交流
89+
# 三、技术交流
6190

6291
非常感谢您使用本项目。您在使用过程中有任何建议或意见,可以在 **[Issue](https://github.com/PaddlePaddle/tutorials/issues)** 上反馈给我们,也可以通过扫描下方的二维码联系我们,飞桨的开发人员非常高兴能够帮助到您,并与您进行更深入的交流和技术探讨。
6392

64-
信息。
65-
6693
<center><img src="https://github.com/ZhangHandi/images-for-paddledocs/blob/main/images/readme/qr_code.png?raw=true"/></center><br></br>
6794

6895

6996

70-
## 许可证书
97+
# 四、许可证书
7198

7299
本项目的发布受[Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.txt)许可认证。
73100

74101

75102

76-
## 贡献内容
103+
# 五、贡献内容
77104

78105
本项目的不断成熟离不开各位开发者的贡献,如果您对深度学习知识分享感兴趣,非常欢迎您能贡献给我们,让更多的开发者受益。
79106

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# AlexNet
2+
3+
## 模型介绍
4+
5+
AlexNet是2012年ImageNet竞赛的冠军模型,作者是神经网络领域三巨头之一的Hinton和他的学生Alex Krizhevsky。AlexNet以极大的优势领先2012年ImageNet竞赛的第二名,也因此给当时的学术界和工业界带来了很大的冲击。此后,更多更深的神经网络被提出,比如优秀的VGG,GoogLeNet,ResNet等。
6+
7+
## 模型结构
8+
9+
10+
AlexNet与此前的LeNet相比,具有更深的网络结构,包含5层卷积和3层全连接,具体结构如 **图1** 所示:
11+
12+
<br></br>
13+
14+
<center><img src="https://raw.githubusercontent.com/lvjian0706/Deep-Learning-Img/master/CNN/Classical_model/AlexNet.png" width = "1000"></center>
15+
<center><br>图1:AlexNet模型网络结构示意图</br></center>
16+
17+
<br></br>
18+
19+
1)第一模块:对于$224\times 224$的彩色图像,先用96个$11\times 11\times 3$的卷积核对其进行卷积,提取图像中包含的特征模式(步长为4,填充为2,得到96个$54\times 54$的卷积结果(特征图);然后以$2\times 2$大小进行池化,得到了96个$27\times 27$大小的特征图;
20+
21+
2)第二模块:包含256个$5\times 5$的卷积和$2\times 2$池化,卷积操作后图像尺寸不变,经过池化后,图像尺寸变成$13\times 13$;
22+
23+
3)第三模块:包含384个$3\times 3$的卷积,卷积操作后图像尺寸不变;
24+
25+
4)第四模块:包含384个$3\times 3$的卷积,卷积操作后图像尺寸不变;
26+
27+
5)第五模块:包含256个$3\times 3$的卷积和$2\times 2$的池化,卷积操作后图像尺寸不变,经过池化后变成256个$6\times 6$大小的特征图。
28+
29+
将经过第5次卷积提取到的特征图输入到全连接层,得到原始图像的向量表达。前两个全连接层的输出神经元的个数是4096,第三个全连接层的输出神经元个数是分类标签的类别数(对于ImageNet比赛的类别数是1000),然后使用Softmax激活函数即可计算出每个类别的预测概率。
30+
31+
## 模型实现
32+
33+
基于Paddle框架,AlexNet的具体实现的代码如下所示:
34+
35+
36+
```python
37+
# -*- coding:utf-8 -*-
38+
39+
# 导入需要的包
40+
import paddle
41+
import numpy as np
42+
from paddle.nn import Conv2D, MaxPool2D, Linear, Dropout
43+
## 组网
44+
import paddle.nn.functional as F
45+
46+
# 定义 AlexNet 网络结构
47+
class AlexNet(paddle.nn.Layer):
48+
def __init__(self, num_classes=1):
49+
super(AlexNet, self).__init__()
50+
# AlexNet与LeNet一样也会同时使用卷积和池化层提取图像特征
51+
# 与LeNet不同的是激活函数换成了‘relu’
52+
self.conv1 = Conv2D(in_channels=3, out_channels=96, kernel_size=11, stride=4, padding=5)
53+
self.max_pool1 = MaxPool2D(kernel_size=2, stride=2)
54+
self.conv2 = Conv2D(in_channels=96, out_channels=256, kernel_size=5, stride=1, padding=2)
55+
self.max_pool2 = MaxPool2D(kernel_size=2, stride=2)
56+
self.conv3 = Conv2D(in_channels=256, out_channels=384, kernel_size=3, stride=1, padding=1)
57+
self.conv4 = Conv2D(in_channels=384, out_channels=384, kernel_size=3, stride=1, padding=1)
58+
self.conv5 = Conv2D(in_channels=384, out_channels=256, kernel_size=3, stride=1, padding=1)
59+
self.max_pool5 = MaxPool2D(kernel_size=2, stride=2)
60+
61+
self.fc1 = Linear(in_features=12544, out_features=4096)
62+
self.drop_ratio1 = 0.5
63+
self.drop1 = Dropout(self.drop_ratio1)
64+
self.fc2 = Linear(in_features=4096, out_features=4096)
65+
self.drop_ratio2 = 0.5
66+
self.drop2 = Dropout(self.drop_ratio2)
67+
self.fc3 = Linear(in_features=4096, out_features=num_classes)
68+
69+
def forward(self, x):
70+
x = self.conv1(x)
71+
x = F.relu(x)
72+
x = self.max_pool1(x)
73+
x = self.conv2(x)
74+
x = F.relu(x)
75+
x = self.max_pool2(x)
76+
x = self.conv3(x)
77+
x = F.relu(x)
78+
x = self.conv4(x)
79+
x = F.relu(x)
80+
x = self.conv5(x)
81+
x = F.relu(x)
82+
x = self.max_pool5(x)
83+
x = paddle.reshape(x, [x.shape[0], -1])
84+
x = self.fc1(x)
85+
x = F.relu(x)
86+
# 在全连接之后使用dropout抑制过拟合
87+
x = self.drop1(x)
88+
x = self.fc2(x)
89+
x = F.relu(x)
90+
# 在全连接之后使用dropout抑制过拟合
91+
x = self.drop2(x)
92+
x = self.fc3(x)
93+
return x
94+
95+
```
96+
97+
## 模型特点
98+
99+
AlexNet中包含了几个比较新的技术点,也首次在CNN中成功应用了ReLU、Dropout和LRN等Trick。同时AlexNet也使用了GPU进行运算加速。
100+
101+
AlexNet将LeNet的思想发扬光大,把CNN的基本原理应用到了很深很宽的网络中。AlexNet主要使用到的新技术点如下:
102+
103+
- 成功使用ReLU作为CNN的激活函数,并验证其效果在较深的网络超过了Sigmoid,成功解决了Sigmoid在网络较深时的梯度弥散问题。虽然ReLU激活函数在很久之前就被提出了,但是直到AlexNet的出现才将其发扬光大。
104+
- 训练时使用Dropout随机忽略一部分神经元,以避免模型过拟合。Dropout虽有单独的论文论述,但是AlexNet将其实用化,通过实践证实了它的效果。在AlexNet中主要是最后几个全连接层使用了Dropout。
105+
- 在CNN中使用重叠的最大池化。此前CNN中普遍使用平均池化,AlexNet全部使用最大池化,避免平均池化的模糊化效果。并且AlexNet中提出让步长比池化核的尺寸小的观点,这样池化层的输出之间会有重叠和覆盖,提升了特征的丰富性。
106+
- 提出了LRN局部响应归一化层,对局部神经元的活动创建竞争机制,使得其中响应比较大的值变得相对更大,并抑制其他反馈较小的神经元,增强了模型的泛化能力。
107+
- 使用CUDA加速深度卷积网络的训练,利用GPU强大的并行计算能力,处理神经网络训练时大量的矩阵运算。AlexNet使用了两块GTX 580 GPU进行训练,单个GTX 580只有3GB显存,这限制了可训练的网络的最大规模。因此作者将AlexNet分布在两个GPU上,在每个GPU的显存中储存一半的神经元的参数。因为GPU之间通信方便,可以互相访问显存,而不需要通过主机内存,所以同时使用多块GPU也是非常高效的。同时,AlexNet的设计让GPU之间的通信只在网络的某些层进行,控制了通信的性能损耗。 
108+
- 数据增强,随机地从$256\times 256$ 大小的原始图像中截取$224\times 224$大小的区域(以及水平翻转的镜像),相当于增加了$2\times (256-224)^2=2048$倍的数据量。如果没有数据增强,仅靠原始的数据量,参数众多的CNN会陷入过拟合中,使用了数据增强后可以大大减轻过拟合,提升泛化能力。进行预测时,则是取图片的四个角加中间共5个位置,并进行左右翻转,一共获得10张图片,对他们进行预测并对10次结果求均值。同时,AlexNet论文中提到了会对图像的RGB数据进行PCA处理,并对主成分做一个标准差为0.1的高斯扰动,增加一些噪声,这个Trick可以让错误率再下降1%。
109+
110+
## 模型指标
111+
112+
AlexNet 作为 ImageNet 2012比赛的冠军算法,在 ImageNet 测试集上达到了 15.3% 的 top-5 error rate,远远超过第二名(SIFT+FVs)的 26.2% 。如 **图2** 所示。
113+
114+
<center><img src="https://raw.githubusercontent.com/lvjian0706/Deep-Learning-Img/master/CNN/Classical_model/AlexNet_Error_Rate.png" width = "1000"></center>
115+
<center><br>图2:AlexNet模型指标</br></center>
116+
117+
## 参考文献
118+
119+
[1] [Imagenet classification with deep convolutional neural networks. ](https://www.nvidia.cn/content/tesla/pdf/machine-learning/imagenet-classification-with-deep-convolutional-nn.pdf)
120+

0 commit comments

Comments
 (0)