sleap.nn.viz#
Visualization and plotting utilities.
- sleap.nn.viz.generate_skeleton_preview_image(instance: Instance, square_bb: bool = True, thumbnail_size=(128, 128)) bytes [source]#
Generate preview image for skeleton based on given instance.
- Parameters:
instance – A
sleap.Instance
object for which to generate the preview image from.square_bb – A boolean flag for whether or not the preview image should be a square image
thumbnail_size – A tuple of (w,h) for what the size of the thumbnail image should be
- Returns:
A byte string encoding of the preview image.
- sleap.nn.viz.imgfig(size: Union[float, Tuple] = 6, dpi: int = 72, scale: float = 1.0) 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: ndarray, output_scale: float = 1.0)[source]#
Plot confidence maps reduced over channels.
- sleap.nn.viz.plot_img(img: ndarray, dpi: int = 72, scale: float = 1.0) 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.