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

model training with custom dataset #481

Closed
ZeynepRuveyda opened this issue Aug 3, 2022 · 10 comments · Fixed by #480
Closed

model training with custom dataset #481

ZeynepRuveyda opened this issue Aug 3, 2022 · 10 comments · Fixed by #480

Comments

@ZeynepRuveyda
Copy link

Hello,
When I am starting the training model with custom dataset , I got this problem. I face this issue first time. Can you help me?

thanks,

(env) (base) zeynep_automi_ai@anomalib:~/zeynep/anomalib$ python tools/train.py --config anomalib/models/padim/config_orange.yaml
/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/pytorch_lightning/utilities/cli.py:95: LightningDeprecationWarning: LightningCLI's registries were deprecated in v1.7 and will be removed in v1.9. Now any imported subclass is automatically available by name in LightningCLI without any need to explicitly register it.
rank_zero_deprecation(_deprecate_registry_message)
/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/pytorch_lightning/utilities/cli.py:95: LightningDeprecationWarning: LightningCLI's registries were deprecated in v1.7 and will be removed in v1.9. Now any imported subclass is automatically available by name in LightningCLI without any need to explicitly register it.
rank_zero_deprecation(_deprecate_registry_message)
2022-08-03 12:40:42,241 - pytorch_lightning.utilities.seed - INFO - Global seed set to 42
2022-08-03 12:40:42,242 - anomalib.data - INFO - Loading the datamodule
2022-08-03 12:40:42,244 - anomalib.models - INFO - Loading the model.
2022-08-03 12:40:42,389 - torch.distributed.nn.jit.instantiator - INFO - Created a temporary directory at /tmp/tmpm7a9yqli
2022-08-03 12:40:42,390 - torch.distributed.nn.jit.instantiator - INFO - Writing /tmp/tmpm7a9yqli/_remote_module_non_sriptable.py
2022-08-03 12:40:42,400 - anomalib.models.components.base.anomaly_module - INFO - Initializing PadimLightning model.
/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/torchmetrics/utilities/prints.py:36: UserWarning: Torchmetrics v0.9 introduced a new argument class property called full_state_update that has
not been set for this class (AdaptiveThreshold). The property determines if update by
default needs access to the full metric state. If this is not the case, significant speedups can be
achieved and we recommend setting this to False.
We provide an checking function
from torchmetrics.utilities import check_forward_no_full_state
that can be used to check if the full_state_update=True (old and potential slower behaviour,
default for now) or if full_state_update=False can be used safely.

warnings.warn(*args, **kwargs)
/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/torchmetrics/utilities/prints.py:36: UserWarning: Metric PrecisionRecallCurve will save all targets and predictions in buffer. For large datasets this may lead to large memory footprint.
warnings.warn(*args, **kwargs)
/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/torchmetrics/utilities/prints.py:36: UserWarning: Torchmetrics v0.9 introduced a new argument class property called full_state_update that has
not been set for this class (AnomalyScoreDistribution). The property determines if update by
default needs access to the full metric state. If this is not the case, significant speedups can be
achieved and we recommend setting this to False.
We provide an checking function
from torchmetrics.utilities import check_forward_no_full_state
that can be used to check if the full_state_update=True (old and potential slower behaviour,
default for now) or if full_state_update=False can be used safely.

warnings.warn(*args, **kwargs)
/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/torchmetrics/utilities/prints.py:36: UserWarning: Torchmetrics v0.9 introduced a new argument class property called full_state_update that has
not been set for this class (MinMax). The property determines if update by
default needs access to the full metric state. If this is not the case, significant speedups can be
achieved and we recommend setting this to False.
We provide an checking function
from torchmetrics.utilities import check_forward_no_full_state
that can be used to check if the full_state_update=True (old and potential slower behaviour,
default for now) or if full_state_update=False can be used safely.

warnings.warn(*args, **kwargs)
2022-08-03 12:40:42,931 - anomalib.utils.loggers - INFO - Loading the experiment logger(s)
2022-08-03 12:40:42,932 - anomalib.utils.callbacks - INFO - Loading the callbacks
/home/zeynep_automi_ai/zeynep/anomalib/anomalib/utils/callbacks/init.py:162: UserWarning: log_images_to parameter is deprecated and will be removed in version 0.3.4. Please use the visualization.log_images and visualization.save_images parameters instead.
warnings.warn(
Traceback (most recent call last):
File "/home/zeynep_automi_ai/zeynep/anomalib/tools/train.py", line 82, in
train()
File "/home/zeynep_automi_ai/zeynep/anomalib/tools/train.py", line 67, in train
callbacks = get_callbacks(config)
File "/home/zeynep_automi_ai/zeynep/anomalib/anomalib/utils/callbacks/init.py", line 112, in get_callbacks
add_visualizer_callback(callbacks, config)
File "/home/zeynep_automi_ai/zeynep/anomalib/anomalib/utils/callbacks/init.py", line 168, in add_visualizer_callback
if "local" in config.project.log_images_to:
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 357, in getattr
self._format_and_raise(
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/base.py", line 231, in _format_and_raise
format_and_raise(
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/_utils.py", line 873, in format_and_raise
_raise(ex, cause)
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/_utils.py", line 771, in _raise
raise ex.with_traceback(sys.exc_info()[2]) # set env var OC_CAUSE=1 for full trace
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 353, in getattr
return self._get_impl(
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 444, in _get_impl
node = self._get_child(
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/basecontainer.py", line 73, in _get_child
child = self._get_node(
File "/home/zeynep_automi_ai/zeynep/env/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 482, in _get_node
raise ConfigKeyError(f"Missing key {key!s}")
omegaconf.errors.ConfigAttributeError: Missing key log_images_to
full_key: project.log_images_to
object_type=dict

@samet-akcay
Copy link
Contributor

@ZeynepRuveyda, looks like PyTorch Lightning released 1.7, which introduces some breaking changes. In your requirements/base.txt file, you might want to limit the version such as this pytorch-lightning>=1.6.0,<1.7.0.

@ashwinvaidya17 is currently working on PR #480 to address this.

@samet-akcay samet-akcay linked a pull request Aug 3, 2022 that will close this issue
12 tasks
@ZeynepRuveyda
Copy link
Author

I changed pytorch-lightning>=1.6.0,<1.7.0 in the base.txt but did not work.It shows same error.

@samet-akcay
Copy link
Contributor

Did you reinstall anomalib ? @ashwinvaidya17 any thoughts?

@ZeynepRuveyda
Copy link
Author

yess I reinstall it.

@ZeynepRuveyda
Copy link
Author

But I am still using Anomalib < v.0.4.0 version commands.

@ZeynepRuveyda
Copy link
Author

Is there any changes for omegaconf too?

@ashwinvaidya17
Copy link
Collaborator

@ZeynepRuveyda can you tell which version of anomalib are you using?

@ZeynepRuveyda
Copy link
Author

I didnt mention specific version but I am familiar command lines with Anomalib < v.0.4.0 version

@ashwinvaidya17
Copy link
Collaborator

I think the issue you are facing is because the configuration for logging images has changed in this PR #390. Since you are using a custom configuration, you will have to update it to something similar

visualization:
  show_images: False # show images on the screen
  save_images: True # save images to the file system
  log_images: True # log images to the available loggers (if any)
  image_save_path: null # path to which images will be saved
  mode: full # options: ["full", "simple"]

@ZeynepRuveyda
Copy link
Author

thanks @ashwinvaidya17 and @samet-akcay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants