【发布时间】:2019-07-14 07:42:24
【问题描述】:
在基于Keras MNIST example 训练 Siamese 卷积神经网络时,它会卡在 0.50 的验证准确度上。此外,训练和验证损失减少,而训练准确度也徘徊在 0.50 左右。
创建连体网络的代码类似这样:
input_shape = x_train.shape[2:]
print('input_shape:',input_shape)
# network definition
base_network = create_base_network(input_shape)
input_a = Input(shape=input_shape)
input_b = Input(shape=input_shape)
# because we re-use the same instance `base_network`,
# the weights of the network
# will be shared across the two branches
processed_a = base_network(input_a)
processed_b = base_network(input_b)
distance = Lambda(euclidean_distance,
output_shape=eucl_dist_output_shape)([processed_a, processed_b])
model = Model([input_a, input_b], distance)
create_base_network 函数创建 ResNet50 和另外两个前馈层 512 和 1024,所有层都被冻结,除了最后几个未冻结的层。
此问题已在多个平台(Stackoverflow、Github 甚至 Reddit)上多次讨论,但尚未提供明确的答案/解决方案。
【问题讨论】:
标签: python keras conv-neural-network