首页 > 其他 > 详细

CNN中相关参数个数的计算

时间:2021-03-30 22:01:15      阅读:27      评论:0      收藏:0      [点我收藏+]

Consider a CNN composed of three convolutional layers, each with 3 × 3 kernels, a stride of 2, and "same" padding. The lowest layer outputs 100 feature maps, the middle one outputs 200, and the top one outputs 400. The input images are RGB images of 200 × 300 pixels. What is the total number of parameters in the CNN? If we are using 32-bit floats, at least how much RAM will this network require when making a prediction for a single instance? What about when training on a mini-batch of 50 images?

     ############### Let’s compute how many parameters the CNN has. Since its

first convolutional layer has 3 × 3 kernels, and the input has three channels (red, green, and blue), each feature map has 3 × 3 × 3 weights, plus a bias term. That’s 28 parameters per feature map. Since this first convolutional layer outputs 100 feature maps, it has a total of 2,800 parameters( (3x3x3+1)x100).
 
The second convolutional layer has 3 × 3 kernels and its input is the set of 100 feature maps of the previous layer, so each feature map has 3 × 3 × 100 = 900 weights, plus a bias term. Since it outputs 200 feature maps, this layer has 901 × 200 = 180,200 parameters( (3x3x100+1)x200).
 
Finally, the third and last convolutional layer also has 3 × 3 kernels, and its input is the set of 200 feature maps of the previous layers, so each feature map has 3 × 3 × 200 = 1,800 weights, plus a bias term. Since it has 400 feature maps, this layer has a total of 1,801 × 400 =720,400 parameters( (3 × 3 x 200 + 1) × 400).
 
All in all, the CNN has 2,800 + 180,200 + 720,400 = 903,400 parameters(!hold).
————————————————
版权声明:本文为CSDN博主「LIQING LIN」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Linli522362242/article/details/114817809

CNN中相关参数个数的计算

原文:https://www.cnblogs.com/nlpers/p/14598350.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!