Skip to content

Commit

Permalink
Check if mask_dir is available for segmentation task in Folder da…
Browse files Browse the repository at this point in the history
…ta (openvinotoolkit#1277)

* Fix metadata path

* Ignore hidden directories in folder dataset

* Add check for mask_dir for segmentation tasks in Folder dataset

* Check the test split mode when no mask dir is provided
  • Loading branch information
samet-akcay committed Aug 17, 2023
1 parent ea41601 commit cdedf05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/anomalib/data/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,13 @@ def __init__(
seed=seed,
)

self.normal_split_ratio = normal_split_ratio
if task == TaskType.SEGMENTATION and test_split_mode == TestSplitMode.FROM_DIR and mask_dir is None:
raise ValueError(
f"Segmentation task requires mask directory if test_split_mode is {test_split_mode}. "
f"You could set test_split_mode to {TestSplitMode.NONE} or provide a mask directory."
)

self.normal_split_ratio = normal_split_ratio
transform_train = get_transforms(
config=transform_config_train,
image_size=image_size,
Expand Down

0 comments on commit cdedf05

Please sign in to comment.