Datasets:
Update CC6204-Hackaton-Cub-Dataset.py
Browse files
CC6204-Hackaton-Cub-Dataset.py
CHANGED
@@ -112,18 +112,17 @@ class CubDataset(datasets.GeneratorBasedBuilder):
|
|
112 |
|
113 |
for img, text in zip(img_path_files, text_path_files):
|
114 |
#for img in img_path_files:
|
115 |
-
print(img)
|
116 |
-
print(os.path.basename(
|
117 |
-
print(text)
|
118 |
-
print(os.path.basename(text))
|
119 |
#text = text_path_files[text_path_files.index(os.path.basename(img).replace("jpg", "txt"))]
|
120 |
img_idx = _IMGNAME2ID[os.path.basename(img)]
|
121 |
-
if
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
127 |
|
128 |
return [
|
129 |
datasets.SplitGenerator(
|
|
|
112 |
|
113 |
for img, text in zip(img_path_files, text_path_files):
|
114 |
#for img in img_path_files:
|
115 |
+
#print(os.path.basename(img))
|
116 |
+
#print(os.path.basename(text))
|
|
|
|
|
117 |
#text = text_path_files[text_path_files.index(os.path.basename(img).replace("jpg", "txt"))]
|
118 |
img_idx = _IMGNAME2ID[os.path.basename(img)]
|
119 |
+
if os.path.basename(img).replace(".jpg", "") == os.path.basename(text).replace(".txt", ""):
|
120 |
+
if img_idx in _TRAIN_IDX_SET:
|
121 |
+
train_files.append((img, text))
|
122 |
+
train_idx.append(img_idx)
|
123 |
+
else:
|
124 |
+
test_files.append((img, text))
|
125 |
+
test_idx.append(img_idx)
|
126 |
|
127 |
return [
|
128 |
datasets.SplitGenerator(
|