sleap.nn.viz

Visualization and plotting utilities.

sleap.nn.viz.imgfig(size: Union[float, Tuple] = 6, dpi: int = 72, scale: float = 1.0) → matplotlib.figure.Figure[source]

Create a tight figure for image plotting.

Parameters
  • size – Scalar or 2-tuple specifying the (width, height) of the figure in inches. If scalar, will assume equal width and height.

  • dpi – Dots per inch, controlling the resolution of the image.

  • scale – Factor to scale the size of the figure by. This is a convenience for increasing the size of the plot at the same DPI.

Returns

A matplotlib.figure.Figure to use for plotting.

sleap.nn.viz.plot_confmaps(confmaps: numpy.ndarray, output_scale: float = 1.0)[source]

Plot confidence maps reduced over channels.

sleap.nn.viz.plot_img(img: numpy.ndarray, dpi: int = 72, scale: float = 1.0) → matplotlib.figure.Figure[source]

Plot an image in a tight figure.

sleap.nn.viz.plot_instance(instance, skeleton=None, cmap=None, color_by_node=False, lw=2, ms=10, bbox=None, scale=1.0, **kwargs)[source]

Plot a single instance with edge coloring.

sleap.nn.viz.plot_instances(instances, skeleton=None, cmap=None, color_by_track=False, tracks=None, **kwargs)[source]

Plot a list of instances with identity coloring.

sleap.nn.viz.plot_pafs(pafs: numpy.ndarray, output_scale: float = 1.0, stride: int = 1, scale: float = 4.0, width: float = 1.0, cmap: Optional[str] = None)[source]

Quiver plot for a single frame of pafs.

sleap.nn.viz.plot_peaks(pts_gt: numpy.ndarray, pts_pr: Optional[numpy.ndarray] = None, paired: bool = False)[source]

Plot ground truth and detected peaks.