当前位置:网站首页>Deep learning notes -- some "cool" knowledge points of convolution layer and pooling layer
Deep learning notes -- some "cool" knowledge points of convolution layer and pooling layer
2022-07-21 03:43:00 【daimashiren】
One . Definition and calculation of convolution layer
1. Definition of convolution layer
Convolution layer = Feel the field + Weight sharing
Every feeling field ( receptive field) There will be multiple filter, And each filter The parameter settings of are different ( Generally, after random initialization , Obtained by neural network autonomous learning ). Every filter Be responsible for detecting certain features in the receptive field (pattern), The same features may be repeated in other parts of the image , Therefore, different areas of the same picture need the same group filter To detect , Weight sharing (Parameter Sharing), In order to realize the filter Efficient reuse and reduction of parameters .
2. Calculation of convolution layer
Suppose the input image is (3,6,6), namely channel = 3, H x W = 6 x 6 The color picture of , We use a set of , common 64 individual (3,3,3) Of filter, namely channel = 3,kernel size = 3 x 3 ,padding = 0 Convolution kernel , To perform convolution , The output characteristic graph (feature map ) The shape of should be determined by the following formula .
among ,Hi、Hk Respectively represents the height of the input image and the convolution kernel ( The formula of changing height into width remains unchanged ),S Step length (stride),P Express Padding( If there is ). According to the example above , The substitution formula is calculated as follows :
Here we deliberately take an infinite number , Because many blogs only cite divisible integer solutions , However, many of them are not integers , Looked at the pytorch Source code , The treatment of this part is Down ( Left ) integer , namely 2.5→2, Other frameworks should be similar . Because there are 64 Different convolution kernels , So the output after convolution is (64,2,2).
in addition , Another thing to note is , Everyone must know that convolution operation is actually the convolution kernel and a certain area of the image ( Feel the field ) Do matrix dot product operation (elementwise product The corresponding elements are multiplied and then added ), But do you know that the number of channels of each convolution kernel needs to match the number of channels of the input image . In fact, there is an easily ignored but very important point here , The convolution operation of each convolution kernel for a certain region of the image is carried out simultaneously in the depth direction of the image , That is to say, in the above example , When a certain region of the three channel color image is convoluted with the convolution kernel , It is the dot product of three channel image information and a three channel convolution kernel at the same time , Then take it. The convolution results of three channels are added to get the operation result of a convolution kernel , All in all 64 Convolution kernels , So the number of output channels is 64, That is, the number of channels of the output result of the convolution layer only depends on the number of convolution cores , It is independent of the number of channels of the input image .
( notes : The parameter settings on the three channels of the same convolution kernel are often different .)
Two . Pooling layer
About pool layer , We all know that it is used to reduce dimension , Reduced parameter quantity . But one thing you may overlook is , One big difference between pool layer and convolution layer is pool layer There are no parameters to learn , And the pool layer also Do not change the input image ( The characteristic image obtained by convolution layer can also be regarded as an image in a sense ) Of The channel number , Therefore, the number of channels is omitted when defining the number of channels , Only in size (kernel size) And step length (stride) The definition of , So in pytorch In the implementation of other frameworks, the pooling layer is also directly applied to each channel of the input image to obtain the output of the same number of channels . The calculation formula of the output image size of the pooling layer is the same as that of the convolution layer .
Reference resources
( Strong push ) Li Hongyi 2021 Spring machine learning course _ Bili, Bili _bilibili
边栏推荐
- Dameng collects statistics
- 李宏毅机器学习2020---P12 Brief introduction of DL & P15 Why DL
- Li Hongyi machine learning 2020---p12 brief introduction of DL & p15 why DL
- Li Hongyi 2020 machine learning -- P11 logistic progression
- MIMO-OFDM无线通信技术及MATLAB实现(2)-SISO下的室外信道模型
- 基于华为自研NPU Ascend 910的TensorFlow 1.x训练脚本迁移和使能混合精度记录
- Flutter 小结
- 理解Seperable Convolution
- [deep learning] instantiate a simple convolutional neural network using MNIST data set
- (9) Pytorch deep learning: convolutional neural network (the inception module in googlenet network architecture is this convolutional neural network architecture)
猜你喜欢
(二)PyTorch深度学习:梯度下降
Flink temporal semantics
Redis publishing and subscription
【CANN训练营】基于昇腾CANN平台的AI CPU算子开发
(4) Pytorch deep learning: pyttorch realizes linear regression
关于图像傅里叶变换得到的频谱图的通俗理解
MySQL is migrated to Dameng through DTS
Thesis study ---- urllc benefit from noma (1)
辨析Iteration、epoch及batchsize之间的关系
(4) Pyqt5 series tutorials: use pychart to design the internal logic of pyqt5 in the serial port assistant parameter options (I)
随机推荐
NSLog输出中文
Paper learning -- resource allocation in urllc with online learning for mobileusers
论文学习---Resource allocation and beamforming desing in the short blocklength regime for URLLC
理解Seperable Convolution
关于图像傅里叶变换得到的频谱图的通俗理解
(一)PyTorch深度学习:线性模型训练
There is a lot of garbage on wechat on the computer side that can be cleaned up
(2) Pytorch deep learning: gradient descent
论文学习--Resource allocation in URLLC with online learning for Mobileusers
【深度学习】怎么为模型选择正确的最后一层激活和损失函数
SQL processing data synchronization group analysis
(六)PyTorch深度学习:Logistic回归(多层多维特征输入)
Hyperledger fabric super ledger CA construction and use
Redis事务
(5) Pyqt5 series tutorials: use pychart to design the internal logic of pyqt5 in the serial port assistant parameter options (II)
Redis persistence
(1) Pytorch deep learning: linear model training
UITableView之性能优化
[cann training camp] essays on the realization of GaN based on Shengsi
论文学习--Resource allocation for multi-user downlink MISO OFDMA-URLLC systems