An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
With the update of anomalib to V1, the way to create callbacks changed. Now you can pass some callbacks in the config.yaml file, with the desired init_args. Example below:
So your models will be logged into "weights/lightning". However, if you see engine.py line 421:
# Add ModelCheckpoint if it is not in the callbacks list.
has_checkpoint_callback = any(isinstance(c, ModelCheckpoint) for c in self._cache.args["callbacks"])
if has_checkpoint_callback is False:
_callbacks.append(
ModelCheckpoint(
dirpath=self._cache.args["default_root_dir"] / "weights" / "lightning",
filename="model",
auto_insert_metric_name=False,
),
)
the default ModelCheckpoint callback uses self._cache.args["default_root_dir"] which in engine.py _setup_workspace() method (line 315) was updated. So the default callbacks will log into this self._cache.args["default_root_dir"] but the custom callbacks will not. And I think the correct would be that all stuff related with the same run to be logged within the same dafault_root_dir.
Dataset
N/A
Model
N/A
Steps to reproduce the behavior
Train a model with anomalib last code, providing a custom callback in your config.yaml, setting the dirpath init_arg to whatever.
You will see some things of your run are logged in one folder locally while the callback is logged in another one (the specified en dirpath)
OS information
OS information:
OS: Windows 10 Pro
Python version: 3.10.14
Anomalib version: 1.1.0
PyTorch version: 2.2.+cu121
CUDA/cuDNN version: 12.5/8.9.7.29
GPU models and configuration: 1x GeForce RTX 3090
Expected behavior
That all custom callbacks to be logged in the default_root_dir path (plus some aditional path provided by the user).
Describe the bug
With the update of
anomalib
toV1
, the way to create callbacks changed. Now you can pass some callbacks in theconfig.yaml
file, with the desiredinit_args
. Example below:So your models will be logged into "weights/lightning". However, if you see
engine.py line 421
:the default
ModelCheckpoint
callback usesself._cache.args["default_root_dir"]
which inengine.py _setup_workspace()
method (line 315
) was updated. So the default callbacks will log into thisself._cache.args["default_root_dir"]
but the custom callbacks will not. And I think the correct would be that all stuff related with the same run to be logged within the same dafault_root_dir.Dataset
N/A
Model
N/A
Steps to reproduce the behavior
config.yaml
, setting thedirpath
init_arg to whatever.dirpath
)OS information
OS information:
Expected behavior
That all custom callbacks to be logged in the
default_root_dir
path (plus some aditional path provided by the user).Screenshots
No response
Pip/GitHub
pip
What version/branch did you use?
main
Configuration YAML
Logs
Code of Conduct