code: def training_roidbs(self):
      json_file = os.path.join(self.imgdir, "via_region_data.json")
      with open(json_file) as f:
          obj = json.load(f)
  
      ret = []
      for _, v in obj.items():
          fname = v["filename"]
          fname = os.path.join(self.imgdir, fname)
  
          roidb = {"file_name": fname}
  
          annos = v["regions"]
  
          boxes = []
          segs = []
          for _, anno in annos.items():
              assert not anno["region_attributes"]
              anno = anno["shape_attributes"]
              px = anno["all_points_x"]
              py = anno["all_points_y"]
              poly = np.stack((px, py), axis=1) + 0.5
              maxxy = poly.max(axis=0)
              minxy = poly.min(axis=0)
  
              boxes.append([minxy[0], minxy[1], maxxy[0], maxxy[1]])
              segs.append([poly])
          N = len(annos)
          roidb["boxes"] = np.asarray(boxes, dtype=np.float32)
          roidb["segmentation"] = segs
          roidb["class"] = np.ones((N,), dtype=np.int32)
          roidb["is_crowd"] = np.zeros((N,), dtype=np.int8)
          ret.append(roidb)
      return ret
  
file_path: tensorpack/examples/FasterRCNN/dataset/balloon.py
imports: import os
  import numpy
  import json
  from dataset import DatasetSplit, DatasetRegistry
label_desc: Use image node_id 2 for calling the BalloonDemo obj's underlying member method code with example usage: obj.training_roidbs() and returns: ret