Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padim object has not attribute 'results' #184

Closed
mathephysicist opened this issue Mar 31, 2022 · 2 comments · Fixed by #198
Closed

Padim object has not attribute 'results' #184

mathephysicist opened this issue Mar 31, 2022 · 2 comments · Fixed by #198
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@mathephysicist
Copy link

Describe the bug
If you modify padim/config.yaml save_to_csv to True you get an error

File "tools/train.py", line 66, in
train()
File "tools/train.py", line 62, in train
trainer.test(model=model, datamodule=datamodule)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 911, in test
return self._call_and_handle_interrupt(self._test_impl, model, dataloaders, ckpt_path, verbose, datamodule)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 685, in _call_and_handle_interrupt
return trainer_fn(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 954, in _test_impl
results = self._run(model, ckpt_path=self.tested_ckpt_path)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1199, in _run
self._dispatch()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1275, in _dispatch
self.training_type_plugin.start_evaluating(self)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 206, in start_evaluating
self._results = trainer.run_stage()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1286, in run_stage
return self._run_evaluate()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1334, in _run_evaluate
eval_loop_results = self._evaluation_loop.run()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/loops/base.py", line 151, in run
output = self.on_run_end()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 134, in on_run_end
self._on_evaluation_epoch_end()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 241, in _on_evaluation_epoch_end
self.trainer.call_hook(hook_name)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1495, in call_hook
callback_fx(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/callback_hook.py", line 113, in on_test_epoch_end
callback.on_test_epoch_end(self, self.lightning_module)
File "/anomalib/anomalib/utils/callbacks/save_to_csv.py", line 42, in on_test_epoch_end
results = pl_module.results
File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 947, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'PadimLightning' object has no attribute 'results'

Expected behavior
I believe I should get a csv with the F1/AUROC scores?

Additional context
I built my environment following the steps provided.

@samet-akcay
Copy link
Contributor

@mathephysicist, it's probably because save_to_csv callback has not been maintained for a while. PadimLightning model had results attributes previously, but was then replaced. The callback needs to be updated accordingly to support the new design.

@samet-akcay samet-akcay added Bug Something isn't working Callbacks labels Apr 1, 2022
@samet-akcay samet-akcay added this to the Backlog milestone Apr 4, 2022
@ashwinvaidya17
Copy link
Collaborator

Similar to #16

@samet-akcay samet-akcay self-assigned this Apr 5, 2022
@samet-akcay samet-akcay modified the milestones: Backlog, v0.2.7 Apr 5, 2022
@samet-akcay samet-akcay moved this to In Progress in Anomalib Apr 5, 2022
@samet-akcay samet-akcay moved this from In Progress to 🚧 In Progress in Anomalib Apr 5, 2022
@samet-akcay samet-akcay moved this from 🚧 In Progress to 🚀 PR Created in Anomalib Apr 5, 2022
Repository owner moved this from 🚀 PR Created to Done in Anomalib Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants