Keras plot_model显示吗?而不是没有

时间:2020-07-14 05:39:29

标签: python keras

我有一个简单的keras模型,如下所示:

from keras.models import Sequential
from keras.layers import Dense, Activation,Dropout
from keras.utils import plot_model
import tensorflow as tf


model_textual= Sequential()
model_textual.add(Dense(units=300, input_shape=(300,),activation='relu')) 
#model_textual.add(Dense(units=300, input_dim=300,activation='relu'))
model_textual.add(Dropout(0.5))
model_textual.add(Dense(units=150,activation='relu'))
model_textual.add(Dropout(0.5))
model_textual.add(Dense(19,activation='softmax'))

print(model_textual.summary())

Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
dense (Dense)                (None, 300)               90300     
_________________________________________________________________
dropout (Dropout)            (None, 300)               0         
_________________________________________________________________
dense_1 (Dense)              (None, 150)               45150     
_________________________________________________________________
dropout_1 (Dropout)          (None, 150)               0         
_________________________________________________________________
dense_2 (Dense)              (None, 19)                2869      
=================================================================
Total params: 138,319
Trainable params: 138,319
Non-trainable params: 0
_________________________________________________________________
None

我现在将上述模型绘制为:

from keras.utils.vis_utils import plot_model

plot_model(model_textual,'DNN_MLP_model.png',show_shapes=True,show_layer_names=True)

enter image description here

但是,我得到的None代替了输出形状参数中的?。我该如何纠正?

0 个答案:

没有答案