Tensorboard Explained in 5 Min

Siraj Raval · Beginner ·🛠️ AI Tools & Apps ·9y ago

Key Takeaways

This video explains Tensorboard, a data visualization tool for TensorFlow, and demonstrates how to use it to visualize a simple handwritten character classifier and a more complex version of the classifier.

Full Transcript

hello world it's SJ and in this episode we're going to talk about tensor board tensor board is a data visualization tool that comes packaged with tensorflow tensorflow programs can range from super simple like an addition problem to Super complex using thousands of computations and they all have two basic components operations and tensors the idea is that you create a model that consists of a set of operations feed data or tensors into the model and the tensors will flow between operations until you get an output tensor which is your result tensor board was created as a way to help you understand the flow of tensors in your model so that you can debug and optimize it we're going to visualize a classifier that can recognize handwritten digits in tensor board we'll use two examples of the classifier one is a simple version in 60 lines of Python and the other is a more complex version python I love you don't worry if you don't understand every line of code we just want to get a general of what's Happening under the hood so that we can later understand the tensor board visualizations here we go we'll start by importing tensorflow in our input data class which pulls our training data from the web then we'll Define two helper functions in it weights we return a variable that contains randomly generated weight values along a normal distribution our second helper function will create our model A three- layer feed forward neural network we're going to create three layers and Define them via the Nam scope function the name scope function creates highle name spaces for operations in the tensorflow graph that we will later visualize in each layer will'll run a Dropout function and an activation function Dropout is a function that forces our neural network to learn several different representations of patterns so that generalization improves the activation function creates probabilities out of numbers so now that we have our two helper functions we can create variables to store our training and testing images as well as our training and testing labels next we can create input and output placeholders for our data then we'll initialize our weights between each of the three layers using the function we defined earlier we'll Define histogram summaries for each of our weights so we can visualize the distribution of Weights later in tensor board The Next Step is to add Dropout placeholders to our hidden and input layers we can then create our model using the variables we've created now that we have our model we'll create our cost function the cost function is a measure of how good a neural net is with respect to its given training sample and the expected output we want it to decrease over time we'll also measure the accuracy of the network we want that to increase over time we'll later visualize both next we'll create a session to run our graph computation in our session we'll save our model using the summary writer lastly we'll initialize our variables for training and train our model that's it I know that was really fast unlike series comp apprehension you heard me Apple let's visualize that code in tensor board and I'll explain it more summary operations are how tensor board acquires data from our tensorflow runs they are functions like tf. Matrix multiply we created a number of them in our code here in the events tab we can view our scaler summaries accuracy and cost the x-axis shows the time steps and the y- axis shows the accuracy measure or the percentage of correct predictions over time we can blow up our graph for a closer look or view a wider range of data points by expanding the y- AIS we can also drag a rectangle on our graph to zoom in on a certain region if we' like and double click to zoom out as we Mouse over the chart it will produce crosshairs with data values we can change how smooth our line is by adjusting the slider the step option shows time steps the relative option shows the time relative to the first data point that means the number of minutes or hours since the training run was started and the wall option shows the actual time the runs happened we can create more tags as well in the sidebar it can either be an entirely new tag or a tag that will group a bunch of existing summaries together into a new category let's switch to a more complex version of our handwritten character classifier example with even more scalar summaries we can type in it's over 9,000 and since no summary contains those terms it becomes a new category but if we look under Max and mean they both contain summaries for biases so if we type in biases it will create a new category that contains both biases from these two existing categories we can also download our graphs in CSV or Json format for this more complex example we have lines for both training and testing data that way we can compare runs let's move on to images we created an image summary this lets us view the images in both the training and testing folder okay let's switch back to our simple classifier and move on to the graphs tab which lets us inspect our TF model we can see each of the three layers we created via the name scope function let's double click on one of our layer name spaces to expand it the first thing that pops out is the Dropout function which we declared inside of the scope as well as our relo and Matrix multiply function notice the arrows from both nodes pointing to the cost operation the direction of the arrows shows the direction that the tensors are flowing our two placeholder operation nodes X and P keep input hidden which is used for the Dropout function serve as entry points for our tensors they move through each of the three layers through the weights into the cost function every time eventually to the accuracy function and finally to the output placeholder that g gives us our prediction to reduce clutter tensorflow automatically shows nodes with many connections to other nodes in their own area to view in detail if we wanted to we can add them back to the main graph by clicking the add to main graph button in the detail card yo um bringing it back let's take a look at the sidebar we can choose which run we want to display train or test and show the graph at each time step the color option lets us see at each time step what structures are being used which device each operation is running on compute time along a scale and memory usage we can also manually upload a saved tensorflow graph right from the UI if we'd like let's move on to distrib ions we created histogram summaries for all three of our weights between layers and we can view the distribution of each weight here let's switch to our complex classifier the light part shows all the weights across time and the Shaded Parts shows those weights that are actually activated during training these curves represent percentiles like the Max and mean and median the histogram plot allows us to plot any variables we like from our graph it's showing how the values of our weights change with training isn't it beautiful tensor board lets you visualize your data so you can debug and optimize it you can create summary operations in your tensorflow program which takes tensors as inputs and produces outputs tensor board reads these summaries and displays them visually the challenge for this video is to create a tensorflow program that visualizes audio data in some way and winner gets a shout out from me in two episodes more info and links in the description Please Subscribe for more ml videos and for now I've got to go get some sunlight so thanks for watching

