Skip to content

Commit

Permalink
Better handling of wrong (non existing) path
Browse files Browse the repository at this point in the history
  • Loading branch information
gmberton committed Jan 3, 2023
1 parent eab6e11 commit dfc524c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions datasets/train_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit dfc524c

Please sign in to comment.