When I used the Keras visualization model, I met the above error with the following error message:
Traceback (most recent call last):
File "HARRISON_feature_model.py", line 55, in <module>
plot_model(model, to_file='vgg_feature_model.png', show_shapes=True, show_layer_names=False)
File "/home/idc/anaconda3/envs/hashtag/lib/python2.7/site-packages/keras/utils/vis_utils.py", line 131, in plot_model
dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
File "/home/idc/anaconda3/envs/hashtag/lib/python2.7/site-packages/keras/utils/vis_utils.py", line 52, in model_to_dot
_check_pydot()
File "/home/idc/anaconda3/envs/hashtag/lib/python2.7/site-packages/keras/utils/vis_utils.py", line 27, in _check_pydot
raise ImportError('Failed to import pydot. You must install pydot'
ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
The solution is:
Pip install pydot-ng
pip install Graphviz
And then it's solved, my system for Ubuntu 16.04
Or:
sudo pip3 install pydot
sudo pip3 install graphviz sudo apt-get install Graphviz
The solution below is also Ubuntu 16.04, but it's Python3.
Reference Documents
[1]. Keras implement LENET-5 Network and visualize network structure diagram. http://blog.csdn.net/qqadssp/article/details/70431236
[2].keras Model Visualization and resolution ' Failed to Import Pydot ' problem. http://www.zhimengzhe.com/linux/353667.html