plot_inset#
- deepinv.utils.plot_inset(img_list, titles=None, labels=[], label_loc=(0.03, 0.03), extract_loc=(0.0, 0.0), extract_size=0.2, inset_loc=(0.0, 0.5), inset_size=0.4, figsize=None, save_fn=None, dpi=1200, show=True, return_fig=False, cmap='gray')[source]#
Plots a list of images with zoomed-in insets extracted from the images.
The inset taken from extract_loc and shown at inset_loc. The coordinates extract_loc, inset_loc, and label_loc correspond to their top left corners taken at (horizontal, vertical) from the image’s top left.
Each loc can either be a tuple (float, float) which uses the same loc for all images across the batch dimension, or a list of these whose length must equal the batch dimension.
Coordinates are fractions from 0-1, (0, 0) is the top left corner and (1, 1) is the bottom right corner.
- Parameters:
img_list (list[torch.Tensor], torch.Tensor) – list of images to plot or single image.
titles (list[str]) – list of titles for each image, has to be same length as img_list.
labels (list[str]) – list of overlaid labels for each image, has to be same length as img_list.
label_loc (list, tuple) – location or locations for label to be plotted on image, defaults to (.03, .03)
extract_loc (list, tuple) – image location or locations for extract to be taken from, defaults to (0., 0.)
extract_size (float) – size of extract to be taken from image, defaults to 0.2
inset_loc (list, tuple) – location or locations for inset to be plotted on image, defaults to (0., 0.5)
inset_size (float) – size of inset to be plotted on image, defaults to 0.4
save_fn (str) – filename for plot to be saved, if None, don’t save, defaults to None
dpi (int) – DPI to save images.
show (bool) – show the image plot.
return_fig (bool) – return the figure object.