From dfc524cd1a20a30f3d55115883715a07afc7141c Mon Sep 17 00:00:00 2001 From: gmberton Date: Tue, 3 Jan 2023 20:34:44 +0100 Subject: [PATCH] Better handling of wrong (non existing) path --- datasets/train_dataset.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/datasets/train_dataset.py b/datasets/train_dataset.py index ee09158..95e082e 100644 --- a/datasets/train_dataset.py +++ b/datasets/train_dataset.py @@ -104,6 +104,9 @@ def __len__(self): def initialize(dataset_folder, M, N, alpha, L, min_images_per_class, filename): logging.debug(f"Searching training images in {dataset_folder}") + if not os.path.exists(dataset_folder): + raise FileNotFoundError(f"Folder {dataset_folder} does not exist") + images_paths = sorted(glob(f"{dataset_folder}/**/*.jpg", recursive=True)) logging.debug(f"Found {len(images_paths)} images")