Add verbose parameter to index_directory
@@ -493,6 +493,7 @@ def index_directory(
shuffle=True,
seed=None,
follow_links=False,
+ verbose=1,
):
"""Make list of all files in the subdirs of `directory`, with their labels.
@@ -514,6 +515,8 @@ def index_directory(
If set to False, sorts the data in alphanumeric order.
seed: Optional random seed for shuffling.
follow_links: Whether to visits subdirectories pointed to by symlinks.
+ verbose: 0 or 1. Verbosity mode.
+ 0 = silent, 1 = print how many files and classes were found.
Returns:
tuple (file_paths, labels, class_names).
@@ -577,6 +580,7 @@ def index_directory(
labels[i : i + len(partial_labels)] = partial_labels
i += len(partial_labels)
+ if verbose:
if labels is None:
print(f"Found {len(filenames)} files.")
else:
