Git Product home page Git Product logo

tensorboard_torch_tutorial's Introduction

Tensorboard with PyTorch

Created: Jul 31, 2020 2:13 PM Last Edited Time: Jul 31, 2020 2:49 PM

Overview

  1. Enviroment
    • Intall
  2. Basic Settings
    • Logs Dir Structure
    • Init Code
    • Execution
  3. Functions
  4. Practice

1. Enviroment

pip install torch
pip install tensorboard

2. Basic Settings

Log Directory

Recommend

./log_dir/timestamp

Expected Structure

./log_dir

  • /202012312020
  • /202012312035
  • /...

Init Code

We can save data through "SummaryWriter" Class

import datetime
import torch

# format : 202012311224
timestamp = datetime.datetime.today().strftime('%Y%m%d%H%M%S') 
log_dir = "./log_dir/{}".format(timestamp)
# dir is generated automatically
writer = SummaryWriter(log_dir)

Execution

terminal 
> tensorboard --logdir=./log_dir/
TensorBoard 2.3.0 at http://localhost:6006/ (Press CTRL+C to quit)

*Ports can be different, follow terminal's result

init page

*No information is displayed because the model has not been trained.

3. Functions

https://pytorch.org/docs/stable/tensorboard.html

  1. Scalar

    writer.add_scalar('name', value, epoch)

  2. Image

    writer.add_image('name', img[][])

  3. Histogram

    writer.add_histogram('name', weight, epoch)

  4. Graph

    writer.add_graph('name', model)

4. Practice

https://github.com/chjinny/tensorboard_torch

terminal 1 : training
> app.py

terminal 2 : tensor board
> tensorboard --logdir=./logs/

Result

Terminal 1

Terminal 2

Tensorboard (http://localhost:port)

  • Scalar

  • Histogram

Refs

tensorboard_torch_tutorial's People

Contributors

chjinny avatar

Stargazers

 avatar

Watchers

 avatar

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.