Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

模型中参数的值是如何指定的

Open shangguanyifeng opened this issue 8 years ago • 1 comments

def convolutional_neural_network(img):
# 第一个卷积-池化层
conv_pool_1 = paddle.networks.simple_img_conv_pool(
input=img,
filter_size=5,
num_filters=20,
num_channel=1,
pool_size=2,
pool_stride=2,
act=paddle.activation.Relu())
# 第二个卷积-池化层
conv_pool_2 = paddle.networks.simple_img_conv_pool(
input=conv_pool_1,
filter_size=5,
num_filters=50,
num_channel=20,
pool_size=2,
pool_stride=2,
act=paddle.activation.Relu())
# 以softmax为激活函数的全连接输出层,输出层的大小必须为数字的个数10
predict = paddle.layer.fc(input=conv_pool_2,
size=10,
act=paddle.activation.Softmax())
return predict

上面两个卷积+池化的函数中传的参数的值是如何指定的

例如第一个卷积+池化

filter_size=5,
num_filters=20,
num_channel=1,
pool_size=2,
pool_stride=2,

filter_size为什么是5 num_filters为什么是20 还有第二层的参数

shangguanyifeng avatar Jun 14 '18 09:06 shangguanyifeng

filter_size为什么是5 num_filters为什么是20 还有第二层的参数

这是模型的参数,并不是框架强行指定的。

对于常用的模型,如:mnist/vgg/Resnet,模型中的参数都是固定的,并且这些参数是模型的作者经过实验确定的。

chengduoZH avatar Jun 14 '18 09:06 chengduoZH