A hacked-up visualization tool for caffe2. Specifically, it dumps the computation graph and the training statistics of caffe2 into a tensorboard compatible format. Once it starts dumping, you can use tensorboard to visualize the results.
- Caffe2.
- Tensorboard. The code is meant to be standalone, so that you do not need to import both tensorflow and caffe2 at the same time -- unexpected behaviors can occur. However, tensorboard needs to be installed somewhere (like in another conda environment) for visualization, otherwise the dumped information is not useful by itself.
- Python libraries:
# for conda users conda install protobuf # or for ubuntu: sudo apt-get install protobuf-compiler libprotobuf-dev pip install json numpy Pillow six threading
- Clone the repository
git clone https://github.com/endernewton/c2board.git
- Make and install it locally
cd c2board
make
- For graph visualization, you can follow
demo_graph.py
. The main function to call iswriter.write_graph
, which accepts either aCNNModelHelper
, orNet
, orNetDef
object to visualize. - Training statistics can be divided into two types:
- First, for scalars, they are usually loss, current iteration pre-computed, therefore we can directly store them without any additional effort. The relevant function to call is
writer.write_scalars(dict, iter)
wheredict
is the dictionary of the scalars, anditer
the current iteration. - Second, for histograms and images, we need to call the
workspace.FetchBlob
function to fetch the values. For those, we first usewriter.append_histogram(name)
orwriter.append_image(name)
to build the list of blobs we are interested in when building up the graph. Then, during training we only need to callwriter.write_summaries(iter)
and the underlying method will take care of fetching blobs, computing histograms, etc.
- First, for scalars, they are usually loss, current iteration pre-computed, therefore we can directly store them without any additional effort. The relevant function to call is
- When it starts dumping, you can just use the normal
tensorboard
command line to visualize things.
These screen shots are taken when training a detector with detectron.
- tensorboard-pytorch to make tensors flow without tensorflow.
- caffe2-native tensorboard to visualize graphs.