https://github.com/saravanabalagi/keras_tensorboard_starter
Starter project for Keras with Tensorboard logging
https://github.com/saravanabalagi/keras_tensorboard_starter
keras tensorboard tensorflow tensorflow2
Last synced: 3 months ago
JSON representation
Starter project for Keras with Tensorboard logging
- Host: GitHub
- URL: https://github.com/saravanabalagi/keras_tensorboard_starter
- Owner: saravanabalagi
- License: mit
- Created: 2020-04-16T21:32:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-17T22:34:54.000Z (about 6 years ago)
- Last Synced: 2025-03-27T14:53:21.747Z (over 1 year ago)
- Topics: keras, tensorboard, tensorflow, tensorflow2
- Language: Python
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Keras Tensorboard Starter
This is a keras starter project that provides tf.summary logging out of the box
inside your model inference code for both train and eval runs.
You should be able to see something like

where
- eval has exactly 3 records (at 0, 10 and 20 corresponding to 3 `evaluate`s)
- train has 20 records (0-9 and 10-19 corresponding to 2 `fit`s with 10 epochs each)
## Instructions
From Tensorflow 2.2, we can override Keras `model.fit` using `Model.train_step`.
This allows us to write a custom train step and use the same old `model.fit` in an elegant way,
but to call our custom train step logic. See example at [train_and_evaluate.py](train_and_evaluate.py)
## For Older Versions
For older versions of tensorflow, the hack implemented in [train_and_evaluate_old.py](train_and_evaluate_old.py)
where we can pass the summary writer into an argument
and use it in `call` method to log can be a workaround.
Although it's not as elegant as the above method, it works!

## Licence
Please see attached [Licence](LICENCE)