Keras and Gephi : Visualize your Deep Learning Graph

If you work on Machine Learning / Deep Learning with Keras, you can export the model in a dot file. And guess what ? Gephi can read dot files ! 😀

To do that use this code (adapt it for your usecase)

https://gist.github.com/totetmatt/dcc85d27b0fdfd79513cbe43201f507f

from keras.applications import *
from keras.utils import plot_model
# [..]
# model = ...
# Get your own model here
# [..]
model = NASNetMobile() #Example with NASNetMobile
plot_model(model,show_shapes=False, to_file='model.dot')

Then it will generate a model.dot file that you can open directly into Gephi !