rshrott commited on
Commit
7304059
1 Parent(s): 80b9a7d

Update renovation.py

Browse files
Files changed (1) hide show
  1. renovation.py +9 -8
renovation.py CHANGED
@@ -75,7 +75,6 @@ class Renovations(datasets.GeneratorBasedBuilder):
75
  },
76
  ),
77
  ]
78
-
79
  def _generate_examples(self, data_files, split):
80
  all_files_and_labels = []
81
  for label, path in data_files.items():
@@ -85,20 +84,22 @@ class Renovations(datasets.GeneratorBasedBuilder):
85
  random.shuffle(all_files_and_labels)
86
 
87
  num_files = len(all_files_and_labels)
 
 
 
88
  if split == "train":
89
- all_files_and_labels = all_files_and_labels[:int(num_files*0.9)]
90
- elif split == "val":
91
- all_files_and_labels = all_files_and_labels[int(num_files*0.9):]
92
- else: # "test" split
93
- all_files_and_labels = all_files_and_labels[int(num_files*0.9):]
94
 
95
- for idx, (file, label) in enumerate(all_files_and_labels):
96
  yield idx, {
97
  "image_file_path": file,
98
  "image": file,
99
  "labels": label,
100
  }
101
 
102
-
 
103
 
104
 
 
75
  },
76
  ),
77
  ]
 
78
  def _generate_examples(self, data_files, split):
79
  all_files_and_labels = []
80
  for label, path in data_files.items():
 
84
  random.shuffle(all_files_and_labels)
85
 
86
  num_files = len(all_files_and_labels)
87
+ train_data = all_files_and_labels[:int(num_files*0.9)]
88
+ val_test_data = all_files_and_labels[int(num_files*0.9):] # This will be used for both val and test
89
+
90
  if split == "train":
91
+ data_to_use = train_data
92
+ else: # "val" or "test" split
93
+ data_to_use = val_test_data
 
 
94
 
95
+ for idx, (file, label) in enumerate(data_to_use):
96
  yield idx, {
97
  "image_file_path": file,
98
  "image": file,
99
  "labels": label,
100
  }
101
 
102
+
103
+
104
 
105