Skip to content

Commit

Permalink
Reflect the changes in openvinotoolkit#1562 into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
samet-akcay committed Jan 8, 2024
1 parent 03481d9 commit b8bf8d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/anomalib/data/utils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@ def _prepare_files_labels(
if isinstance(extensions, str):
extensions = (extensions,)

if not all(extension.startswith(".") for extension in extensions):
msg = f"All extensions {extensions} must start with the dot"
raise RuntimeError(msg)

filenames = [
f
for f in path.glob("**/*")
if f.suffix in extensions and not f.is_dir() and not any(part.startswith(".") for part in f.parts)
]
if not filenames:
msg = f"Found 0 {path_type} images in {path}"
msg = f"Found 0 {path_type} images in {path} with extensions {extensions}"
raise RuntimeError(msg)

labels = [path_type] * len(filenames)
Expand Down

0 comments on commit b8bf8d7

Please sign in to comment.