Update testdata.py
Browse files- testdata.py +2 -2
testdata.py
CHANGED
|
@@ -109,10 +109,10 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 109 |
img_path = os.path.join(image_dir, img_relative_path)
|
| 110 |
|
| 111 |
annotation = defaultdict(list)
|
| 112 |
-
with open(gt_file,
|
| 113 |
line = f.readline().strip()
|
| 114 |
while line:
|
| 115 |
-
assert re.match(r
|
| 116 |
cls, cx, cy, w, h = line.split()[:5]
|
| 117 |
cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
|
| 118 |
x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2
|
|
|
|
| 109 |
img_path = os.path.join(image_dir, img_relative_path)
|
| 110 |
|
| 111 |
annotation = defaultdict(list)
|
| 112 |
+
with open(gt_file, "r", encoding="utf-8") as f:
|
| 113 |
line = f.readline().strip()
|
| 114 |
while line:
|
| 115 |
+
assert re.match(r"^\d( [\d\.]+){4,5}$", line), "Incorrect line: %s" % line
|
| 116 |
cls, cx, cy, w, h = line.split()[:5]
|
| 117 |
cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
|
| 118 |
x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2
|