Update testdata.py
Browse files- testdata.py +4 -1
testdata.py
CHANGED
|
@@ -90,6 +90,7 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 90 |
"image": datasets.Image(),
|
| 91 |
"faces": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=4)),
|
| 92 |
"plates": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=4)),
|
|
|
|
| 93 |
|
| 94 |
}
|
| 95 |
),
|
|
@@ -122,6 +123,7 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 122 |
for i_file in glob(os.path.join(image_dir, "*.png")):
|
| 123 |
plates = []
|
| 124 |
faces = []
|
|
|
|
| 125 |
|
| 126 |
img_relative_file = os.path.relpath(i_file, image_dir)
|
| 127 |
gt_relative_path = img_relative_file.replace(".png", ".txt")
|
|
@@ -129,6 +131,7 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 129 |
gt_path = os.path.join(annotation_dir, gt_relative_path)
|
| 130 |
img = cv2.imread(i_file)
|
| 131 |
img_h, img_w = img.shape[:2]
|
|
|
|
| 132 |
|
| 133 |
annotation = defaultdict(list)
|
| 134 |
with open(gt_path, "r", encoding="utf-8") as f:
|
|
@@ -149,7 +152,7 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 149 |
else:
|
| 150 |
plates.append([x1, y1, x2, y2])
|
| 151 |
|
| 152 |
-
yield idx, {"image": i_file, "faces": faces, "plates": plates}
|
| 153 |
|
| 154 |
idx += 1
|
| 155 |
|
|
|
|
| 90 |
"image": datasets.Image(),
|
| 91 |
"faces": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=4)),
|
| 92 |
"plates": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=4)),
|
| 93 |
+
"size": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=2)),
|
| 94 |
|
| 95 |
}
|
| 96 |
),
|
|
|
|
| 123 |
for i_file in glob(os.path.join(image_dir, "*.png")):
|
| 124 |
plates = []
|
| 125 |
faces = []
|
| 126 |
+
sizes = []
|
| 127 |
|
| 128 |
img_relative_file = os.path.relpath(i_file, image_dir)
|
| 129 |
gt_relative_path = img_relative_file.replace(".png", ".txt")
|
|
|
|
| 131 |
gt_path = os.path.join(annotation_dir, gt_relative_path)
|
| 132 |
img = cv2.imread(i_file)
|
| 133 |
img_h, img_w = img.shape[:2]
|
| 134 |
+
sizes.append([img_h, img_w])
|
| 135 |
|
| 136 |
annotation = defaultdict(list)
|
| 137 |
with open(gt_path, "r", encoding="utf-8") as f:
|
|
|
|
| 152 |
else:
|
| 153 |
plates.append([x1, y1, x2, y2])
|
| 154 |
|
| 155 |
+
yield idx, {"image": i_file, "faces": faces, "plates": plates, "size": sizes}
|
| 156 |
|
| 157 |
idx += 1
|
| 158 |
|