add test data
Browse files- data/test.tar.gz +3 -0
- tfcol.py +22 -6
data/test.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:374b25c9910c504506f8b8fa1ca7f5946962fbb98503d801dec339095eec2b91
|
| 3 |
+
size 243638646
|
tfcol.py
CHANGED
|
@@ -28,6 +28,9 @@ _URLs = {
|
|
| 28 |
"images": "https://huggingface.co/datasets/shpotes/tfcol/resolve/main/data/val.tar.gz",
|
| 29 |
"annotations": "https://huggingface.co/datasets/shpotes/tfcol/raw/main/data/val.jsonl",
|
| 30 |
},
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
|
|
@@ -95,6 +98,14 @@ class TFCol(datasets.GeneratorBasedBuilder):
|
|
| 95 |
"split": "val",
|
| 96 |
},
|
| 97 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
]
|
| 99 |
|
| 100 |
def _generate_examples(self, annotations, images, split):
|
|
@@ -104,9 +115,14 @@ class TFCol(datasets.GeneratorBasedBuilder):
|
|
| 104 |
for id_, row in enumerate(f):
|
| 105 |
data = json.loads(row)
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
"images": "https://huggingface.co/datasets/shpotes/tfcol/resolve/main/data/val.tar.gz",
|
| 29 |
"annotations": "https://huggingface.co/datasets/shpotes/tfcol/raw/main/data/val.jsonl",
|
| 30 |
},
|
| 31 |
+
"test": {
|
| 32 |
+
"images": "https://huggingface.co/datasets/shpotes/tfcol/resolve/main/data/val.tar.gz",
|
| 33 |
+
}
|
| 34 |
}
|
| 35 |
|
| 36 |
|
|
|
|
| 98 |
"split": "val",
|
| 99 |
},
|
| 100 |
),
|
| 101 |
+
datasets.SplitGenerator(
|
| 102 |
+
name=datasets.Split.TEST,
|
| 103 |
+
gen_kwargs={
|
| 104 |
+
"annotations": None,
|
| 105 |
+
"images": data_dir["test"]["images"],
|
| 106 |
+
"split": "test"
|
| 107 |
+
}
|
| 108 |
+
)
|
| 109 |
]
|
| 110 |
|
| 111 |
def _generate_examples(self, annotations, images, split):
|
|
|
|
| 115 |
for id_, row in enumerate(f):
|
| 116 |
data = json.loads(row)
|
| 117 |
|
| 118 |
+
if split != "test":
|
| 119 |
+
yield id_, {
|
| 120 |
+
"lat": data["lat"],
|
| 121 |
+
"lon": data["lon"],
|
| 122 |
+
"labels": data["labels"],
|
| 123 |
+
"image": os.path.join(images, split, data["fname"]),
|
| 124 |
+
}
|
| 125 |
+
else:
|
| 126 |
+
yield id_, {
|
| 127 |
+
"image": os.path.join(images, split, data["fname"])
|
| 128 |
+
}
|