October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Visualize Data and Models with TensorBoard: A Keras Tutorial

A practical Keras guide to logging TensorBoard runs and choosing dashboards to inspect metrics, model structure, tensor values, images, embeddings, and runtime traces.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

TensorBoard lets you follow training metrics, inspect model structure and tensor values, and explore richer data such as images and embeddings. In this Keras walkthrough, you’ll write summaries to a run-specific log directory, launch TensorBoard from a shell or notebook, and choose the view that answers your question.

What TensorBoard shows

TensorFlow describes TensorBoard as “a suite of visualization tools to understand, debug, and optimize TensorFlow programs for ML experimentation” (TensorFlow TensorBoard). It turns data written during a run into dashboards that help answer questions such as: How did loss change? What structure did the framework build? Did tensor values shift as training progressed?

The dashboards offer complementary views rather than interchangeable measurements. A scalar plot tracks a metric over time; a graph shows structure; a histogram shows a distribution of values. Images, embeddings, and profiling traces provide other kinds of evidence about a run.

Log a Keras training run

Give each experiment its own log directory so its event data can be found and compared without mixing it with unrelated runs. This minimal example uses a timestamped directory and attaches a TensorBoard callback to model.fit():

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
  • Use scikit-learn to track an example ML project end to end
  • Explore several models, including support vector machines, decision trees, random forests, and ensemble methods
  • Exploit unsupervised learning techniques such as dimensionality reduction, clustering, and anomaly detection
  • Dive into neural net architectures, including convolutional nets, recurrent nets, generative adversarial networks, autoencoders, diffusion models, and transformers
  • Use TensorFlow and Keras to build and train neural nets for computer vision, natural language processing, generative models, and deep reinforcement learning
from datetime import datetime
from pathlib import Path
import tensorflow as tf

logdir = Path("logs") / datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=str(logdir))

model = tf.keras.Sequential([
    tf.keras.layers.Input(shape=(784,)),
    tf.keras.layers.Dense(128, activation="relu"),
    tf.keras.layers.Dense(10, activation="softmax"),
])
model.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"])

# x_train and y_train should contain your prepared training data.
model.fit(x_train, y_train, epochs=5, callbacks=[tensorboard_callback])

Replace x_train and y_train with prepared data matching the model’s input and output. The Keras callback writes summaries under the chosen log_dir; the TensorFlow graph tutorial demonstrates recording graph data during model.fit() (TensorFlow graph tutorial). Avoid reusing the same directory for unrelated callbacks; the callback reference says its log directory should not be reused by other callbacks (TensorBoard callback API, TensorFlow v2.16.1).

Launch TensorBoard

Start TensorBoard with the parent directory containing the run directory. Use the same value as the logs path above:

From a shell

tensorboard --logdir=logs

Open the local address printed in the terminal to view the dashboards.

From a notebook

%load_ext tensorboard
%tensorboard --logdir logs

The TensorFlow quickstart documents both the command-line and notebook workflows (TensorBoard quickstart). In hosted notebooks, availability of individual dashboards can vary by environment; the notebook guide notes that some dashboards may not be available in some hosted environments (TensorBoard in notebooks).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a dashboard by the question

Scalars: are metrics improving?

Use Scalars for values such as loss and accuracy. The plots show how logged metrics change across training steps or epochs, helping you see trends, plateaus, or unstable progress. Compare runs only when their logged metrics and training setup make that comparison meaningful.

Graphs: what computation was built?

The Graphs dashboard can show an op-level execution graph and a conceptual Keras graph. Use it to inspect how TensorFlow represents the computation and to understand model structure; it does not tell you whether the model is learning well. That question belongs to the metric plots.

Histograms and distributions: how are tensor values changing?

These views show tensor values as distributions over time. They can help reveal shifts in weights, activations, or other logged tensors that a single scalar can conceal. They are most useful when you have a specific tensor or layer behavior to investigate.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Optional: inspect images and embeddings

Images: view examples or generated tensors

Image summaries can display input examples, weights, generated tensors, or diagnostic images. They help you inspect visual content directly instead of inferring it from metrics. TensorFlow’s image tutorial demonstrates logging image data (TensorBoard image summaries).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Embeddings: explore neighborhoods

The Embedding Projector visualizes high-dimensional embeddings in a lower-dimensional view, where you can explore neighboring points or terms. It needs model checkpoint data and metadata for the layer being examined; a plot cannot be produced from a model name or layer alone. Follow the TensorFlow embedding tutorial for its checkpoint and metadata files (Embedding Projector tutorial).

Optional: profile runtime behavior

Use profiling when the question is about execution cost rather than model quality: traces can help locate runtime bottlenecks. Profiler support and plugin setup depend on TensorFlow, TensorBoard, and environment versions, so check the current profiling guide for requirements before following older examples (TensorFlow Profiler guide).

Version and environment checks

TensorBoard callback options can change across TensorFlow releases. For example, the TensorFlow v2.16.1 callback reference marks write_graph as “Not supported at this time”; do not assume an option shown in older code is supported by your installed version. Check the API reference for the TensorFlow version in your environment, and verify which dashboards your notebook host exposes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.