An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
When training a default model and dataset, visualization stage does not work with mps accelerator
Dataset
MVTec
Model
PADiM
Steps to reproduce the behavior
On a Macbook M* machine, run the following CLI command:
anomalib train --model Padim --data MVTec
OS information
OS information:
OS: MacOS
Python version: 3.10
Anomalib version: 1.0.0
PyTorch version: 2.1.2
CUDA/cuDNN version: mps
GPU models and configuration: M3 Max
Any other relevant information: N/A
Expected behavior
Visualizer to properly generate the output figure.
Screenshots
No response
Pip/GitHub
GitHub
What version/branch did you use?
v1.0.0
Configuration YAML
N/A
Logs
โฏ
anomalib train --model Padim --data MVTec
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find torch. To use this feature, ensure that you have torch installed.
2024-01-11 08:10:13,873 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
[01/11/24 08:10:13] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
Seed set to 4150399376
2024-01-11 08:10:14,272 - anomalib.utils.config - WARNING - Anomalib currently does not support multi-gpu training. Setting devices to 1.
[01/11/24 08:10:14] WARNING Anomalib currently does not support multi-gpu training. Setting devices to 1. config.py:239
[01/11/24 08:10:14] WARNING Anomalib currently does not support multi-gpu training. Setting devices to 1. config.py:239
2024-01-11 08:10:14,273 - anomalib.utils.config - INFO - Setting model input size (256, 256) to dataset size (256, 256).
INFO Setting model input size (256, 256) to dataset size (256, 256). config.py:180
INFO Setting model input size (256, 256) to dataset size (256, 256). config.py:180
2024-01-11 08:10:14,274 - anomalib.utils.config - INFO - Project path set to results/padim/mvtec/bottle
INFO Project path set to results/padim/mvtec/bottle config.py:116
INFO Project path set to results/padim/mvtec/bottle config.py:116
2024-01-11 08:10:14,305 - anomalib.models.components.base.anomaly_module - INFO - Initializing Padim model.
INFO Initializing Padim model. anomaly_module.py:36
INFO Initializing Padim model. anomaly_module.py:36
2024-01-11 08:10:14,533 - timm.models.helpers - INFO - Loading pretrained weights from url (https://download.pytorch.org/models/resnet18-5c106cde.pth)
INFO Loading pretrained weights from url helpers.py:247
(https://download.pytorch.org/models/resnet18-5c106cde.pth)
INFO Loading pretrained weights from url helpers.py:247
(https://download.pytorch.org/models/resnet18-5c106cde.pth)
2024-01-11 08:10:14,610 - anomalib.data.utils.transforms - INFO - No config file has been provided. Using default transforms.
INFO No config file has been provided. Using default transforms. transforms.py:130
INFO No config file has been provided. Using default transforms. transforms.py:130
2024-01-11 08:10:14,611 - anomalib.data.utils.transforms - INFO - No config file has been provided. Using default transforms.
INFO No config file has been provided. Using default transforms. transforms.py:130
INFO No config file has been provided. Using default transforms. transforms.py:130
2024-01-11 08:10:14,612 - anomalib.callbacks - INFO - Loading the callbacks
INFO Loading the callbacks __init__.py:45
INFO Loading the callbacks __init__.py:45
2024-01-11 08:10:14,614 - anomalib.engine.engine - INFO - Overriding max_epochs from None with 1 for Padim
INFO Overriding max_epochs from None with 1 for Padim engine.py:81
INFO Overriding max_epochs from None with 1 for Padim engine.py:81
2024-01-11 08:10:14,614 - anomalib.engine.engine - INFO - Overriding val_check_interval from None with 1.0 for Padim
INFO Overriding val_check_interval from None with 1.0 for Padim engine.py:81
INFO Overriding val_check_interval from None with 1.0 for Padim engine.py:81
2024-01-11 08:10:14,615 - anomalib.engine.engine - INFO - Overriding num_sanity_val_steps from None with 0 for Padim
INFO Overriding num_sanity_val_steps from None with 0 for Padim engine.py:81
INFO Overriding num_sanity_val_steps from None with 0 for Padim engine.py:81
2024-01-11 08:10:14,741 - anomalib.data.image.mvtec - INFO - Found the dataset.
INFO Found the dataset. mvtec.py:413
INFO Found the dataset. mvtec.py:413
Epoch 0: 0%| | 0/7 [00:00<?, ?it/s]Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
2024-01-11 08:10:21,052 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:21,052 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:21,053 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:21,053 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:21,053 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:21,053 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:21,053 - anomalib.utils.exceptions.imports - WA2024-01-11 08:10:21,053 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
RNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:21] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
Epoch 0: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 7/7 [00:06<00:00, 1.02it/s, v_num=42024-01-11 08:10:22,039 - anomalib.models.image.padim.lightning_model - INFO - Aggregating the embedding extracted from the training set.
[01/11/24 08:10:22] INFO Aggregating the embedding extracted from the training set. lightning_model.py:88
[01/11/24 08:10:22] INFO Aggregating the embedding extracted from the training set. lightning_model.py:88
2024-01-11 08:10:22,068 - anomalib.models.image.padim.lightning_model - INFO - Fitting a Gaussian to the embedding collected from the training set.
INFO Fitting a Gaussian to the embedding collected from the training set. lightning_model.py:91
INFO Fitting a Gaussian to the embedding collected from the training set. lightning_model.py:91
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
2024-01-11 08:10:28,254 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:28,255 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:28,255 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:28,255 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:28,255 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:28,255 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:28,255 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:10:28,255 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
[01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed. [01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:10:28] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
Epoch 0: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 7/7 [00:14<00:00, 0.47it/s, v_num=4]
2024-01-11 08:11:19,842 - anomalib.callbacks.timer - INFO - Training took 64.93 seconds
[01/11/24 08:11:19] INFO Training took 64.93 seconds timer.py:59
[01/11/24 08:11:19] INFO Training took 64.93 seconds timer.py:59
2024-01-11 08:11:19,861 - anomalib.data.image.mvtec - INFO - Found the dataset.
INFO Found the dataset. mvtec.py:413
INFO Found the dataset. mvtec.py:413
Testing: | | 0/? [00:00<?, ?it/s]Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
Could not find torch. To use this feature, ensure that you have torch installed.
2024-01-11 08:11:26,520 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:11:26,520 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:11:26,521 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:11:26,521 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:11:26,521 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:11:26,521 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:11:26,521 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
2024-01-11 08:11:26,521 - anomalib.utils.exceptions.imports - WARNING - Could not find comet_ml. To use this feature, ensure that you have comet_ml installed.
[01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed. [01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
[01/11/24 08:11:26] WARNING Could not find comet_ml. To use this feature, ensure that you have comet_ml imports.py:25
installed.
Testing DataLoader 0: 33%|โโโโโโโโโโโโโโโโโโโโโโ | 1/3 [00:00<00:00, 16.92it/s]โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ /Users/sakcay/.pyenv/versions/anomalib_env/bin/anomalib:8 in <module> โ
โ โ
โ 5 from anomalib.cli.cli import main โ
โ 6 if __name__ == '__main__': โ
โ 7 โ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) โ
โ โฑ 8 โ sys.exit(main()) โ
โ 9 โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/cli/cli.py:377 in main โ
โ โ
โ 374 def main() -> None: โ
โ 375 โ """Trainer via Anomalib CLI.""" โ
โ 376 โ configure_logger() โ
โ โฑ 377 โ AnomalibCLI() โ
โ 378 โ
โ 379 โ
โ 380 if __name__ == "__main__": โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/cli/cli.py:65 in __init__ โ
โ โ
โ 62 โ โ run: bool = True, โ
โ 63 โ โ auto_configure_optimizers: bool = True, โ
โ 64 โ ) -> None: โ
โ โฑ 65 โ โ super().__init__( โ
โ 66 โ โ โ AnomalyModule, โ
โ 67 โ โ โ AnomalibDataModule, โ
โ 68 โ โ โ save_config_callback, โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/cli.py:386 in __init__ โ
โ โ
โ 383 โ โ self.instantiate_classes() โ
โ 384 โ โ โ
โ 385 โ โ if self.subcommand is not None: โ
โ โฑ 386 โ โ โ self._run_subcommand(self.subcommand) โ
โ 387 โ โ
โ 388 โ def _setup_parser_kwargs(self, parser_kwargs: Dict[str, Any]) -> Tuple[Dict[str, Any โ
โ 389 โ โ subcommand_names = self.subcommands().keys() โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/cli/cli.py:295 in _run_subcommand โ
โ โ
โ 292 โ โ if self.config["subcommand"] in (*self.subcommands(), "train", "export", "predic โ
โ 293 โ โ โ fn = getattr(self.engine, subcommand) โ
โ 294 โ โ โ fn_kwargs = self._prepare_subcommand_kwargs(subcommand) โ
โ โฑ 295 โ โ โ fn(**fn_kwargs) โ
โ 296 โ โ else: โ
โ 297 โ โ โ self.config_init = self.parser.instantiate_classes(self.config) โ
โ 298 โ โ โ getattr(self, f"{subcommand}")() โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/engine/engine.py:475 in train โ
โ โ
โ 472 โ โ self._setup_trainer(model) โ
โ 473 โ โ self._setup_dataset_task(train_dataloaders, val_dataloaders, test_dataloaders, d โ
โ 474 โ โ self.trainer.fit(model, train_dataloaders, val_dataloaders, datamodule, ckpt_pat โ
โ โฑ 475 โ โ self.trainer.test(model, test_dataloaders, ckpt_path=ckpt_path, datamodule=datam โ
โ 476 โ โ
โ 477 โ def export( โ
โ 478 โ โ self, โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/trainer/trainer.py:754 in test โ
โ โ
โ 751 โ โ self.state.fn = TrainerFn.TESTING โ
โ 752 โ โ self.state.status = TrainerStatus.RUNNING โ
โ 753 โ โ self.testing = True โ
โ โฑ 754 โ โ return call._call_and_handle_interrupt( โ
โ 755 โ โ โ self, self._test_impl, model, dataloaders, ckpt_path, verbose, datamodule โ
โ 756 โ โ ) โ
โ 757 โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/trainer/call.py:44 in _call_and_handle_interrupt โ
โ โ
โ 41 โ try: โ
โ 42 โ โ if trainer.strategy.launcher is not None: โ
โ 43 โ โ โ return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, โ
โ โฑ 44 โ โ return trainer_fn(*args, **kwargs) โ
โ 45 โ โ
โ 46 โ except _TunerExitException: โ
โ 47 โ โ _call_teardown_hook(trainer) โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/trainer/trainer.py:794 in _test_impl โ
โ โ
โ 791 โ โ ckpt_path = self._checkpoint_connector._select_ckpt_path( โ
โ 792 โ โ โ self.state.fn, ckpt_path, model_provided=model_provided, model_connected=sel โ
โ 793 โ โ ) โ
โ โฑ 794 โ โ results = self._run(model, ckpt_path=ckpt_path) โ
โ 795 โ โ # remove the tensors from the test results โ
โ 796 โ โ results = convert_tensors_to_scalars(results) โ
โ 797 โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/trainer/trainer.py:989 in _run โ
โ โ
โ 986 โ โ # ---------------------------- โ
โ 987 โ โ # RUN THE TRAINER โ
โ 988 โ โ # ---------------------------- โ
โ โฑ 989 โ โ results = self._run_stage() โ
โ 990 โ โ โ
โ 991 โ โ # ---------------------------- โ
โ 992 โ โ # POST-Training CLEAN UP โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/trainer/trainer.py:1028 in _run_stage โ
โ โ
โ 1025 โ โ self.lightning_module.zero_grad(**zero_grad_kwargs) โ
โ 1026 โ โ โ
โ 1027 โ โ if self.evaluating: โ
โ โฑ 1028 โ โ โ return self._evaluation_loop.run() โ
โ 1029 โ โ if self.predicting: โ
โ 1030 โ โ โ return self.predict_loop.run() โ
โ 1031 โ โ if self.training: โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/loops/utilities.py:182 in _decorator โ
โ โ
โ 179 โ โ else: โ
โ 180 โ โ โ context_manager = torch.no_grad โ
โ 181 โ โ with context_manager(): โ
โ โฑ 182 โ โ โ return loop_run(self, *args, **kwargs) โ
โ 183 โ โ
โ 184 โ return _decorator โ
โ 185 โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/loops/evaluation_loop.py:134 in run โ
โ โ
โ 131 โ โ โ โ previous_dataloader_idx = dataloader_idx โ
โ 132 โ โ โ โ self.batch_progress.is_last_batch = data_fetcher.done โ
โ 133 โ โ โ โ # run step hooks โ
โ โฑ 134 โ โ โ โ self._evaluation_step(batch, batch_idx, dataloader_idx, dataloader_iter) โ
โ 135 โ โ โ except StopIteration: โ
โ 136 โ โ โ โ # this needs to wrap the `*_step` call too (not just `next`) for `datalo โ
โ 137 โ โ โ โ break โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/loops/evaluation_loop.py:405 in _evaluation_step โ
โ โ
โ 402 โ โ โ ) โ
โ 403 โ โ โ
โ 404 โ โ hook_name = "on_test_batch_end" if trainer.testing else "on_validation_batch_end โ
โ โฑ 405 โ โ call._call_callback_hooks(trainer, hook_name, output, *hook_kwargs.values()) โ
โ 406 โ โ call._call_lightning_module_hook(trainer, hook_name, output, *hook_kwargs.values โ
โ 407 โ โ โ
โ 408 โ โ trainer._logger_connector.on_batch_end() โ
โ โ
โ /Users/sakcay/.pyenv/versions/3.10.13/envs/anomalib_env/lib/python3.10/site-packages/lightning/p โ
โ ytorch/trainer/call.py:208 in _call_callback_hooks โ
โ โ
โ 205 โ โ fn = getattr(callback, hook_name) โ
โ 206 โ โ if callable(fn): โ
โ 207 โ โ โ with trainer.profiler.profile(f"[Callback]{callback.state_key}.{hook_name}") โ
โ โฑ 208 โ โ โ โ fn(trainer, trainer.lightning_module, *args, **kwargs) โ
โ 209 โ โ
โ 210 โ if pl_module: โ
โ 211 โ โ # restore current_fx when nested context โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/callbacks/visualizer/visualizer_image.py:99 in โ
โ on_test_batch_end โ
โ โ
โ 96 โ โ del batch, batch_idx, dataloader_idx # These variables are not used. โ
โ 97 โ โ assert outputs is not None โ
โ 98 โ โ โ
โ โฑ 99 โ โ for i, image in enumerate(self.visualizer.visualize_batch(outputs)): โ
โ 100 โ โ โ if "image_path" in outputs: โ
โ 101 โ โ โ โ filename = Path(outputs["image_path"][i]) โ
โ 102 โ โ โ elif "video_path" in outputs: โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/utils/visualization.py:124 in visualize_batch โ
โ โ
โ 121 โ โ โ โ pred_boxes=batch["pred_boxes"][i].cpu().numpy() if "pred_boxes" in batch โ
โ 122 โ โ โ โ box_labels=batch["box_labels"][i].cpu().numpy() if "box_labels" in batch โ
โ 123 โ โ โ ) โ
โ โฑ 124 โ โ โ yield self.visualize_image(image_result) โ
โ 125 โ โ
โ 126 โ def visualize_image(self, image_result: ImageResult) -> np.ndarray: โ
โ 127 โ โ """Generate the visualization for an image. โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/utils/visualization.py:136 in visualize_image โ
โ โ
โ 133 โ โ โ The full or simple visualization for the image, depending on the specified m โ
โ 134 โ โ """ โ
โ 135 โ โ if self.mode == VisualizationMode.FULL: โ
โ โฑ 136 โ โ โ return self._visualize_full(image_result) โ
โ 137 โ โ if self.mode == VisualizationMode.SIMPLE: โ
โ 138 โ โ โ return self._visualize_simple(image_result) โ
โ 139 โ โ msg = f"Unknown visualization mode: {self.mode}" โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/utils/visualization.py:185 in _visualize_full โ
โ โ
โ 182 โ โ โ โ image_classified = add_normal_label(image_result.image, 1 - image_result โ
โ 183 โ โ โ visualization.add_image(image=image_classified, title="Prediction") โ
โ 184 โ โ โ
โ โฑ 185 โ โ return visualization.generate() โ
โ 186 โ โ
โ 187 โ def _visualize_simple(self, image_result: ImageResult) -> np.ndarray: โ
โ 188 โ โ """Generate a simple visualization for an image. โ
โ โ
โ /Users/sakcay/Projects/anomalib/src/anomalib/utils/visualization.py:296 in generate โ
โ โ
โ 293 โ โ self.figure.canvas.draw() โ
โ 294 โ โ # convert canvas to numpy array to prepare for visualization with opencv โ
โ 295 โ โ img = np.frombuffer(self.figure.canvas.tostring_rgb(), dtype=np.uint8) โ
โ โฑ 296 โ โ img = img.reshape(self.figure.canvas.get_width_height()[::-1] + (3,)) โ
โ 297 โ โ plt.close(self.figure) โ
โ 298 โ โ return img โ
โ 299 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
ValueError: cannot reshape array of size 15000000 into shape (500,2500,3)
Testing DataLoader 0: 33%|โโโโ | 1/3 [00:16<00:33, 0.06it/s]
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Describe the bug
When training a default model and dataset, visualization stage does not work with mps accelerator
Dataset
MVTec
Model
PADiM
Steps to reproduce the behavior
On a Macbook M* machine, run the following CLI command:
OS information
OS information:
Expected behavior
Screenshots
No response
Pip/GitHub
GitHub
What version/branch did you use?
v1.0.0
Configuration YAML
Logs
Code of Conduct