-
Notifications
You must be signed in to change notification settings - Fork 709
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
Add support for receiving folder dataset paths as a list #1265
Add support for receiving folder dataset paths as a list #1265
Conversation
Hi @djdameln, I want to write a unit test (and update documentation) for this, but I don't know what form it should take, can you give me some advice? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @harimkang. I only have a single comment regarding the type of the multiple paths.
For the datamodule tests you could have a look at this file: https://github.com/openvinotoolkit/anomalib/blob/main/tests/pre_merge/datasets/test_datamodule.py, where we test the full functionality of the different datamodules using several fixtures. You could use the fixtures to write a test where you instantiate the Folder datamodule using a list of paths. The test would look something like this: def test_folder_list_inputs(make_data_module):
data_module = make_data_module("folder", abnormal_dir=["broken_large", "broken_small"])
assert data_module This would test if we can create a Folder datamodule using multiple abnormal directories instead of just one. Admittedly, creating the entire datamodule might add some unnecessary complexity, because we actually only need to test the So, alternatively you could add a file called For the documentation, you could add a short paragraph to this guide: https://github.com/openvinotoolkit/anomalib/blob/main/docs/source/how_to_guides/train_custom_data.rst, explaining that the |
src/anomalib/data/folder.py
Outdated
Returns: | ||
ListConfig: The result of path replaced by ListConfig. | ||
""" | ||
if isinstance(path, ListConfig): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should allow other data types here as well, since only supporting ListConfig
is not very API-friendly. The following should probably work:
>>> from anomalib.data import Folder
>>> data_module = Folder(
... root="datasets/hazelnut_toy/",
... normal_dir="good",
... abnormal_dir=["colour", "crack"],
... image_size=256,
... )
>>> data_module.setup()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the comment. I have fixed this. (to Sequence)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @harimkang! Much better! Only a single comment left from my side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @harimkang!
Description
Modified the Folder Dataset type to use the ListConfig type to accept paths as a List.
Add a ListConfig to an existing type with an input of paths it can accept.
PR for [Task]: Support list config for normal_dir and normal_test_dir of folder format #1195
Changes
Checklist