Keras:TimeDistributed + InceptionV3 bug

时间:2018-05-04 16:53:27

标签: tensorflow keras

在尝试在TimeDistributed包装器中使用Inception时,我在Keras面临一个非常好奇的错误。

此代码很简单,可以与许多模型或图层一起使用,但奇怪的是,inception_v3在预测时失败:

import numpy as np
from keras.applications import inception_v3
from keras.layers import *
from keras.models import Model

imgShape = (299,299,3)
seqShape = (2,299,299,3)
incept = inception_v3.InceptionV3(weights=None, include_top=False)

inputs = Input(seqShape)
outputs = TimeDistributed(incept)(inputs)
model = Model(inputs,outputs)

在我尝试预测某事之前,一切都很完美:

pred = model.predict(np.ones((1,2,299,299,3)))

错误是:

  

InvalidArgumentError(请参阅上面的回溯):您必须使用dtype bool为占位符张量'batch_normalization_1 / keras_learning_phase'提供值        [[节点:batch_normalization_1 / keras_learning_phase = Placeholderdtype = DT_BOOL,shape =,_ device =“/ job:localhost / replica:0 / task:0 / device:CPU:0”]]

对此有何解决方案?

使用Keras 2.1.0Tensorflow 1.4.0

0 个答案:

没有答案