当前位置:网站首页>李宏毅《机器学习》丨6. Convolutional Neural Network(卷积神经网络)
李宏毅《机器学习》丨6. Convolutional Neural Network(卷积神经网络)
2022-06-24 23:01:00 【AXYZdong】
Author:AXYZdong
李宏毅《机器学习》系列
参考视频地址:https://www.bilibili.com/video/BV1Ht411g7Ef
参考文档:DataWhale文档
文章目录
一、为什么CNN用于图像处理
当我们用fully connect feedforward network来做图像处理的时候,往往我们会需要太多的参数,举例来说,假设这是一张100 *100的彩色图(一张很小的imgage),你把这个拉成一个vector,(它有多少个pixel),它有100 *100 3的pixel。
如果是彩色图的话,每个pixel需要三个value来描述它,就是30000维(30000 dimension),那input vector假如是30000dimension,那这个hidden layer假设是1000个neural,那么这个hidden layer的参数就是有30000 *1000,那这样就太多了。
那么CNN做的事就是简化neural network的架构。我们根据对图像的认识,某些weight用不上的,我们一开始就把它滤掉。不是用fully connect feedforward network,而是用比较少的参数来做图像处理这件事。所以CNN比一般的DNN还要简单。
CNN就是用power-knowledge去把原来fully connect layer中一些参数拿掉。
为什么我们有可能把一些参数拿掉(为什么可以用比较少的参数可以来进行图像处理)
- 一些特征图像远小于整个图像
- 同样的特征会出现在不同的区域
- 像素缩放不会对图像造成太大影响
二、CNN架构
首先input一张image,这张image会通过convolution layer,接下来是max pooling,然后再做convolution,再做max pooling。
上述过程可以反复无数次(反复多少次你是要事先决定的,它就是network的架构(就像neural有几层一样),要做几层的convolution,做几层的Max Pooling,在定neural架构的时候,要事先决定好)。
做完要做的convolution和Max Pooling以后,就要进行flatten,再把flatten的output丢到一般fully connected feedforward network,然后得到图像识别的结果。
三、卷积(Convolution)
第一个filter是一个3* 3的matrix,把这个filter放在image的左上角,把filter的9个值和image的9个值做内积,两边都是1,1,1(斜对角),内积的结果就得到3。
(移动多少是事先决定的)移动的距离叫做stride(stride的值也可以事先设置),内积等于-1。图中的stride等于1。
四、Convolution和Fully Connected之间的关系
将stride=1(移动一格)做内积得到另外一个值-1,假设这个-1是另外一个neural的output,这个neural连接到input的(2,3,4,8,9,10,14,15,16),同样的weight代表同样的颜色。
在fully connect里面的两个neural本来是有自己的weight,当我们在做convolution时,首先把每一个neural连接的wight减少,强迫这两个neural共用一个weight。这件事就叫做shared weight,当我们做这件事情的时候,我们用的这个参数就比原来的更少。
五、最大池化(Max Pooling)
相对于convolution来说,Max Pooling是比较简单的。我们根据filter 1得到4*4的maxtrix,根据filter2得到另一个4 *4的matrix,接下来把output ,4个一组。每一组里面可以选择它们的平均(平均池化)或者选最大(最大池化)的都可以,就是把四个value合成一个value。这个可以让image缩小。
池化本质上的作用是:缩小图像,减少特征。
六、压平(Flatten)
把多维的输入一维化,常用在从卷积层到全连接层的过渡。
flatten就是feature map拉直,拉直之后就可以丢到fully connected feedforward netwwork。
七、To learn more …
- The methods of visualization in these slides
https://blog.keras.io/how-convolutional-neural-networks-see-the-world.html - More about visualization
http://cs231n.github.io/understanding-cnn/ - Very cool CNN visualization toolkit
http://yosinski.com/deepvis
http://scs.ryerson.ca/~aharley/vis/conv/
How to let machine draw an image
- PixelRNN:https://arxiv.org/abs/1601.06759
- Variation Autoencoder (VAE): https://arxiv.org/abs/1312.6114
- Generative Adversarial Network (GAN): http://arxiv.org/abs/1406.2661
八、总结
Datawhale组队学习,李宏毅《机器学习》Task6. Convolutional Neural Network(卷积神经网络)。包括为什么CNN用于图像处理、CNN架构、卷积(Convolution)、Convolution和Fully Connected之间的关系、最大池化(Max Pooling)、压平(Flatten)和其他的一些参考资料。
主要是原理部分的介绍,在实际运用中可能一行代码就实现了对应的功能。对于初学者而言,很多地方我觉得可以不求甚解,等到具体应用的时候再深挖一下,这样可以提高效率。
如果以上内容有任何错误或者不准确的地方,欢迎在下面 留言。或者你有更好的想法,欢迎一起交流学习~~~
更多精彩内容请前往 AXYZdong的博客
边栏推荐
- 算力服务网络:一场多元融合的系统革命
- 計網 | 【四 網絡層】知識點及例題
- When an interface has an exception, how do you analyze the exception?
- Please run IDA with elevated permissons for local debugging.
- 把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(1)——迁移数据到节点1
- 基本布局-QHBoxLayout类、QVBoxLayout类、QGridLayout类
- 把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(3)—— 把数据库设置为归档模式
- 【Proteus仿真】Arduino UNO+继电器控制照明设备
- Once beego failed to find bee after passing the go get command Exe's pit
- 目录权限错误导致 Oracle 11g rac 集群数据库无法启动的问题
猜你喜欢
qt打包exe文件,解决“无法定位程序输入点_ZdaPvj于动态链接库Qt5Cored.dll”
The role of software security testing, how to find a software security testing company to issue a report?
Experience of epidemic prevention and control, home office and online teaching | community essay solicitation
Is it out of reach to enter Ali as a tester? Here may be the answer you want
Left hand dreams right hand responsibilities GAC Honda not only pays attention to sales but also children's safety
It's 2022, and you still don't know what performance testing is?
Intranet learning notes (7)
Rod and Schwartz cooperated with ZhongGuanCun pan Lianyuan Institute to carry out 6G technology research and early verification
How to monitor the log through the easycvr interface to observe the platform streaming?
Sumati gamefi ecological overview, element design in the magical world
随机推荐
【直播回顾】战码先锋第七期:三方应用开发者如何为开源做贡献
3 years of testing experience. I don't even understand what I really need on my resume. I need 20K to open my mouth?
[analysis of STL source code] functions and applications of six STL components (directory)
mysql命令备份
疫情防控,居家办公,网上授课之心得 | 社区征文
Talking about the advantages of flying book in development work | community essay solicitation
把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(4)—— 修改 oracle11g rac 集群的 scanIP
Four characteristics of actual attack and defense drill
Smartctl opens the device and encounters permission denied problem troubleshooting process record
When they are in private, they have a sense of propriety
Left hand dreams right hand responsibilities GAC Honda not only pays attention to sales but also children's safety
random list随机生成不重复数
Please run IDA with elevated permissons for local debugging.
计网 | 【四 网络层】知识点及例题
Cusdis - 轻量级、隐私优先的开源评论系统 | 倾城之链
NPM package publishing tutorial
背了八股文,六月赢麻了……
LINQ 查询(3)
罗德与施瓦茨与中关村泛联院合作开展6G技术研究与早期验证
F - Spices(线性基)