Visualizations

Tensorboard visuals

add_animated_gif(writer, tag, image_tensor, max_out, scale_factor, global_step=None)[source]

Creates an animated gif out of an image tensor and writes it with SummaryWriter.

Parameters
  • writer – Tensorboard SummaryWriter to write to

  • tag – Data identifier

  • image_tensor – tensor for the image to add, expected to be in CDHW format

  • max_out – maximum number of slices to animate through

  • scale_factor – amount to multiply values by. If the image data is between 0 and 1, using 255 for this value will scale it to displayable range

  • global_step – Global step value to record

add_animated_gif_no_channels(writer, tag, image_tensor, max_out, scale_factor, global_step=None)[source]

Creates an animated gif out of an image tensor and writes it with SummaryWriter.

Parameters
  • writer – Tensorboard SummaryWriter to write to

  • tag – Data identifier

  • image_tensor – tensor for the image to add, expected to be in DHW format

  • max_out – maximum number of slices to animate through

  • scale_factor – amount to multiply values by. If the image data is between 0 and 1, using 255 for this value will scale it to displayable range

  • global_step – Global step value to record

make_animated_gif_summary(tag, tensor, max_out=3, animation_axes=(3, ), image_axes=(1, 2), other_indices=None, scale_factor=1)[source]

Creates an animated gif out of an image tensor and returns Summary.

Parameters
  • tag – Data identifier

  • tensor – tensor for the image, expected to be in CHWD format

  • max_out – maximum number of slices to animate through

  • animation_axes – axis to animate on (not currently used)

  • image_axes – axes of image (not currently used)

  • other_indices – (not currently used)

  • scale_factor – amount to multiply values by. if the image data is between 0 and 1, using 255 for this value will scale it to displayable range

plot_2d_or_3d_image(data, step, writer, index=0, max_channels=1, max_frames=64, tag='output')[source]

Plot 2D or 3D image on the TensorBoard, 3D image will be converted to GIF image.

Note

Plot 3D or 2D image(with more than 3 channels) as separate images.

Parameters
  • data (Tensor or ndarray) – target data to be plotted as image on the TensorBoard. The data is expected to have ‘NCHW[D]’ dimensions, and only plot the first in the batch.

  • step (int) – current step to plot in a chart.

  • writer (SummaryWriter) – specify TensorBoard SummaryWriter to plot the image.

  • index (int) – plot which element in the input data batch, default is the first element.

  • max_channels (int) – number of channels to plot.

  • max_frames (int) – number of frames for 2D-t plot.

  • tag (str) – tag of the plotted image on TensorBoard.