Datasets:
fix: change json format
Browse files- visible-watermark-pita.py +1 -19
visible-watermark-pita.py
CHANGED
@@ -62,11 +62,8 @@ class WatermarkPita(datasets.GeneratorBasedBuilder):
|
|
62 |
"image": datasets.Image(),
|
63 |
"objects": datasets.Sequence(
|
64 |
{
|
65 |
-
"x": datasets.Value("float32"),
|
66 |
-
"y": datasets.Value("float32"),
|
67 |
-
"w": datasets.Value("float32"),
|
68 |
-
"h": datasets.Value("float32"),
|
69 |
"label": datasets.ClassLabel(names=self.config.categories),
|
|
|
70 |
}
|
71 |
),
|
72 |
}
|
@@ -99,19 +96,4 @@ class WatermarkPita(datasets.GeneratorBasedBuilder):
|
|
99 |
with open(label_path, "r") as f:
|
100 |
bboxes = json.load(f)
|
101 |
|
102 |
-
# print(bboxes)
|
103 |
-
|
104 |
-
# objects = []
|
105 |
-
# for bbox in bboxes:
|
106 |
-
# objects.append(
|
107 |
-
# {
|
108 |
-
# "x": bbox["x"],
|
109 |
-
# "y": bbox["y"],
|
110 |
-
# "w": bbox["width"],
|
111 |
-
# "h": bbox["height"],
|
112 |
-
# "label": bbox["label"],
|
113 |
-
# }
|
114 |
-
# )
|
115 |
-
# objects.append(bbox)
|
116 |
-
|
117 |
yield idx, {"image": image_path, "objects": bboxes}
|
|
|
62 |
"image": datasets.Image(),
|
63 |
"objects": datasets.Sequence(
|
64 |
{
|
|
|
|
|
|
|
|
|
65 |
"label": datasets.ClassLabel(names=self.config.categories),
|
66 |
+
"bbox": datasets.features.Sequence(datasets.Value("int32"), length=4),
|
67 |
}
|
68 |
),
|
69 |
}
|
|
|
96 |
with open(label_path, "r") as f:
|
97 |
bboxes = json.load(f)
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
yield idx, {"image": image_path, "objects": bboxes}
|