rshrott commited on
Commit
2f69b3c
1 Parent(s): e6ae11c

Update renovation.py

Browse files
Files changed (1) hide show
  1. renovation.py +15 -11
renovation.py CHANGED
@@ -31,11 +31,11 @@ _URLS = {
31
  "Poor": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Poor.zip",
32
  "Fair": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Fair.zip",
33
  "Good": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Good.zip",
34
- "Excellent": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Excellent.zip",
35
- "Exceptional": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Exceptional.zip"
36
  }
37
 
38
- _NAMES = ["Not Applicable", "Very Poor", "Poor", "Fair", "Good", "Excellent", "Exceptional"]
39
  class Renovations(datasets.GeneratorBasedBuilder):
40
  """Renovations house images dataset."""
41
 
@@ -86,19 +86,22 @@ class Renovations(datasets.GeneratorBasedBuilder):
86
  for label, path in data_files.items():
87
  files = glob.glob(path + '/*.jpeg', recursive=True)
88
  all_files_and_labels.extend((file, label) for file in files)
89
-
90
  random.seed(43) # ensure reproducibility
91
  random.shuffle(all_files_and_labels)
92
-
93
  num_files = len(all_files_and_labels)
94
- train_data = all_files_and_labels[:int(num_files*0.9)]
95
- val_test_data = all_files_and_labels[int(num_files*0.9):] # This will be used for both val and test
96
-
 
97
  if split == "train":
98
  data_to_use = train_data
99
- else: # "val" or "test" split
100
- data_to_use = val_test_data
101
-
 
 
102
  for idx, (file, label) in enumerate(data_to_use):
103
  yield idx, {
104
  "image_file_path": file,
@@ -107,3 +110,4 @@ class Renovations(datasets.GeneratorBasedBuilder):
107
  }
108
 
109
 
 
 
31
  "Poor": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Poor.zip",
32
  "Fair": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Fair.zip",
33
  "Good": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Good.zip",
34
+ "Great": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Great.zip",
35
+ "Excellent": "https://huggingface.co/datasets/rshrott/renovation/resolve/main/Excellent.zip"
36
  }
37
 
38
+ _NAMES = ["Not Applicable", "Very Poor", "Poor", "Fair", "Good", "Great", "Excellent"]
39
  class Renovations(datasets.GeneratorBasedBuilder):
40
  """Renovations house images dataset."""
41
 
 
86
  for label, path in data_files.items():
87
  files = glob.glob(path + '/*.jpeg', recursive=True)
88
  all_files_and_labels.extend((file, label) for file in files)
89
+
90
  random.seed(43) # ensure reproducibility
91
  random.shuffle(all_files_and_labels)
92
+
93
  num_files = len(all_files_and_labels)
94
+ train_data = all_files_and_labels[:int(num_files * 0.8)]
95
+ test_data = all_files_and_labels[int(num_files * 0.8):int(num_files * 0.9)]
96
+ val_data = all_files_and_labels[int(num_files * 0.9):]
97
+
98
  if split == "train":
99
  data_to_use = train_data
100
+ elif split == "test":
101
+ data_to_use = test_data
102
+ else: # "val" split
103
+ data_to_use = val_data
104
+
105
  for idx, (file, label) in enumerate(data_to_use):
106
  yield idx, {
107
  "image_file_path": file,
 
110
  }
111
 
112
 
113
+