Code Monkey home page Code Monkey logo

c2board's Introduction

c2board

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.

Prerequisites

  • 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

Installation

  1. Clone the repository
git clone https://github.com/endernewton/c2board.git
  1. Make and install it locally
cd c2board
make

Usage

  • For graph visualization, you can follow demo_graph.py. The main function to call is writer.write_graph, which accepts either a CNNModelHelper, or Net, or NetDef 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) where dict is the dictionary of the scalars, and iter the current iteration.
    • Second, for histograms and images, we need to call the workspace.FetchBlob function to fetch the values. For those, we first use writer.append_histogram(name) or writer.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 call writer.write_summaries(iter) and the underlying method will take care of fetching blobs, computing histograms, etc.
  • When it starts dumping, you can just use the normal tensorboard command line to visualize things.

Screen shots

These screen shots are taken when training a detector with detectron.

References

c2board's People

Contributors

endernewton avatar sefira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

c2board's Issues

AttributeError: 'DeviceOption' object has no attribute 'cuda_gpu_id'

Hi,
Thank you very much for providing this tool.
But I encountered error when using writer.write_graph this function.
And the argument I provided to it is a DetectionModelHelper(from the Facebook detectron repo) class object, which is a subclass of cnn.CNNModelHelper.
But I got the error:

  File "~/c2board/c2board/writer.py", line 229, in write_graph
    current_graph, track_blob_names = model_to_graph(model_or_nets_or_protos, **kwargs)

  File "~/c2board/c2board/graph.py", line 376, in model_to_graph
    return nets_to_graph(nets, **kwargs)

  File "~/c2board/c2board/graph.py", line 381, in nets_to_graph
    return protos_to_graph(nets, **kwargs)

  File "~/c2board/c2board/graph.py", line 388, in protos_to_graph
    return _operators_to_graph_def(ops, **kwargs)

  File "~/c2board/c2board/graph.py", line 369, in _operators_to_graph_def
    current_graph.node.extend(_operator_to_node(op, inter_blobs, seen))

  File "~/c2board/c2board/graph.py", line 229, in _operator_to_node
    n.device = _tf_device(op.device_option)

  File "~/c2board/c2board/graph.py", line 171, in _tf_device
    return "/gpu:{}".format(device_option.cuda_gpu_id)

AttributeError: 'DeviceOption' object has no attribute 'cuda_gpu_id'

some problem in demo_graph.py

Hi!
the code in demo_graph.py
writer.add_graph()
i think should be ??
writer.write_graph()

I run my code without any problem, but I don't know how to enter the Tensorboard in browsers.

whatever, the c2board will benefit so much to the caffe2 user

Thank you~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.