Update testdata.py
Browse files- testdata.py +6 -6
testdata.py
CHANGED
|
@@ -102,14 +102,14 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 102 |
files = []
|
| 103 |
|
| 104 |
idx = 0
|
| 105 |
-
for
|
| 106 |
-
|
| 107 |
-
|
| 108 |
|
| 109 |
-
|
| 110 |
|
| 111 |
annotation = defaultdict(list)
|
| 112 |
-
with open(
|
| 113 |
line = f.readline().strip()
|
| 114 |
while line:
|
| 115 |
assert re.match(r'^\d( [\d\.]+){4,5}$', line), 'Incorrect line: %s' % line
|
|
@@ -127,7 +127,7 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 127 |
else:
|
| 128 |
plates([x1, y1, x2, y2])
|
| 129 |
|
| 130 |
-
yield idx, {"image": str(
|
| 131 |
|
| 132 |
idx += 1
|
| 133 |
|
|
|
|
| 102 |
files = []
|
| 103 |
|
| 104 |
idx = 0
|
| 105 |
+
for gt_file in glob(os.path.join(annotation_dir, "*.txt")):
|
| 106 |
+
gt_relative_file = os.path.relpath(gt_file, annotation_dir)
|
| 107 |
+
img_relative_path = gt_relative_file.replace(".txt", ".png")
|
| 108 |
|
| 109 |
+
img_path = os.path.join(image_dir, img_relative_path)
|
| 110 |
|
| 111 |
annotation = defaultdict(list)
|
| 112 |
+
with open(gt_file, 'r') as f:
|
| 113 |
line = f.readline().strip()
|
| 114 |
while line:
|
| 115 |
assert re.match(r'^\d( [\d\.]+){4,5}$', line), 'Incorrect line: %s' % line
|
|
|
|
| 127 |
else:
|
| 128 |
plates([x1, y1, x2, y2])
|
| 129 |
|
| 130 |
+
yield idx, {"image": str(img_path), "faces": faces, "plates": plates}
|
| 131 |
|
| 132 |
idx += 1
|
| 133 |
|