An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
Trying out the new API (great job everybody!), I noticed that, when creating the datamodule with custom data, using an absolute path as the root leads to the testing results being saved in new folders in the results directory.
Dataset
Folder
Model
PatchCore
Steps to reproduce the behavior
# Import the datamodule
from anomalib.data import Folder
# Create the datamodule
datamodule = Folder(
name="Custom_Dataset_test",
root="/home/deeplearning/Pictures/anomalib/custom_dataset",
normal_dir="train/good",
abnormal_dir="test/bad",
normal_test_dir="test/good",
task="classification",
image_size=(256, 256),
)
# Setup the datamodule
datamodule.setup()
# Import the required modules
from anomalib.data import MVTec
from anomalib.models import Patchcore
from anomalib.engine import Engine
# Initialize the datamodule, model and engine
model = Patchcore()
engine = Engine()
# Train the model
engine.fit(datamodule=datamodule, model=model)
engine.test(datamodule=datamodule, model=model)
OS information
OS information:
OS: Ubuntu 20.04
Python version: 3.10.0
Anomalib version: v1.0.0.dev0
PyTorch version: 2.2.0.post0
GPU models and configuration: GeForce RTX 4090
Any other relevant information: I'm using a custom dataset, see above.
Expected behavior
I expected it to save it to:
path/to/my/results/patchcore/name/run/images/good
and
path/to/my/results/patchcore/name/run/images/bad
The above would be the behavior for previous anomalib versions using CLI.
However, this is what I got now:
path/to/my/results/Patchcore/Custom_Dataset_test/latest/images/deeplearning/Pictures/anomalib/custom_dataset/test/bad
and
path/to/my/results/Patchcore/Custom_Dataset_test/latest/images/deeplearning/Pictures/anomalib/custom_dataset/test/good.
So the whole root path gets appended, leading to the testing results path being:
path/to/my/results/Patchcore/name/latest/images/ROOT_PATH/ABNORMAL_DIR
and
path/to/my/results/Patchcore/name/latest/images/ROOT_PATH/NORMAL_TEST_DIR
while it should be
path/to/my/results/Patchcore/name/latest/images/ABNORMAL_DIR
and
path/to/my/results/Patchcore/name/latest/images/NORMAL_TEST_DIR
I hope I have illustrated the problem sufficiently. One solution, of course, would be to save the dataset closer to my notebook, where I use the testing functionality but I would like to refrain from that.
Maybe a save_dir parameter help here, or maybe I am overlooking something.
Anyhow, I hope you can take a look into it. I thank you in advance for your help and let me know if you need further information.
Screenshots
No response
Pip/GitHub
GitHub
What version/branch did you use?
No response
Configuration YAML
-
Logs
-
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Describe the bug
Hello there,
Trying out the new API (great job everybody!), I noticed that, when creating the datamodule with custom data, using an absolute path as the root leads to the testing results being saved in new folders in the results directory.
Dataset
Folder
Model
PatchCore
Steps to reproduce the behavior
OS information
OS information:
Expected behavior
I expected it to save it to:
path/to/my/results/patchcore/name/run/images/good
andpath/to/my/results/patchcore/name/run/images/bad
The above would be the behavior for previous anomalib versions using CLI.
However, this is what I got now:
path/to/my/results/Patchcore/Custom_Dataset_test/latest/images/deeplearning/Pictures/anomalib/custom_dataset/test/bad
andpath/to/my/results/Patchcore/Custom_Dataset_test/latest/images/deeplearning/Pictures/anomalib/custom_dataset/test/good
.So the whole root path gets appended, leading to the testing results path being:
path/to/my/results/Patchcore/name/latest/images/ROOT_PATH/ABNORMAL_DIR
andpath/to/my/results/Patchcore/name/latest/images/ROOT_PATH/NORMAL_TEST_DIR
while it should be
path/to/my/results/Patchcore/name/latest/images/ABNORMAL_DIR
andpath/to/my/results/Patchcore/name/latest/images/NORMAL_TEST_DIR
I hope I have illustrated the problem sufficiently. One solution, of course, would be to save the dataset closer to my notebook, where I use the testing functionality but I would like to refrain from that.
Maybe a
save_dir
parameter help here, or maybe I am overlooking something.Anyhow, I hope you can take a look into it. I thank you in advance for your help and let me know if you need further information.
Screenshots
No response
Pip/GitHub
GitHub
What version/branch did you use?
No response
Configuration YAML
Logs
Code of Conduct