2021-05-13 23:48:51 +00:00
|
|
|
---
|
2023-08-10 08:49:05 +00:00
|
|
|
title: Keras with TensorBoard
|
2021-05-13 23:48:51 +00:00
|
|
|
---
|
|
|
|
|
2022-03-13 13:07:06 +00:00
|
|
|
The example below demonstrates the integration of ClearML into code which uses Keras and TensorBoard.
|
2021-11-04 09:21:05 +00:00
|
|
|
View it in [script](https://github.com/allegroai/clearml/blob/master/examples/frameworks/keras/keras_tensorboard.py)
|
2021-11-07 07:51:34 +00:00
|
|
|
or in [Jupyter Notebook](https://github.com/allegroai/clearml/blob/master/examples/frameworks/keras/jupyter_keras_TB_example.ipynb).
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2021-11-04 09:21:05 +00:00
|
|
|
:::note
|
|
|
|
The example in [Jupyter Notebook](https://github.com/allegroai/clearml/blob/master/examples/frameworks/keras/jupyter_keras_TB_example.ipynb)
|
|
|
|
includes a clickable icon to open the notebook in Google Colab.
|
|
|
|
:::
|
|
|
|
|
|
|
|
The example script does the following:
|
2021-05-13 23:48:51 +00:00
|
|
|
1. Trains a simple deep neural network on the Keras built-in [MNIST](https://keras.io/api/datasets/mnist/#load_data-function)
|
|
|
|
dataset.
|
2021-11-04 09:21:05 +00:00
|
|
|
1. Builds a sequential model using a categorical cross entropy loss objective function.
|
|
|
|
1. Specifies accuracy as the metric, and uses two callbacks: a TensorBoard callback and a model checkpoint callback.
|
2023-09-04 12:40:42 +00:00
|
|
|
1. During script execution, creates an experiment named `Keras with TensorBoard example` in the
|
2023-06-15 08:22:50 +00:00
|
|
|
`examples` project (in script) or the `Colab notebooks` project (in Jupyter Notebook).
|
2021-11-04 09:21:05 +00:00
|
|
|
|
2021-05-13 23:48:51 +00:00
|
|
|
|
|
|
|
## Scalars
|
|
|
|
|
2022-05-22 07:27:30 +00:00
|
|
|
The loss and accuracy metric scalar plots appear in **SCALARS**, along with the resource utilization plots,
|
2021-11-04 09:21:05 +00:00
|
|
|
which are titled **:monitor: machine**.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
## Histograms
|
|
|
|
|
2022-05-22 07:27:30 +00:00
|
|
|
Histograms for layer density appear in **PLOTS**.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
## Hyperparameters
|
|
|
|
|
2022-03-13 13:07:06 +00:00
|
|
|
ClearML automatically logs command line options generated with `argparse`, and TensorFlow Definitions.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2023-01-12 10:49:55 +00:00
|
|
|
Command line options appear in **CONFIGURATION** **>** **HYPERPARAMETERS** **>** **Args**.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
TensorFlow Definitions appear in **TF_DEFINE**.
|
|
|
|
|
|
|
|

|
|
|
|
|
2021-05-18 22:31:01 +00:00
|
|
|
## Console
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2022-05-22 07:27:30 +00:00
|
|
|
Text printed to the console for training progress, as well as all other console output, appear in **CONSOLE**.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2021-11-04 09:21:05 +00:00
|
|
|

|
2021-05-13 23:48:51 +00:00
|
|
|
|
2021-09-02 07:48:37 +00:00
|
|
|
## Configuration Objects
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2023-09-11 10:33:30 +00:00
|
|
|
In the experiment code, a configuration dictionary is connected to the Task by calling [`Task.connect()`](../../../references/sdk/task.md#connect).
|
2021-11-04 09:21:05 +00:00
|
|
|
|
2021-05-13 23:48:51 +00:00
|
|
|
```python
|
2022-06-30 17:16:13 +00:00
|
|
|
task.connect_configuration(
|
2023-09-11 10:33:30 +00:00
|
|
|
name="MyConfig",
|
2022-06-30 17:16:13 +00:00
|
|
|
configuration={'test': 1337, 'nested': {'key': 'value', 'number': 1}}
|
|
|
|
)
|
2021-05-13 23:48:51 +00:00
|
|
|
```
|
|
|
|
|
2022-06-30 17:16:13 +00:00
|
|
|
It appears in **CONFIGURATION** **>** **CONFIGURATION OBJECTS** **>** **MyConfig**.
|
2021-05-13 23:48:51 +00:00
|
|
|
|
2021-11-04 09:21:05 +00:00
|
|
|

|