Ignore hidden folders for image_dataset_from_directory
diff --git a/keras/utils/dataset_utils.py b/keras/utils/dataset_utils.py
index 35d234d6255..487a684454f 100644
--- a/keras/utils/dataset_utils.py
+++ b/keras/utils/dataset_utils.py
@@ -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:

Ignore hidden folders for image_dataset_from_directory like .git .ipynb etc.
Fixes: https://github.com/keras-team/tf-keras/issues/187