keras模型未显示包装后的所有层
我有一个cnn模型(称为cnn_模型)。我按时间分布包装模型,以处理序列。新模型称为lstm_模型。为什么我看不到lstm_模型中的cnn层 守则:keras模型未显示包装后的所有层,keras,model,lstm,layer,Keras,Model,Lstm,Layer,我有一个cnn模型(称为cnn_模型)。我按时间分布包装模型,以处理序列。新模型称为lstm_模型。为什么我看不到lstm_模型中的cnn层 守则: cnn_model = getModel(input_shape=(imageH, imageW), CHANNELS) image_frames = Input(batch_shape=(BATCH_SIZE, TIME_STEPS, imageH, imageW, CHANNELS)) encoded_images =
cnn_model = getModel(input_shape=(imageH, imageW), CHANNELS)
image_frames = Input(batch_shape=(BATCH_SIZE, TIME_STEPS, imageH, imageW, CHANNELS))
encoded_images = TimeDistributed(cnn_model)(image_frames)
x = LSTM(output_dim=256, return_sequences=True)(encoded_images)
outputs = TimeDistributed(Dense(NUM_EVENTS, activation="sigmoid"))(x)
lstm_model = Model([image_frames], outputs)
lstm_model.summary()仅显示5层,其中没有所有cnn_模型层。
另一方面,参数的数量表明层确实在新模型内。(lstm层中有500k个参数,cnn模型中有250万个参数。lstm_模型中总共有300万个参数)
有人帮忙吗?找到了。
它们位于model.layers[1].layer.layers内
在改变图层之后(对我来说——解冻图层),我必须重新编译模型。
现在它起作用了