作为ascii图的keras模型
keras-diagram的Python项目详细描述
打印您的 Keras模型来可视化 层及其形状。
InputLayer (None, 50, 300) Reshape (None, 1, 50, 300) Convolution2D (None, 250, 48, 1) Relu (None, 250, 48, 1) MaxPooling2D (None, 250, 1, 1) Flatten (None, 250) Dropout (None, 250) Dense (None, 7) Softmax (None, 7)
一个更复杂的模型 babi_rnn.py:
InputLayer (None, 5) Embedding (None, 5, 50) InputLayer (None, 552) Dropout (None, 5, 50) Embedding (None, 552, 50) LSTM (None, 50) Dropout (None, 552, 50) RepeatVector (None, 552, 50) \______________________________/ | Merge (None, 552, 50) LSTM (None, 50) Dropout (None, 50) Dense (None, 36)
安装
pip install keras_diagram
conda安装注意事项(python 3.5):pip install pypandoc
使用
from keras_diagram import ascii model = Sequential() model.add(...) print(ascii(model))
开发
./test.py # run tests via docker ./publish.py # build distributions and publish to pypi ./shell.py # run bash above docker container with current folder mounted