Basj
Basj

Reputation: 46423

Keras or Tensorflow function to draw a 3D diagram of a neural network structure?

When creating a neural network with Keras:

model = Sequential()
model.add(Conv2D(32, kernel_size=(3, 3), activation='relu', input_shape=input_shape))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
...

the function model.summary helps to get the big picture of the structure.

To get a better idea of the structure, is there a function in Keras or Tensorflow (or another library) to automatically generate a 3D diagram of the structure? like this:

or

or

enter image description here

Generating such a diagram file would be totally possible from the model object.

TL;DR:


PS:

Upvotes: 11

Views: 6128

Answers (1)

CeKl
CeKl

Reputation: 85

Are you talking about this: https://keras.io/visualization/

from keras.utils import plot_model
plot_model(model, to_file='model.png')

This saves the structure of your model with input and output tensors as png. But unfortunately only the scheme, not three-dimensional

Upvotes: 4

Related Questions