Introduction to TensorBoard

Last updated on Nov 01 2021
Goutam Joseph

Table of Contents

Introduction to TensorBoard

TensorFlow is a visualization tool, which is called the TensorBoard. It is used for analyzing the Data flow graph and used to understand machine-learning models. TensorBoard is the interface used to visualize the graph and many tools to understand, debug, and optimize the model.

The important feature of TensorBoard is that it includes a view of different types of statistics about the parameters and details of any graph in a vertical alignment.

The deep neural network includes up to 36,000 nodes. TensorFlow helps in collapsing these nodes in high in collapsing these nodes in high-level blocks and highlighting the identical structures. This allows better analysis of the graph, focusing on the primary sections of the computation graph.

Page 1 Image 1 15
graph

The TensorBoard visualization is said to be very interactive where a user can pan, zoom, and expand the nodes to display the details.

The following are the given diagram representation shows the complete working of TensorBoard visualization-

Page 2 Image 2 9
visualization

The algorithms collapse the nodes into high-level blocks and highlighted the specific groups with identical structures, which separating the high-degree nodes. The TensorBoard created is useful and is treated equally important for tuning a machine learning model. This visualization tool is designed for the configuration log file.

Look at the picture below:

Page 3 Image 3 3
picture

A neural network decides how to connect the different “neurons” and how many layers before the model can predict the outcome. Once we have defined the architecture, we not only need to train the model but also metrics to compute the accuracy of the prediction. This metric is referred as a loss function. The objective is to as a loss function.

TensorBoard is a great tool to visualize metrics and highlighted the potential issues. The neural network can take hours to weeks before they find a solution. TensorBoard updates the parameters very often.

TensorBoard is located in this URL: http://localhost:6006

Types of DashBoard in TensorBoard

Page 4 Image 4 1
types
  1. Scalar Dashboard

It is used to visualize time-dependent stats; for example, we might want to look at the variations in learning rate or the loss function.

  1. Histogram

Histogram Dashboard in TensorBoard displays how the statistical distribution of a Tensor has varied over time. It visualizes data recorded via tf.summary.histogram.

  1. Distribution Dashboard

It shows some high-level use of tf.summary.histogram. It shows some high-level starts on a distribution. Each line on the chart gives a hint about the percentile in the distribution over the data.

  1. Image Dashboard

This shows the png that was saved via a tf.summary.image. Rows correspond to the labels and the columns to the run. By using this image dashboard of TensorBoard, we can embed custom visualizations.

  1. Audio Dashboard

It is an excellent tool for embedding playable audio widgets for audios saved via a tf.summary.audio. The dashboard always embedding the latest audio for every tag.

  1. Graph Explorer

It primarily used for enabling inspection of the TensorFlow model.

  1. Projector

The embedding projector in TensorFlow used for multi-dimensional data. The embedding projector reads data from the checkpoint file and might be set up with corresponding data, such as a vocabulary file.

  1. Text Dashboard

Text Dashboard shows text experts saved via tf.summary.text., includes features like hyperlinks, lists, and tables, are all supported.

Page 5 Image 5 2
text dashboard

Different Views of TensorBoard

Different views take inputs of different formats and display them differently. We can change them on the orange top bar.

  • Scalars- Visualize scalar values, such as classification accuracy.
  • Graph- Visualize the computational graph of our model, like the neural network model.
  • Distributions- Visualize how data changes over time, such as the weights of a neural network.
  • Histograms- A fancier view of the distribution that shows a distribution that shows distributions in a 3-dimensional perspective.
  • Projector- It can be used to visualize word embeddings (that is, word embedding are numerical representations of words that capture their semantic relationships)
  • Image- Visualizing image data
  • Audio- Visualizing audio data
  • Text- Visualizing text data

How to use TensorBoard?

We will learn how to open TensorBoard from the terminal for MacOS and Command-line Windows.

The code will be explained in a future tutorial; the focus here is on TensorBoard.

First, we need to import the libraries we will use during the training.

## Import the library
import tensorflow as tf
importnumpy as np

We create the data. It is an array of 10000 rows and columns/p>

X_train = (np.random.sample((10000,5)))
y_train =  (np.random.sample((10000,1)))
shape

The below code transform the data and create the model.

Note that the learning rate is equal to 0.1. If we change this rate to a higher value, the model will not find a solution. This is what happened on the left side of the above picture.

In the example below, we store the model inside the working directory, i.e., where we store the notebook or python file. Inside the path, TensorFlow create a folder called train with a child folder name linreg.

feature_columns = [
      tf.feature_column.numeric_column('x', shape=X_train.shape[1:])]
