Permalink
Branch: master
Find file Copy path
8bd304b Jan 16, 2019
1 contributor

Users who have contributed to this file

31 lines (20 sloc) 800 Bytes
import os
from graphviz import Digraph
from autokeras.utils import pickle_from_file
def to_pdf(graph, path):
dot = Digraph(comment='The Round Table')
for index, node in enumerate(graph.node_list):
dot.node(str(index), str(node.shape))
for u in range(graph.n_nodes):
for v, layer_id in graph.adj_list[u]:
dot.edge(str(u), str(v), str(graph.layer_list[layer_id]))
dot.render(path)
def visualize(path):
cnn_module = pickle_from_file(os.path.join(path, 'module'))
cnn_module.searcher.path = path
for item in cnn_module.searcher.history:
model_id = item['model_id']
graph = cnn_module.searcher.load_model_by_id(model_id)
to_pdf(graph, os.path.join(path, str(model_id)))
if __name__ == '__main__':
visualize('')