Original Description

In this video, we first go through the code for a simple handwritten character classifier in Python, then visualize it in Tensorboard. The point of this video was to showcase Tensorboard as a data visualization tool. We also use a more complex handwritten character classifier to further showcase all of Tensorboard's features. This was the hardest video I've ever had to make in terms of timing. It was really difficult to fit this many TB features into this time frame. The code for this video is here: https://github.com/llSourcell/Tensorboard_demo I created a Slack channel for us, sign up here: https://wizards.herokuapp.com/ Challenge: The challenge for this video is to visualize some audio data in Tensorboard. To date, I haven't seen any repos on GitHub that do this. The audio feature seems relatively new in Tensorboard. The first person who does this and posts it in the comments by Sept 30 2016 gets a shoutout from me in my video release on that date! Tensorboard tutorial: https://www.tensorflow.org/versions/r0.7/how_tos/summaries_and_tensorboard/index.html Another good TB tutorial: https://www.tensorflow.org/versions/r0.7/how_tos/graph_viz/index.html An unofficial tutorial: http://www.slideshare.net/hunkim/tensor-board A video i found on tensorboard: https://www.youtube.com/watch?v=zp5EtBvwQbw I love you guys! Thanks for watching my videos and if you've found any of them useful I'd love your support on Patreon: https://www.patreon.com/user?u=3191693 Much more to come so please SUBSCRIBE, LIKE, and COMMENT! :) Follow me: Twitter: https://twitter.com/sirajraval Facebook: https://www.facebook.com/sirajology Instagram: https://www.instagram.com/sirajraval/ Instagram: https://www.instagram.com/sirajraval/ Signup for my newsletter for exciting updates in the field of AI: https://goo.gl/FZzJ5w Hit the Join button above to sign up to become a member of my channel for access to exclusive content! Join my AI community: http://chatgptschool.io/ Sign up for
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Siraj Raval · Siraj Raval · 35 of 60

