bastienp commited on
Commit
d2a0b4d
1 Parent(s): f3ede03

fix: update json format

Browse files
Files changed (1) hide show
  1. visible-watermark-pita.py +11 -5
visible-watermark-pita.py CHANGED
@@ -62,10 +62,11 @@ class WatermarkPita(datasets.GeneratorBasedBuilder):
62
  "image": datasets.Image(),
63
  "objects": datasets.Sequence(
64
  {
 
 
 
 
65
  "label": datasets.ClassLabel(names=self.config.categories),
66
- "bbox": datasets.Sequence(
67
- datasets.Value("int32"), length=4
68
- ),
69
  }
70
  ),
71
  }
@@ -96,6 +97,11 @@ class WatermarkPita(datasets.GeneratorBasedBuilder):
96
 
97
  for idx, (image_path, label_path) in enumerate(zip(image_paths, label_paths)):
98
  with open(label_path, "r") as f:
99
- bbox = json.load(f)
100
 
101
- yield idx, {"image": image_path, "objects": bbox}
 
 
 
 
 
 
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
  }
 
97
 
98
  for idx, (image_path, label_path) in enumerate(zip(image_paths, label_paths)):
99
  with open(label_path, "r") as f:
100
+ bboxes = json.load(f)
101
 
102
+ objects = []
103
+ for bbox in bboxes:
104
+ print(bbox)
105
+ objects.append(bbox)
106
+
107
+ yield idx, {"image": image_path, "objects": bboxes}