rshrott commited on
Commit
0efec3e
1 Parent(s): d9a45b3

Update renovation.py

Browse files
Files changed (1) hide show
  1. renovation.py +3 -1
renovation.py CHANGED
@@ -84,10 +84,12 @@ class Renovations(datasets.GeneratorBasedBuilder):
84
  def _generate_examples(self, data_files, split):
85
  # Separate data by class
86
  data_by_class = {label: [] for label in _NAMES}
 
87
  for label, path in data_files.items():
88
- files = [os.path.join(path, f) for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
89
  data_by_class[label].extend((file, label) for file in files)
90
 
 
91
  # Shuffle and split data for each class
92
  random.seed(43) # ensure reproducibility
93
  train_data, test_data, val_data = [], [], []
 
84
  def _generate_examples(self, data_files, split):
85
  # Separate data by class
86
  data_by_class = {label: [] for label in _NAMES}
87
+ allowed_extensions = {'.jpeg', '.jpg', '.PNG'}
88
  for label, path in data_files.items():
89
+ files = [os.path.join(path, f) for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and os.path.splitext(f)[1] in allowed_extensions]
90
  data_by_class[label].extend((file, label) for file in files)
91
 
92
+
93
  # Shuffle and split data for each class
94
  random.seed(43) # ensure reproducibility
95
  train_data, test_data, val_data = [], [], []