anomalib.utils.callbacks.visualizer.visualizer_metric

Metric Visualizer Callback.

Module Contents

Classes

MetricVisualizerCallback

Callback that visualizes the metric results of a model by plotting the corresponding curves.

class anomalib.utils.callbacks.visualizer.visualizer_metric.MetricVisualizerCallback(task: str, mode: str, image_save_path: str, inputs_are_normalized: bool = True, show_images: bool = False, log_images: bool = True, save_images: bool = True)[source]

Bases: anomalib.utils.callbacks.visualizer.visualizer_base.BaseVisualizerCallback

Callback that visualizes the metric results of a model by plotting the corresponding curves.

To save the images to the filesystem, add the ‘local’ keyword to the project.log_images_to parameter in the config.yaml file.

on_test_end(trainer: pytorch_lightning.Trainer, pl_module: anomalib.models.components.AnomalyModule) None[source]

Log images of the metrics contained in pl_module.

In order to also plot custom metrics, they need to have implemented a generate_figure function that returns Tuple[matplotlib.figure.Figure, str].

Parameters
  • trainer (pl.Trainer) – pytorch lightning trainer.

  • pl_module (AnomalyModule) – pytorch lightning module.