Update testdata.py
Browse files- testdata.py +16 -3
testdata.py
CHANGED
@@ -51,7 +51,7 @@ required to submit final prediction files, which we shall proceed to evaluate.
|
|
51 |
|
52 |
_REPO = "https://huggingface.co/datasets/testdata/resolve/main/data"
|
53 |
_URLS = {
|
54 |
-
"
|
55 |
"annot": f"{_REPO}/annotations.zip",
|
56 |
}
|
57 |
|
@@ -100,10 +100,23 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
100 |
annotation[cls].append([x1, y1, x2, y2])
|
101 |
line = f.readline().strip()
|
102 |
return annotation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
def _generate_examples(self, data_dir, annot_dir):
|
105 |
image_dir = os.path.join(data_dir, "fisheye")
|
106 |
-
|
107 |
files = []
|
108 |
faces = []
|
109 |
plates = []
|
@@ -112,7 +125,7 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
112 |
|
113 |
for image_path in tqdm(files):
|
114 |
img_relative_path = image_path.relative_to(image_dir)
|
115 |
-
gt_pah = (Path(
|
116 |
|
117 |
annotation = parse_annotation(gt_pah)
|
118 |
|
|
|
51 |
|
52 |
_REPO = "https://huggingface.co/datasets/testdata/resolve/main/data"
|
53 |
_URLS = {
|
54 |
+
"test": f"{_REPO}/fisheye.zip",
|
55 |
"annot": f"{_REPO}/annotations.zip",
|
56 |
}
|
57 |
|
|
|
100 |
annotation[cls].append([x1, y1, x2, y2])
|
101 |
line = f.readline().strip()
|
102 |
return annotation
|
103 |
+
|
104 |
+
def _split_generators(self, dl_manager):
|
105 |
+
data_dir = dl_manager.download_and_extract(_URLS)
|
106 |
+
return [
|
107 |
+
datasets.SplitGenerator(
|
108 |
+
name=datasets.Split.TEST,
|
109 |
+
gen_kwargs={
|
110 |
+
"split": "test",
|
111 |
+
"data_dir": data_dir["test"],
|
112 |
+
"annot_dir": data_dir["annot"],
|
113 |
+
},
|
114 |
+
),
|
115 |
+
]
|
116 |
|
117 |
def _generate_examples(self, data_dir, annot_dir):
|
118 |
image_dir = os.path.join(data_dir, "fisheye")
|
119 |
+
annotation_dir = os.path.join(annot_dir, "annotations")
|
120 |
files = []
|
121 |
faces = []
|
122 |
plates = []
|
|
|
125 |
|
126 |
for image_path in tqdm(files):
|
127 |
img_relative_path = image_path.relative_to(image_dir)
|
128 |
+
gt_pah = (Path(annotation_dir) / img_relative_path).with_suffix('.txt')
|
129 |
|
130 |
annotation = parse_annotation(gt_pah)
|
131 |
|