Update renovation.py
Browse files- 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 |
-
"
|
35 |
-
"
|
36 |
}
|
37 |
|
38 |
-
_NAMES = ["Not Applicable", "Very Poor", "Poor", "Fair", "Good", "
|
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.
|
95 |
-
|
96 |
-
|
|
|
97 |
if split == "train":
|
98 |
data_to_use = train_data
|
99 |
-
|
100 |
-
data_to_use =
|
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 |
+
|