Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lanpa committed Aug 9, 2017
1 parent 005c0db commit d2fcbe6
Showing 1 changed file with 9 additions and 54 deletions.
63 changes: 9 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ including scalar, image, histogram, audio, text, graph and embedding.

see [demo](http:35.197.26.245:6006) (result of `demo.py` and some images generated by BEGAN)

## install
## Install

`#tested on anaconda2/anaconda3, tensorflow 1.2.1, pytorch 0.1.12, torchvision 0.1.8`

Expand All @@ -19,7 +19,10 @@ see [demo](http:35.197.26.245:6006) (result of `demo.py` and some images generat

As this time (v0.1.12), to use the graph drawing feature, you need to build pytorch from source.

## usage
## API
http://tensorboard-pytorch.readthedocs.io/en/latest/tensorboard.html

## Usage
```python
import torch
import torchvision.utils as vutils
Expand Down Expand Up @@ -52,6 +55,7 @@ writer.close()

`tensorboard --logdir runs`

## Screenshots
scalar</br>
<img src="screenshots/scalar.png" height="200">

Expand All @@ -61,73 +65,24 @@ image</br>
audio</br>
<img src="screenshots/audio.png" height="100">

distribution</br>
<img src="screenshots/distribution.png" height="200">

histogram</br>
<img src="screenshots/histogram.png" height="400">

text</br>
<img src="screenshots/text.png" height="200">
## tweaks

## Tweaks
To show more images in tensorboard's image tab, just
modify the hardcoded `event_accumulator` in
`~/anaconda3/lib/python3.6/site-packages/tensorflow/tensorboard/backend/application.py`
as you wish.

## API

`class SummaryWriter(str log_dir)`
###### parameter:
* `log_dir` (*str*) - the location of the log folder.

> `add_scalar(str tag, float value, int global_step=None)`
>> ###### parameter:
> * `value` (*float*) - the value to keep.
> `add_image(str tag, torch.Tensor t, int global_step=None)`
>> ###### parameter:
> * `t` (*torch.Tensor*) - torch tensor of size (3,H,W). I suggest use `torchvision.utils.make_grid()` to prepare it.
> `add_audio(str tag, torch.Tensor t, int global_step=None)`
>> ###### parameter:
> * `t` (*torch.Tensor*) - one dimensional torch tensor. The value should between [-1, 1]. The sample rate is currently fixed at 44100 KHz.
>`add_histogram(str tag, numpy.ndarray values, int global_step=None, bins='tensorflow')`
>> ###### parameter:
> * `values` (*numpy.ndarray*) - one dimensional numpy array.
> * `bins` (*str*) - one of {'tensorflow', [numpy_arguments](https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html)}, determines how the bins are made.
>`add_text(str tag, str text_to_save, int global_step=None)`
>> ###### parameter:
> * `text_to_save ` (*str*) - the string to keep.
>`add_graph(torch.nn.Module model, torch.autograd.Variable lastnode)`
>> ###### parameter:
> * `model ` (*torch.nn.Module*) - the model to draw.
> * `lastnode ` (*torch.autograd.Variable*) - the output variable of the model.
>> see `demo_graph.py`
`add_embedding(torch.Tensor t, str save_path, list metadata=None, torch.Tensor label_img=None)`
> ###### parameter:
* `t ` (*torch.Tensor*) - A two dimensional tensor. Each row corresponds to one feature vector.
* `save_path` (*str*) - save path
* `metadata` (*list*) - a list of label composed of number or string. `len(metadata)` should equal the number of rows of `t`
* `label_img` (*torch.Tensor*) - 4-D tensor (NCHW). `label_img.size(0)` should equal the number of rows of `t`

> see `demo_embedding.py`
> ### Common parameters:
> * `tag` (*str*) - values with same tag group together.
> * `global_step` (*int*) - logs the training step on which the value is saved.

## TODO
audio sample rate


## reference:
## Reference:

https://github.com/TeamHG-Memex/tensorboard_logger

Expand Down

0 comments on commit d2fcbe6

Please sign in to comment.