计算Keras中con1D 的parameters方法

38

Its a rather simple calculation with basic concept.And by looking at your code and model summary this were my steps.

Step 1: Formula to calculate parameters

total_params =
(filter_height * filter_width * input_image_channels + 1) * number_of_filters

Step 2: Calculate parameters for first layer

filter_height = 5,
filter_weight = 5,
input_image_channels = 1
number_of_filters = 32
Though you havent provided us with imput image channels, but i figured it out from by your parameters value.

Now we will calculate the number of parameters for first conv layer.

total_param = (5*5*1 + 1)*32 = 832

Step 3: Similarly we can calculate for 2nd conv layer. Note that number of filters from previous layer become the number of channels for current layer's input image.

filter_height = 5,
filter_weight = 5,
input_image_channels = 32
number_of_filters = 64

Now we will calculate the number of parameters for 2nd conv layer.

total_param = (5*5*32 + 1)*64 = 51264

posted @ 2020-04-09 11:25  月夜_1  阅读(316)  评论(0编辑  收藏  举报