Python 将时间分布层与keras一起使用时出错

Python 将时间分布层与keras一起使用时出错,python,image-processing,deep-learning,keras,keras-layer,Python,Image Processing,Deep Learning,Keras,Keras Layer,我想用keras(2.1.3版)构建一个深度学习网络,逐帧分析视频流。我尝试使用TimeDistributed layer并获得如下网络: video = keras.Input(shape=(32,150,150,3), name='video') cnn = InceptionV3(weights = 'imagenet', include_top=False,pooling='avg') cnn.trainable = False frame_features = layers.TimeD

我想用keras(2.1.3版)构建一个深度学习网络,逐帧分析视频流。我尝试使用TimeDistributed layer并获得如下网络:

video = keras.Input(shape=(32,150,150,3), name='video')
cnn = InceptionV3(weights = 'imagenet', include_top=False,pooling='avg')
cnn.trainable = False
frame_features = layers.TimeDistributed(cnn)(video)
video_vector = layers.LSTM(256)(frame_features)
predictions = Dense(101,  activation='softmax')(video_vector)
model = Model(inputs=video, outputs=predictions)
当我建立网络时,我遇到了一个错误:

ValueError: Variable batch_normalization_1/moving_mean/biased already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

  File "D:\install\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1269, in __init__
    self._traceback = _extract_stack()
  File "D:\install\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2506, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "D:\install\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op
    op_def=op_def)

谁能告诉我怎么解决这个问题?谢谢

奇怪的是,我在Keras2.1.0中没有看到您发布的代码中出现这个错误。这不是重置内核以消除任何可能存在的InceptionV3模型的情况吗?这似乎是我的tensorflow的问题。我将tensorflow从1.2.0版升级到1.4.0版,然后问题就解决了。我不熟悉TimeDistributed层,但是这个层可能会多次调用CNN模型,然后导致重用问题。无论如何,谢谢你的回答:)