I try to get output layers during the training. I am trying to make a 3d visualization of the model in real time and to make it interactive. I am using google colab with tensorf
If you read the source of the custom callbacks, here
there is a property model for every custom callback we define.
You can make use of the model object inside the functions you defined in your Cutomcallbacks.
for example,
def on_train_batch_end(self, batch, logs=None):
#here you can get the model reference.
self.model.predict(dummy_data)
The self.model is an instance of keras.models.Model and the corrresponding function can be called using it.
More reference can be found here and here
Please follow the comments below in order to get the answer.
[EDIT 1]
The code segment from the comments by the OP
def on_train_batch_end(self, batch, logs=None):
for i in range(len(model_inception.layers)):
get_layer_output = K.function(inputs = self.model.layers[i].input, outputs = self.model.layers[i].output)
print('\n Training: output of the layer {} is {} ends at {}'.format(i, get_layer_output.outputs , datetime.datetime.now().time()))