Skip to main content
Log media with the Weights & Biases Python SDK to inspect model inputs and outputs and compare results across runs, models, and datasets. Supported types include images, audio, video, histograms, 3D point clouds, molecules, and HTML. For API details, see the Data Types reference. For examples, see the model predictions report or watch the video walkthrough.

Pre-requisites

Some media types require additional dependencies. To install the Weights & Biases SDK with media dependencies, run:

Images

Use wandb.Image to log images from NumPy arrays, PIL images, or local files. Log images to inspect inputs, outputs, filter weights, and activations.
Autoencoder inputs and outputs
CoreWeave recommends logging fewer than 50 images per step to reduce the impact on training performance and image loading times.
The following tabs demonstrate how to log images using different input types.
Provide arrays directly when constructing images manually, such as by using make_grid from torchvision.
Weights & Biases converts arrays to PNG images using Pillow.
For NumPy arrays, use the shape (height, width, channels). Weights & Biases infers grayscale, RGB, or RGBA from a channel count of 1, 3, or 4, respectively. Images are saved as PNG files by default.Pixel values are normalized to the range 0–255 if values fall outside that range or all values fall within 0–1. To turn off normalization, pass normalize=False. For more control over array conversion, create a PIL image as shown in the PIL images tab.
To compare images across training steps, expand the image panel in the Weights & Biases App UI and use the step slider. Select an image to open it in full-screen view, where you can zoom and pan with the mouse or keyboard shortcuts. To compare images or videos across runs, steps, or indices in one view, use Compare mode.

Image overlays

Log semantic segmentation masks to adjust their opacity and inspect changes across steps in the Weights & Biases App UI.
Log images with segmentation masks or bounding boxes to inspect model predictions and ground truth in the Weights & Biases App UI.
Interactive mask viewing
Pass a dictionary to the masks argument of wandb.Image. Each key names a mask, such as predictions or ground_truth. Each value is a dictionary with the following fields:To log multiple masks for an image, provide a separate dictionary for each mask:
Segmentation masks for each key are defined at each step (each call to wandb.Run.log()).
  • If steps provide different values for the same mask key, only the most recent value for that key is applied to the image.
  • If steps provide different mask keys, the visibility controls show all keys, but only masks defined at the selected step are applied to the image. Toggling a mask that is not defined at that step does not change the image.
For a complete example, see the segmentation masks report and example notebook.
For an interactive example, see the bounding boxes report.

Image overlays in Tables

To display image overlays in a Weights & Biases Table, add a wandb.Image object with masks or bounding boxes to each row.
Interactive Segmentation Masks in Tables
This example logs one image with segmentation masks for each row in the table:

Histograms

Use wandb.Histogram to log numeric distributions, such as model gradients. In the Weights & Biases App UI, the x-axis shows training steps, the y-axis shows metric values, and color represents the count in each bin.
Pass a sequence of numbers, such as a list, array, or tensor, to wandb.Histogram. Weights & Biases flattens arrays and tensors and uses numpy.histogram() to calculate the histogram.By default, histograms use 64 bins. To customize the number of bins, set num_bins a value up to 512.
GAN discriminator gradients
Optionally set density=True to represent bin values as a probability density rather than counts.

3D visualizations

Use wandb.Object3D to log 3D point clouds and lidar scenes with bounding boxes. Provide a NumPy array with point coordinates and optional colors or category labels. Point clouds are interactive in the Weights & Biases App UI. Drag to rotate the view, zoom to inspect details, or hold Control while using the mouse to move through the scene. The following report shows scenes from the Lyft dataset with 3D bounding boxes:
The Weights & Biases App UI displays up to 300,000 points per point cloud.

NumPy array formats

Use one of the following array formats, where n is the number of points:

Python object

Use wandb.Object3D.from_point_cloud() to create a scene with points, bounding boxes, and vectors.
To move through a point cloud in the Weights & Biases App UI, hold Control while moving the mouse.

Point cloud files

Use wandb.Object3D.from_file() to load point cloud data from a JSON file:
The following JSON illustrates the format for point cloud data:

NumPy arrays

Use wandb.Object3D.from_numpy() with any of the supported array formats:

Molecules

Use wandb.Molecule to log molecular data and inspect 3D structures in the Weights & Biases App UI.
Supported file types are pdb, pqr, mmcif, mcif, cif, sdf, sd, gro, mol2, and mmtf. You can also log SMILES strings, RDKit mol files, and rdkit.Chem.rdchem.Mol objects. These examples require RDKit.
For an interactive example, see the AlphaFold workspace.
Molecule structure

2D view of a molecule

You can log a 2D view of a molecule using the wandb.Image data type and rdkit:

Other media

Weights & Biases also supports logging of a variety of other media types.

Audio

Use wandb.Audio to log audio data. Set sample_rate to the recording’s sample rate in hertz.
You can log up to 100 audio clips per step. For more information, see audio-file.

Video

Use wandb.Video to log a video file:
To log a NumPy array of video frames, specify the output format and frame rate:
Use the shape (frames, channels, height, width) for a single video or (batch, frames, channels, height, width) for a batch. Encoding NumPy arrays requires FFmpeg and MoviePy. Supported formats are "gif", "mp4", "webm", and "ogg". When passing an array or an in-memory stream, specify format. When encoding raw frames, the default frame rate is 4 frames per second. When you provide a file path, Weights & Biases checks that the file exists and uses a supported format. When you provide a BytesIO object, Weights & Biases creates a temporary file with the specified format as its extension. To view and play videos, open a media panel in your project workspace, run workspace, or report. Use Compare mode to compare videos across runs or steps.

Text

Use wandb.Table to display text alongside predictions, labels, or other values. Specify column names when you create the table. By default, the column headers are ["Input", "Output", "Expected"]. To ensure optimal UI performance, the default maximum number of rows is set to 10,000. However, you can explicitly override the maximum with wandb.Table.MAX_ROWS = {DESIRED_MAX}.
Alternatively, add rows with wandb.Table.add_data():
To create a table from a pandas DataFrame, pass it to dataframe:
For more usage information, see string.

HTML

Use wandb.Html to display custom HTML in a panel on the run page. Pass an HTML file or a string:
By default, Weights & Biases adds styles to the HTML. To disable this behavior, pass inject=False. To turn off this behavior pass inject=False:
For more usage information, see html-file.
Last modified on October 12, 2026