Skip to content

Commit cdedf05

Browse files
authored
Check if mask_dir is available for segmentation task in Folder data (#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
1 parent ea41601 commit cdedf05

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/anomalib/data/folder.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,13 @@ def __init__(
281281
seed=seed,
282282
)
283283

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

290+
self.normal_split_ratio = normal_split_ratio
286291
transform_train = get_transforms(
287292
config=transform_config_train,
288293
image_size=image_size,

0 commit comments

Comments
 (0)