DNN_reg = tf.estimator.DNNRegressor(feature_columns=feature_columns,
# Indicate where to store the log file
model_dir='train',
     hidden_units=[500, 300],
optimizer=tf.train.ProximalAdagradOptimizer(
          learning_rate=0.1,
l1_regularization_strength=001
      )
)
Output:
INFO:tensorflow:Using the default configuration.INFO:tensorflow:Using config:{'_model_dir': 'train/linreg', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': None, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_service': None, '_cluster_spec': , '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
The last step consists to train the model. During the training period, TensorFlow writes information in the model directory.
# Train the estimator
train_input = tf.estimator.inputs.numpy_input_fn(
x={"x": X_train},
     y=y_train, shuffle=False,num_epochs=None)
train(train_input,steps=3000)
Output:
INFO:tensorflow:Calling model_fn.INFO:tensorflow:Done calling model_fn.INFO:tensorflow:Create CheckpointSaverHook.INFO:tensorflow: Graph was finalized.INFO:tensorflow:Running local_init_op.INFO:tensorflow:Done running local_init_op.INFO:tensorflow:Saving checkpoints for 1 into train/linreg/model.ckpt.INFO:tensorflow:loss = 40.060104, step = 1INFO:tensorflow:global_step/sec: 197.061INFO:tensorflow:loss = 10.62989, step = 101 (0.508 sec)INFO:tensorflow:global_step/sec: 172.487INFO:tensorflow:loss = 11.255318, step = 201 (0.584 sec)INFO:tensorflow:global_step/sec: 193.295INFO:tensorflow:loss = 10.604872, step = 301 (0.513 sec)INFO:tensorflow:global_step/sec: 175.378INFO:tensorflow:loss = 10.090343, step = 401 (0.572 sec)INFO:tensorflow:global_step/sec: 209.737INFO:tensorflow:loss = 10.057928, step = 501 (0.476 sec)INFO:tensorflow:global_step/sec: 171.646INFO:tensorflow:loss = 10.460144, step = 601 (0.583 sec)INFO:tensorflow:global_step/sec: 192.269INFO:tensorflow:loss = 10.529617, step = 701 (0.519 sec)INFO:tensorflow:global_step/sec: 198.264INFO:tensorflow:loss = 9.100082, step = 801 (0.504 sec)INFO:tensorflow:global_step/sec: 226.842INFO:tensorflow:loss = 10.485607, step = 901 (0.441 sec)INFO:tensorflow:global_step/sec: 152.929INFO:tensorflow:loss = 10.052481, step = 1001 (0.655 sec)INFO:tensorflow:global_step/sec: 166.745INFO:tensorflow:loss = 11.320213, step = 1101 (0.600 sec)INFO:tensorflow:global_step/sec: 161.854INFO:tensorflow:loss = 9.603306, step = 1201 (0.619 sec)INFO:tensorflow:global_step/sec: 179.074INFO:tensorflow:loss = 11.110269, step = 1301 (0.556 sec)INFO:tensorflow:global_step/sec: 202.776INFO:tensorflow:loss = 11.929443, step = 1401 (0.494 sec)INFO:tensorflow:global_step/sec: 144.161INFO:tensorflow:loss = 11.951693, step = 1501 (0.694 sec)INFO:tensorflow:global_step/sec: 154.144INFO:tensorflow:loss = 8.620987, step = 1601 (0.649 sec)INFO:tensorflow:global_step/sec: 151.094INFO:tensorflow:loss = 10.666125, step = 1701 (0.663 sec)INFO:tensorflow:global_step/sec: 193.644INFO:tensorflow:loss = 11.0349865, step = 1801 (0.516 sec)INFO:tensorflow:global_step/sec: 189.707INFO:tensorflow:loss = 9.860596, step = 1901 (0.526 sec)INFO:tensorflow:global_step/sec: 176.423INFO:tensorflow:loss = 10.695, step = 2001 (0.567 sec)INFO:tensorflow:global_step/sec: 213.066INFO:tensorflow:loss = 10.426752, step = 2101 (0.471 sec)INFO:tensorflow:global_step/sec: 220.975INFO:tensorflow:loss = 10.594796, step = 2201 (0.452 sec)INFO:tensorflow:global_step/sec: 219.289INFO:tensorflow:loss = 10.4212265, step = 2301 (0.456 sec)INFO:tensorflow:global_step/sec: 215.123INFO:tensorflow:loss = 9.668612, step = 2401 (0.465 sec)INFO:tensorflow:global_step/sec: 175.65INFO:tensorflow:loss = 10.009649, step = 2501 (0.569 sec)INFO:tensorflow:global_step/sec: 206.962INFO:tensorflow:loss = 10.477722, step = 2601 (0.483 sec)INFO:tensorflow:global_step/sec: 229.627INFO:tensorflow:loss = 9.877638, step = 2701 (0.435 sec)INFO:tensorflow:global_step/sec: 195.792INFO:tensorflow:loss = 10.274586, step = 2801 (0.512 sec)INFO:tensorflow:global_step/sec: 176.803INFO:tensorflow:loss = 10.061047, step = 2901 (0.566 sec)INFO:tensorflow:Saving checkpoints for 3000 into train/linreg/model.ckpt.INFO:tensorflow: Loss for the final step: 10.73032.  <tensorflow.python.estimator.canned.dnn.DNNRegressor at 0x1818e63630>
For Windows user
cd C:\Users\Admin\Anaconda3
activate hello-tf
To launch TensorBoard, we can use this code
tensorboard --logdir=.\train\linreg

So, this brings us to the end of blog. This Tecklearn ‘Introduction to TensorBoard’ blog helps you with commonly asked questions if you are looking out for a job in Artificial Intelligence. If you wish to learn Artificial Intelligence and build a career in AI or Machine Learning domain, then check out our interactive, Artificial Intelligence and Deep Learning with TensorFlow Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/artificial-intelligence-and-deep-learning-with-tensorflow/

Artificial Intelligence and Deep Learning with TensorFlow Training

About the Course

Tecklearn’s Artificial Intelligence and Deep Learning with Tensor Flow course is curated by industry professionals as per the industry requirements & demands and aligned with the latest best practices. You’ll master convolutional neural networks (CNN), TensorFlow, TensorFlow code, transfer learning, graph visualization, recurrent neural networks (RNN), Deep Learning libraries, GPU in Deep Learning, Keras and TFLearn APIs, backpropagation, and hyperparameters via hands-on projects. The trainee will learn AI by mastering natural language processing, deep neural networks, predictive analytics, reinforcement learning, and more programming languages needed to shine in this field.

Why Should you take Artificial Intelligence and Deep Learning with Tensor Flow Training?

  • According to Paysa.com, an Artificial Intelligence Engineer earns an average of $171,715, ranging from $124,542 at the 25th percentile to $201,853 at the 75th percentile, with top earners earning more than $257,530.
  • Worldwide Spending on Artificial Intelligence Systems Will Be Nearly $98 Billion in 2023, According to New IDC Spending Guide at a GACR of 28.5%.
  • IBM, Amazon, Apple, Google, Facebook, Microsoft, Oracle and almost all the leading companies are working on Artificial Intelligence to innovate future technologies.

What you will Learn in this Course?

Introduction to Deep Learning and AI

  • What is Deep Learning?
  • Advantage of Deep Learning over Machine learning
  • Real-Life use cases of Deep Learning
  • Review of Machine Learning: Regression, Classification, Clustering, Reinforcement Learning, Underfitting and Overfitting, Optimization
  • Pre-requisites for AI & DL
  • Python Programming Language
  • Installation & IDE

Environment Set Up and Essentials

  • Installation
  • Python – NumPy
  • Python for Data Science and AI
  • Python Language Essentials
  • Python Libraries – Numpy and Pandas
  • Numpy for Mathematical Computing

More Prerequisites for Deep Learning and AI

  • Pandas for Data Analysis
  • Machine Learning Basic Concepts
  • Normalization
  • Data Set
  • Machine Learning Concepts
  • Regression
  • Logistic Regression
  • SVM – Support Vector Machines
  • Decision Trees
  • Python Libraries for Data Science and AI

Introduction to Neural Networks

  • Creating Module
  • Neural Network Equation
  • Sigmoid Function
  • Multi-layered perception
  • Weights, Biases
  • Activation Functions
  • Gradient Decent or Error function
  • Epoch, Forward & backword propagation
  • What is TensorFlow?
  • TensorFlow code-basics
  • Graph Visualization
  • Constants, Placeholders, Variables

Multi-layered Neural Networks

  • Error Back propagation issues
  • Drop outs

Regularization techniques in Deep Learning

Deep Learning Libraries

  • Tensorflow
  • Keras
  • OpenCV
  • SkImage
  • PIL

Building of Simple Neural Network from Scratch from Simple Equation

  • Training the model

Dual Equation Neural Network

  • TensorFlow
  • Predicting Algorithm

Introduction to Keras API

  • Define Keras
  • How to compose Models in Keras
  • Sequential Composition
  • Functional Composition
  • Predefined Neural Network Layers
  • What is Batch Normalization
  • Saving and Loading a model with Keras
  • Customizing the Training Process
  • Using TensorBoard with Keras
  • Use-Case Implementation with Keras

GPU in Deep Learning

  • Introduction to GPUs and how they differ from CPUs
  • Importance of GPUs in training Deep Learning Networks
  • The GPU constituent with simpler core and concurrent hardware
  • Keras Model Saving and Reusing
  • Deploying Keras with TensorBoard

Keras Cat Vs Dog Modelling

  • Activation Functions in Neural Network

Optimization Techniques

  • Some Examples for Neural Network

Convolutional Neural Networks (CNN)

  • Introduction to CNNs
  • CNNs Application
  • Architecture of a CNN
  • Convolution and Pooling layers in a CNN
  • Understanding and Visualizing a CNN

RNN: Recurrent Neural Networks

  • Introduction to RNN Model
  • Application use cases of RNN
  • Modelling sequences
  • Training RNNs with Backpropagation
  • Long Short-Term memory (LSTM)
  • Recursive Neural Tensor Network Theory
  • Recurrent Neural Network Model

Application of Deep Learning in image recognition, NLP and more

Real world projects in recommender systems and others

Got a question for us? Please mention it in the comments section and we will get back to you.

 

 

0 responses on "Introduction to TensorBoard"

Leave a Message

Your email address will not be published. Required fields are marked *