MXBoard provides a set of APIs logging
MXNet data for visualization in
TensorBoard.
The idea of this project comes from the discussion with Zihao Zheng,
the author of
dmlc/tensorboard,
on delivering a visualization solution for MXNet users.
We aim at providing the logging APIs that could process MXNet data efficiently
and supporting most of the data types for visualization in the TensorBoard GUI.
We adapted the low-level logging components, FileWriter
, EventFileWriter
,
EventsWriter
, RecordWriter
,
and _EventLoggerThread
, from their Python and C++
implementations in TensorFlow,
and user-level logging APIs defined in SummaryWriter
from
tensorboard-pytorch.
The encoding algorithm used in writing protobuf objects into event files
is directly borrowed from
TeamHG-Memex/tensorboard_logger.
MXBoard currently only supports a set of Python APIs for logging the following data types listed in the TensorBoard GUI. Logging APIs for languages may be added in the future.
- GRAPHS
- SCALARS
- IMAGES
- HISTOGRAMS
- PROJECTOR/EMBENDDING
- AUDIO
- TEXT
- PR CURVES
The corresponding Python APIs are accessible through a class called SummaryWriter
as below.
mxboard.SummaryWriter.add_audio
mxboard.SummaryWriter.add_embedding
mxboard.SummaryWriter.add_graph
mxboard.SummaryWriter.add_histogram
mxboard.SummaryWriter.add_image
mxboard.SummaryWriter.add_pr_curve
mxboard.SummaryWriter.add_scalar
mxboard.SummaryWriter.add_text
pip install mxboard
git clone https://github.com/awslabs/mxboard.git
cd mxboard/python
python setup.py install
MXBoard is a logger for writing MXNet data to event files. To visualize those data in browsers, users still have to install TensorBoard separately.
pip install tensorflow tensorboard
Type
tensorboard --help
to verify that the TensorBoard binary has been installed correctly.
MXBoard relies on the following packages for data logging.
After installing all the required packages, let's walk through a simple example demonstrating how
MXBoard enables visualizing MXNet NDArray
s in terms of histograms in TensorBoard.
- Prepare a Python script for writing data generated by the
normal
operator to an event file. The data is generated ten times with decreasing standard deviation and written to the event file each time. It's expected to see the data distribution gradually becomes more centered around the mean value. Note that here we specify the creating the event file in the folderlogs
under the current directory. We will need to pass the folder path to the TensorBoard binary.
import mxnet as mx
from mxboard import SummaryWriter
with SummaryWriter(logdir='./logs') as sw:
for i in range(10):
# create a normal distribution with fixed mean and decreasing std
data = mx.nd.normal(loc=0, scale=10.0/(i+1), shape=(10, 3, 8, 8))
sw.add_histogram(tag='norml_dist', values=data, bins=200, global_step=i)
- Run TensorBoard by typing the following command under the same directory as
logs
.
tensorboard --logdir=./logs --host=127.0.0.1 --port=8888
Note that in some situations,
the port number 8888
may be occupied by other applications and launching TensorBoard
may fail. You may choose a different available port number.
- In the browser, enter the address
127.0.0.1:8888
, and click the tab HISTOGRAMS in the TensorBoard GUI. You will see data distribution changing as time evolves.
- https://github.com/TeamHG-Memex/tensorboard_logger
- https://github.com/lanpa/tensorboard-pytorch
- https://github.com/dmlc/tensorboard
- https://github.com/tensorflow/tensorflow
- https://github.com/tensorflow/tensorboard
This library is licensed under the Apache 2.0 License.