anomalib.utils.metrics.plotting_utils¶
Helper functions to generate ROC-style plots of various metrics.
Module Contents¶
Functions¶
|
Generate a simple, ROC-style plot, where x_vals is plotted against y_vals. |
- anomalib.utils.metrics.plotting_utils.plot_figure(x_vals: torch.Tensor, y_vals: torch.Tensor, auc: torch.Tensor, xlim: Tuple[float, float], ylim: Tuple[float, float], xlabel: str, ylabel: str, loc: str, title: str, sample_points: int = 1000) Tuple[matplotlib.figure.Figure, matplotlib.axis.Axis][source]¶
Generate a simple, ROC-style plot, where x_vals is plotted against y_vals.
Note that a subsampling is applied if > sample_points are present in x/y, as matplotlib plotting draws every single plot which takes very long, especially for high-resolution segmentations.
- Parameters
x_vals (Tensor) – x values to plot
y_vals (Tensor) – y values to plot
auc (Tensor) – normalized area under the curve spanned by x_vals, y_vals
xlim (Tuple[float, float]) – displayed range for x-axis
ylim (Tuple[float, float]) – displayed range for y-axis
xlabel (str) – label of x axis
ylabel (str) – label of y axis
loc (str) – string-based legend location, for details see https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.legend.html
title (str) – title of the plot
sample_points (int) – number of sampling points to subsample x_vals/y_vals with
- Returns
Figure and the contained Axis
- Return type
Tuple[Figure, Axis]