Skip to content

Question: does this work with TF Keras? #17

@Raukk

Description

@Raukk

I'm assuming that it doesn't work with tf.keras yet (or there are different bugs).
Is that correct or did I just do something stupid?

I ask this question because when I tried it with a simple model from a example I got some odd errors.

PS. Thank you; your article was really great, and I really like the visualizations, they are very helpful. Random question, are all the things you pointed out the same in Convolution layers as in your Dense examples, or do the visuals differ?

PSS. One thing I have trouble with is figuring out is which shapes/differences are problems and which are just harmless variations. If you had a cheat sheet explaining which things to look out for in each of the 4 graphs that would be great.


Note: This is not an bug/error report. I just thought I should provide more details.

With the simple model I got odd errors like this;

AttributeError                            Traceback (most recent call last)
<ipython-input-16-d1a685d6c63e> in <module>()
----> 1 replaydata = ReplayData(x_test, y_test, filename="filename", group_name="some group", model=model)
      2 
      3 # Now we feed the data to the actual Replay object so we can build the visualizations
      4 replay = Replay(replay_filename="filename", group_name="some group")
      5 

4 frames
/usr/local/lib/python3.6/dist-packages/h5py/_hl/base.py in _e(self, name, lcpl)
    130         else:
    131             try:
--> 132                 name = name.encode('ascii')
    133                 coding = h5t.CSET_ASCII
    134             except UnicodeEncodeError:

AttributeError: 'MeanMetricWrapper' object has no attribute 'encode'

Then, I changed the tf.keras to just Keras and it worked
(except the OOM exception on the GPU; ran in Google Colab).
Here is the whole Workbook: https://gist.github.com/Raukk/2b03bd8447433b83f862c7e7c437ec46

The model code (using tf.keras) is pasted below if you want to look into it.

model = tf.keras.models.Sequential()
model.add(tf.keras.layers.BatchNormalization(input_shape=x_train.shape[1:]))
model.add(tf.keras.layers.Conv2D(64, (5, 5), padding='same', activation='elu'))

model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2), strides=(2,2)))
model.add(tf.keras.layers.Dropout(0.25))

model.add(tf.keras.layers.BatchNormalization(input_shape=x_train.shape[1:]))
model.add(tf.keras.layers.Conv2D(128, (5, 5), padding='same', activation='elu'))
model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2)))
model.add(tf.keras.layers.Dropout(0.25))

model.add(tf.keras.layers.BatchNormalization(input_shape=x_train.shape[1:]))
model.add(tf.keras.layers.Conv2D(256, (5, 5), padding='same', activation='elu'))
model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2), strides=(2,2)))
model.add(tf.keras.layers.Dropout(0.25))

model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(256))
model.add(tf.keras.layers.Activation('elu'))
model.add(tf.keras.layers.Dropout(0.5))
model.add(tf.keras.layers.Dense(10))
model.add(tf.keras.layers.Activation('softmax'))
model.summary()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions