我尝试了以下方法:
#!/usr/bin/env python
import keras
from keras.models import model_from_yaml
model_file_path = 'model-301.yaml'
weights_file_path = 'model-301.hdf5'
# Load network
with open(model_file_path) as f:
yaml_string = f.read()
model = model_from_yaml(yaml_string)
model.load_weights(weights_file_path)
model.compile(optimizer='adagrad', loss='binary_crossentropy')
# Visualize
from keras.utils.visualize_util import plot
但是,这会产生错误:
Traceback (most recent call last):
File "", line 1, in
File "/home/moose/.local/lib/python2.7/site-packages/keras/utils/visualize_util.py", line 7, in
if not pydot.find_graphviz():
AttributeError: 'module' object has no attribute 'find_graphviz'
我怎样才能解决这个问题?
注意:可以找到hdf5和YAML文件on Github.