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

[Datamodules] Update deprecation messages #764

Merged
merged 2 commits into from
Dec 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions anomalib/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ def update_datasets_config(config: Union[DictConfig, ListConfig]) -> Union[DictC
if "create_validation_set" in config.dataset.keys():
warn(
DeprecationWarning(
"The 'create_validation_set' parameter is deprecated and will be removed in v0.4.0. Please use "
"'validation_split_mode' instead."
"The 'create_validation_set' parameter is deprecated and will be removed in a future release. Please "
"use 'validation_split_mode' instead."
)
)
config.dataset.val_split_mode = "from_test" if config.dataset.create_validation_set else "same_as_test"

if "test_batch_size" in config.dataset.keys():
warn(
DeprecationWarning(
"The 'test_batch_size' parameter is deprecated and will be removed in v0.4.0. Please use "
"The 'test_batch_size' parameter is deprecated and will be removed in a future release. Please use "
"'eval_batch_size' instead."
)
)
Expand All @@ -142,8 +142,8 @@ def update_datasets_config(config: Union[DictConfig, ListConfig]) -> Union[DictC
if "transform_config" in config.dataset.keys() and "val" in config.dataset.transform_config.keys():
warn(
DeprecationWarning(
"The 'transform_config.val' parameter is deprecated and will be removed in v0.4.0. Please use "
"'transform_config.eval' instead."
"The 'transform_config.val' parameter is deprecated and will be removed in a future release. Please "
"use 'transform_config.eval' instead."
)
)
config.dataset.transform_config.eval = config.dataset.transform_config.val
Expand All @@ -152,14 +152,14 @@ def update_datasets_config(config: Union[DictConfig, ListConfig]) -> Union[DictC

if "clip_length_in_frames" in config.dataset.keys() and config.dataset.clip_length_in_frames > 1:
warn(
"Anomalib's models and visualizer are currently not compatible with video datasets with a clip length > 1.\
Custom changes to these modules will be needed to prevent errors and/or unpredictable behaviour."
"Anomalib's models and visualizer are currently not compatible with video datasets with a clip length > 1. "
samet-akcay marked this conversation as resolved.
Show resolved Hide resolved
"Custom changes to these modules will be needed to prevent errors and/or unpredictable behaviour."
)

if config.dataset.format == "folder" and "split_ratio" in config.dataset.keys():
warn(
DeprecationWarning(
"The 'split_ratio' parameter is deprecated and will be removed in v0.4.0. Please use "
"The 'split_ratio' parameter is deprecated and will be removed in a future release. Please use "
"'normal_split_ratio' instead."
)
)
Expand Down Expand Up @@ -241,15 +241,21 @@ def get_configurable_parameters(
if "metrics" in config.keys():
# NOTE: Deprecate this after v0.4.0.
if "adaptive" in config.metrics.threshold.keys():
warn("adaptive will be deprecated in favor of method in config.metrics.threshold in v0.4.0.")
warn("adaptive will be deprecated in favor of method in config.metrics.threshold in a future release")
djdameln marked this conversation as resolved.
Show resolved Hide resolved
config.metrics.threshold.method = "adaptive" if config.metrics.threshold.adaptive else "manual"
if "image_default" in config.metrics.threshold.keys():
warn("image_default will be deprecated in favor of manual_image in config.metrics.threshold in v0.4.0.")
warn(
"image_default will be deprecated in favor of manual_image in config.metrics.threshold in a future "
djdameln marked this conversation as resolved.
Show resolved Hide resolved
"release."
)
config.metrics.threshold.manual_image = (
None if config.metrics.threshold.adaptive else config.metrics.threshold.image_default
)
if "pixel_default" in config.metrics.threshold.keys():
warn("pixel_default will be deprecated in favor of manual_pixel in config.metrics.threshold in v0.4.0.")
warn(
"pixel_default will be deprecated in favor of manual_pixel in config.metrics.threshold in a future "
djdameln marked this conversation as resolved.
Show resolved Hide resolved
"release."
)
config.metrics.threshold.manual_pixel = (
None if config.metrics.threshold.adaptive else config.metrics.threshold.pixel_default
)
Expand Down