1 What is Bitcoin?
What is Bitcoin?
Siraj Raval
2 5 Ways to Use Bitcoin
5 Ways to Use Bitcoin
Siraj Raval
3 BTC Fever - Siraj [Music Video]
BTC Fever - Siraj [Music Video]
Siraj Raval
4 5 Reasons to Build Decentralized Apps
5 Reasons to Build Decentralized Apps
Siraj Raval
5 The Interplanetary File System
The Interplanetary File System
Siraj Raval
6 How to Build a Dapp in 3 min
How to Build a Dapp in 3 min
Siraj Raval
7 Life Before Smartphones
Life Before Smartphones
Siraj Raval
8 4 Ways to Use Smart Contracts
4 Ways to Use Smart Contracts
Siraj Raval
9 3 Dapps You HAVE to See
3 Dapps You HAVE to See
Siraj Raval
10 Char's Life as a BitTorrent Engineer
Char's Life as a BitTorrent Engineer
Siraj Raval
11 4 Reasons AlphaGo is a Huge Deal
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
12 Build a Neural Net in 4 Minutes
Build a Neural Net in 4 Minutes
Siraj Raval
13 Sentiment Analysis in 4 Minutes
Sentiment Analysis in 4 Minutes
Siraj Raval
14 The Hackathon Life
The Hackathon Life
Siraj Raval
15 Your First ML App - Machine Learning for Hackers #1
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
16 Build an AI Composer - Machine Learning for Hackers #2
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
17 Build a Game AI - Machine Learning for Hackers #3
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
18 Build a Movie Recommender - Machine Learning for Hackers #4
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
19 Build an AI Artist - Machine Learning for Hackers #5
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
20 Build a Chatbot - ML for Hackers #6
Build a Chatbot - ML for Hackers #6
Siraj Raval
21 Build an AI Reader - Machine Learning for Hackers #7
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
22 Build an AI Writer - Machine Learning for Hackers #8
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
23 Build a Chatbot w/ an API - ML for Hackers #9
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
24 One-Shot Learning - Fresh Machine Learning #1
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
25 Generative Adversarial Nets - Fresh Machine Learning #2
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
26 Tone Analysis - Fresh Machine Learning #3
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
27 Generate Rap Lyrics - Fresh Machine Learning #4
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
28 Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
29 Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
30 Build an Antivirus in 5 Min - Fresh Machine Learning #7
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
31 TensorFlow in 5 Minutes (tutorial)
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
32 Build a Recurrent Neural Net in 5 Min
Build a Recurrent Neural Net in 5 Min
Siraj Raval
33 Build a Simulation in 5 Min
Build a Simulation in 5 Min
Siraj Raval
34 Build a TensorFlow Image Classifier in 5 Min
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
Tensorboard Explained in 5 Min
Tensorboard Explained in 5 Min
Siraj Raval
36 Generate Music in TensorFlow
Generate Music in TensorFlow
Siraj Raval
37 Build a Game Bot (LIVE)
Build a Game Bot (LIVE)
Siraj Raval
38 Deep Learning Frameworks Compared
Deep Learning Frameworks Compared
Siraj Raval
39 Introduction - Learn Python for Data Science #1
Introduction - Learn Python for Data Science #1
Siraj Raval
40 Build a Neural Network (LIVE)
Build a Neural Network (LIVE)
Siraj Raval
41 Twitter Sentiment Analysis - Learn Python for Data Science #2
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
42 Recommendation Systems - Learn Python for Data Science #3
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
43 Predicting Stock Prices - Learn Python for Data Science #4
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
44 Pong Neural Network (LIVE)
Pong Neural Network (LIVE)
Siraj Raval
45 Deep Dream in TensorFlow - Learn Python for Data Science #5
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
46 Visualizing Data with D3.js (LIVE)
Visualizing Data with D3.js (LIVE)
Siraj Raval
47 Genetic Algorithms - Learn Python for Data Science #6
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
48 Enter Siraj [Music Video]
Enter Siraj [Music Video]
Siraj Raval
49 Build a Web Scraper (LIVE)
Build a Web Scraper (LIVE)
Siraj Raval
50 Why is P vs NP Important?
Why is P vs NP Important?
Siraj Raval
51 How to Make a Neural Network (LIVE)
How to Make a Neural Network (LIVE)
Siraj Raval
52 How to Make an Amazing Tensorflow Chatbot Easily
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
53 How to Make an Amazing Video Game Bot Easily
How to Make an Amazing Video Game Bot Easily
Siraj Raval
54 How to Make a Tensorflow Neural Network (LIVE)
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
55 How to Make a Simple Tensorflow Speech Recognizer
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
56 Joel Shor - Really Quick Questions with an Awesome Google Engineer
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
57 How to Make a Path Planning Algorithm Easily (LIVE)
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
58 The Best Way to Prepare a Dataset Easily
The Best Way to Prepare a Dataset Easily
Siraj Raval
59 Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
60 How to Make a Tic Tac Toe Neural Network Easily (LIVE)
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval

This video teaches how to use Tensorboard to visualize and understand TensorFlow models, specifically a handwritten character classifier. It covers creating summary operations, histogram summaries, and scalar summaries, and how to use Tensorboard to visualize and debug models.

Key Takeaways
  1. Import TensorFlow and load data
  2. Define helper functions for weights and model creation
  3. Create variables for training and testing images and labels
  4. Create input and output placeholders
  5. Initialize weights and define histogram summaries
  6. Create model and cost function
  7. Create session and save model
  8. Visualize model in Tensorboard
💡 Tensorboard is a powerful tool for visualizing and understanding TensorFlow models, allowing users to debug and optimize their models more effectively.

Related AI Lessons

Up next
Salesforce Flow New Features (Summer '26) | Open Record, URL & Show Toast Messages
AITECHONE
Watch →