paulgavrikov / visualkeras

Visualkeras is a Python package to help visualize Keras (either standalone or included in TensorFlow) neural network architectures. It allows easy styling to fit most needs. This module supports layered style architecture generation which is great for CNNs (Convolutional Neural Networks), and a graph style architecture, which works great for most models including plain feed-forward networks.
MIT License
582 stars 67 forks source link

Not working in colab keras #32

Closed alexmaehon closed 1 year ago

alexmaehon commented 1 year ago

Minimal Code To Reproduce out = inp = Input(shape=(SEGLEN, 1))

Initialize cnn layer

out = Conv1D(filters=nfilt, kernel_size=filtsize, padding='same')(out)

Multilayer conv

for i in range(clayer): out = Conv1D(filters=nfilt, kernel_size=filtsize, padding='same', activation='relu')(out) out = MaxPooling1D(poolsize, padding='same')(out) if pooltype == "avg": out = GlobalAveragePooling1D()(out) else: out = GlobalMaxPooling1D()(out) if droprate: out = Dropout(droprate)(out) out = Dense(fnode)(out) if droprate: out = Dropout(droprate)(out) out = Dense(1)(out) model = Model(inputs=[inp], outputs=[out])

Errorr TypeError Traceback (most recent call last) in 1 import visualkeras ----> 2 visualkeras.layered_view(model)

/usr/local/lib/python3.8/dist-packages/visualkeras/layered.py in layered_view(model, to_file, min_z, min_xy, max_z, max_xy, scale_z, scale_xy, type_ignore, index_ignore, color_map, one_dim_orientation, background_fill, draw_volume, padding, spacing, draw_funnel, shade_step, legend, font, font_color) 98 x = min(max(shape[1] scale_xy, x), max_xy) 99 y = min(max(shape[2] scale_xy, y), max_xy) --> 100 z = min(max(z), max_z) 101 elif len(shape) == 2: 102 if one_dim_orientation == 'x':

TypeError: 'int' object is not iterable

Environment (please complete the following information): colab

paulgavrikov commented 1 year ago

This is a duplicate of https://github.com/paulgavrikov/visualkeras/issues/15.