sanghyuk-vessl's picture
Add vessl-docs
76d9c4f verified
metadata
title: Keras
version: EN

VESSL provides integrations for Keras, an interface for the TensorFlow library. You can find a complete example using Keras in our GitHub repository.

ExperimentCallback

ExperimentCallback extends Keras' callback class. Add ExperimentCallback as a callback parameter in the fit function to automatically track Keras metrics at the end of each epoch. You can also log image objects using ExperimentCallback.

Parameter Description
data_type Use image to log image objects
validation_data Tuple of (validation_data, validation_labels)
labels

List of labels to get the caption from the inferred logits.

The argmax value will be used if labels are not provided.

num_images Number of images to log in the validation data

Logging metrics

# Logging loss and accuracy for each epoch in Keras
from vessl.integration.keras import ExperimentCallback

...
model.fit(..., callbacks=[ExperimentCallback()])
...

Logging image objects

# Logging images along with the loss and accuracy for each epoch in Keras
from vessl.keras import ExperimentCallback

...
model.fit(
    ...,
    callbacks=[ExperimentCallback(
        data_type='image',
        validation_data=(x_val, y_val),
        num_images=5,
    )]
)
...