重写facenet出现的问题:

重写facenet出现的问题:

1. Shape must be rank 0 but is rank 1 for ‘SGD/GradientDescent/update_conv1_3/kernel/ApplyGradientDescent’ (op: ‘ApplyGradientDescent’) with input shapes: [3,3,3,32], [1], [3,3,3,32].
learning_rate  = tf.placeholder(shape=(1,), dtype=tf.float32, name='learning_rate')

optimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize(total_loss)

上述问题出现的原因是learning_rate 为tensor, 将learning_rate 改为scalar 常数值即可

2. Input 0 is incompatible with layer flatten_1: expected min_ndim=3, found ndim=2

当keras域tensorflow混用时可能出现这种情况

3. W tensorflow/core/framework/op_kernel.cc:1192] Invalid argument: You must feed a value for placeholder tensor ‘conv1_bn/keras_learning_phase’ with dtype bool

当keras域tensorflow混用时可能出现这种情况

[[Node: conv1_bn/keras_learning_phase = Placeholderdtype=DT_BOOL, shape=, _device=”/job:localhost/replica:0/task:0/gpu:0”]]
我的最终解决方案为如下

K.set_learning_phase(1)

下面为其他参考方案:(如果后面内容为 dtype=DT_UINT8 )

K._LEARNING_PHASE = tf.constant(0) # try with 1

change it to its below: (add K.learning_phase())

pred = K.function([model.input], [model.output])
pred = K.function([model.input, K.learning_phase()], [model.output])
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值