Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore hidden folders for image_dataset_from_directory #18177

Merged
merged 8 commits into from
Jun 30, 2023
7 changes: 4 additions & 3 deletions keras/utils/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,10 @@ def index_directory(
subdirs = []
for subdir in sorted(tf.io.gfile.listdir(directory)):
if tf.io.gfile.isdir(tf.io.gfile.join(directory, subdir)):
if subdir.endswith("/"):
subdir = subdir[:-1]
subdirs.append(subdir)
if not subdir.startswith("."):
if subdir.endswith("/"):
subdir = subdir[:-1]
subdirs.append(subdir)
if not class_names:
class_names = subdirs
else:
Expand Down