Shortcuts

mmagic.visualization.concat_visualizer

Module Contents

Classes

ConcatImageVisualizer

Visualize multiple images by concatenation.

class mmagic.visualization.concat_visualizer.ConcatImageVisualizer(fn_key: str, img_keys: Sequence[str], pixel_range={}, bgr2rgb=False, name: str = 'visualizer', *args, **kwargs)[source]

Bases: mmengine.visualization.Visualizer

Visualize multiple images by concatenation.

This visualizer will horizontally concatenate images belongs to different keys and vertically concatenate images belongs to different frames to visualize.

Image to be visualized can be:
  • torch.Tensor or np.array

  • Image sequences of shape (T, C, H, W)

  • Multi-channel image of shape (1/3, H, W)

  • Single-channel image of shape (C, H, W)

Parameters
  • fn_key (str) – key used to determine file name for saving image. Usually it is the path of some input image. If the value is dir/basename.ext, the name used for saving will be basename.

  • img_keys (str) – keys, values of which are images to visualize.

  • pixel_range (dict) – min and max pixel value used to denormalize images, note that only float array or tensor will be denormalized, uint8 arrays are assumed to be unnormalized.

  • bgr2rgb (bool) – whether to convert the image from BGR to RGB.

  • name (str) – name of visualizer. Default: ‘visualizer’.

  • **kwargs (*args and) – Other arguments are passed to Visualizer. # noqa

add_datasample(data_sample: mmagic.structures.DataSample, step=0) None[source]

Concatenate image and draw.

Parameters
  • input (torch.Tensor) – Single input tensor from data_batch.

  • data_sample (DataSample) – Single data_sample from data_batch.

  • output (DataSample) – Single prediction output by model.

  • step (int) – Global step value to record. Default: 0.

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.