Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j3soon/tbparse
Load tensorboard event logs as pandas DataFrames for scientific plotting; Supports both PyTorch and TensorFlow
https://github.com/j3soon/tbparse
machine-learning parser plot python pytorch reader tensorboard tensorboardx tensorflow
Last synced: 3 months ago
JSON representation
Load tensorboard event logs as pandas DataFrames for scientific plotting; Supports both PyTorch and TensorFlow
- Host: GitHub
- URL: https://github.com/j3soon/tbparse
- Owner: j3soon
- License: apache-2.0
- Created: 2021-09-03T16:38:05.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-21T14:21:12.000Z (12 months ago)
- Last Synced: 2024-07-23T00:23:09.030Z (4 months ago)
- Topics: machine-learning, parser, plot, python, pytorch, reader, tensorboard, tensorboardx, tensorflow
- Language: Python
- Homepage: https://tbparse.readthedocs.io
- Size: 760 KB
- Stars: 165
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tbparse
[![pypi](https://img.shields.io/pypi/v/tbparse)](https://pypi.org/project/tbparse/)
[![python](https://img.shields.io/pypi/pyversions/tbparse)](https://pypi.org/project/tbparse/)
[![Downloads](https://pepy.tech/badge/tbparse)](https://pepy.tech/project/tbparse)
[![license](https://img.shields.io/pypi/l/tbparse)](https://github.com/j3soon/tbparse/blob/master/LICENSE)[![tests](https://img.shields.io/github/actions/workflow/status/j3soon/tbparse/test-with-tox.yaml?label=tests)](https://github.com/j3soon/tbparse/actions/workflows/test-with-tox.yaml)
[![build](https://img.shields.io/github/actions/workflow/status/j3soon/tbparse/publish-to-pypi.yaml)](https://github.com/j3soon/tbparse/actions/workflows/publish-to-pypi.yaml)
[![doc](https://readthedocs.org/projects/tbparse/badge/?version=latest)](https://tbparse.readthedocs.io/en/latest)
[![codecov](https://codecov.io/gh/j3soon/tbparse/branch/master/graph/badge.svg?token=ASxeqFrMom)](https://codecov.io/gh/j3soon/tbparse)[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j3soon/tbparse/blob/master/docs/notebooks/gallery-pytorch.ipynb)
A simple yet powerful tensorboard event log parser/reader.
* Supports parsing tensorboard event [scalars][parsing-scalars], [tensors][parsing-tensors], [histograms][parsing-histograms], [images][parsing-images], [audio][parsing-audio], [hparams][parsing-hparams], and [text][parsing-text].
* Supports event generated by
[PyTorch](https://pytorch.org/docs/stable/tensorboard.html), [Tensorboard/Keras](https://www.tensorflow.org/tensorboard), and [TensorboardX](https://github.com/lanpa/tensorboardX), with their respective usage examples documented in detail.
* Allows parsing multiple tensorboard event files in a hierarchical directory structure.
* Provides plotting examples for each type of events.
* Stores the data in [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html) to allow advanced filtering.
* Both the documentation and code have high test coverage rate.
* Follows [PEP 484](https://www.python.org/dev/peps/pep-0484/) with full type hints.Installation:
```sh
pip install tensorflow # or tensorflow-cpu
pip install -U tbparse # requires Python >= 3.7
```**Note**: If you don't want to install TensorFlow, see [Installing without TensorFlow](https://tbparse.readthedocs.io/en/latest/pages/installation.html#installing-without-tensorflow).
We suggest using an additional virtual environment for parsing and plotting the tensorboard events. So no worries if your training code uses Python 3.6 or older versions.
Reading one or more event files with tbparse only requires 5 lines of code:
```py
from tbparse import SummaryReader
log_dir = ""
reader = SummaryReader(log_dir)
df = reader.scalars
print(df)
```If you want an additional column with directory names (i.e., run names), change line 3 above to the following:
```py
reader = SummaryReader(log_dir, extra_columns={'dir_name'})
```For further information, start from the page: [Parsing Scalars][parsing-scalars].
## Gallery
| Event Type | Tensorboard Dashboard | tbparse |
|----------------------------------|----------------------------------------------|-----------------------------------------|
| [Scalars][parsing-scalars] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/scalars.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/scalars.png) |
| [Tensors][parsing-tensors] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/tensors.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/tensors.png) |
| [Histograms][parsing-histograms] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/histograms.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/histograms.png) |
| [Images][parsing-images] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/images.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/images.png) |
| [Audio][parsing-audio] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/audio.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/audio.png) |
| [HParams][parsing-hparams] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/hparams.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/hparams.png) |
| [Text][parsing-text] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/text.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/text.png) |[parsing-scalars]: https://tbparse.readthedocs.io/en/latest/pages/parsing-scalars.html
[parsing-tensors]: https://tbparse.readthedocs.io/en/latest/pages/parsing-tensors.html
[parsing-histograms]: https://tbparse.readthedocs.io/en/latest/pages/parsing-histograms.html
[parsing-images]: https://tbparse.readthedocs.io/en/latest/pages/parsing-images.html
[parsing-audio]: https://tbparse.readthedocs.io/en/latest/pages/parsing-audio.html
[parsing-hparams]: https://tbparse.readthedocs.io/en/latest/pages/parsing-hparams.html
[parsing-text]: https://tbparse.readthedocs.io/en/latest/pages/parsing-text.htmlAll events above are generated and plotted in [gallery-pytorch.ipynb](https://github.com/j3soon/tbparse/blob/master/docs/notebooks/gallery-pytorch.ipynb).
## Installation
```sh
pip install tensorflow # or tensorflow-cpu
pip install -U tbparse # requires Python >= 3.7
```**Note**: If you don't want to install TensorFlow, see [Installing without TensorFlow](https://tbparse.readthedocs.io/en/latest/pages/installation.html#installing-without-tensorflow).
## Testing the Source Code
Test source code:
```sh
python3 -m pip install tox
python3 -m tox
```Test and build documentation:
```sh
cd docs
make clean
# sphinx-tabs seems to require html be built before doctest
make html
make doctest
```Generate test coverage:
```sh
python3 -m pip install pandas tensorflow torch tensorboardX pytest pytest-cov
python3 -m pytest --cov=./ --cov-report html
```## License
tbparse is distributed under the [Apache License 2.0](LICENSE).
The tbparse PyPI package depends on (imports) the following third-party package. Each third-party software package is provided under its own license:
- [pandas](https://github.com/pandas-dev/pandas) is distributed under the [BSD-3-Clause License ](https://github.com/pandas-dev/pandas/blob/main/LICENSE)
- [tensorboard](https://github.com/tensorflow/tensorboard) is distributed under the [Apache License 2.0](https://github.com/tensorflow/tensorboard/blob/master/LICENSE)