Update testdata.py
Browse files- testdata.py +0 -14
testdata.py
CHANGED
|
@@ -85,20 +85,6 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 85 |
license=_LICENSE,
|
| 86 |
citation=_CITATION,
|
| 87 |
)
|
| 88 |
-
|
| 89 |
-
def parse_annotation(annotation_path: str) -> List[float]:
|
| 90 |
-
"""Read annotation from file."""
|
| 91 |
-
annotation = defaultdict(list)
|
| 92 |
-
with open(annotation_path, 'r') as f:
|
| 93 |
-
line = f.readline().strip()
|
| 94 |
-
while line:
|
| 95 |
-
assert re.match(r'^\d( [\d\.]+){4,5}$', line), 'Incorrect line: %s' % line
|
| 96 |
-
cls, cx, cy, w, h = line.split()[:5]
|
| 97 |
-
cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
|
| 98 |
-
x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2
|
| 99 |
-
annotation[cls].append([x1, y1, x2, y2])
|
| 100 |
-
line = f.readline().strip()
|
| 101 |
-
return annotation
|
| 102 |
|
| 103 |
def _split_generators(self, dl_manager):
|
| 104 |
data_dir = dl_manager.download_and_extract(_URLS)
|
|
|
|
| 85 |
license=_LICENSE,
|
| 86 |
citation=_CITATION,
|
| 87 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
def _split_generators(self, dl_manager):
|
| 90 |
data_dir = dl_manager.download_and_extract(_URLS)
|