code: def __init__(
      self,
      root=os.path.join("~", ".mxnet", "datasets", "visualgenome"),
      split="train",
  ):
      super(VGRelation, self).__init__(root)
      self._root = os.path.expanduser(root)
      self._img_path = os.path.join(self._root, "VG_100K", "{}")
  
      if split == "train":
          self._dict_path = os.path.join(
              self._root, "rel_annotations_train.json"
          )
      elif split == "val":
          self._dict_path = os.path.join(
              self._root, "rel_annotations_val.json"
          )
      else:
          raise NotImplementedError
      with open(self._dict_path) as f:
          tmp = f.read()
          self._dict = json.loads(tmp)
  
      self._predicates_path = os.path.join(
          self._root, "predicates.json"
      )
      with open(self._predicates_path, "r") as f:
          tmp = f.read()
          self.rel_classes = json.loads(tmp)
      self.num_rel_classes = len(self.rel_classes) + 1
  
      self._objects_path = os.path.join(self._root, "objects.json")
      with open(self._objects_path, "r") as f:
          tmp = f.read()
          self.obj_classes = json.loads(tmp)
      self.num_obj_classes = len(self.obj_classes)
  
      if split == "val":
          self.img_transform = FasterRCNNDefaultValTransform(
              short=600, max_size=1000
          )
      else:
          self.img_transform = FasterRCNNDefaultTrainTransform(
              short=600, max_size=1000
          )
      self.split = split
  
file_path: dgl/examples/mxnet/scenegraph/data/relation.py
imports: from __future__ import absolute_import, division
  import json
  import logging
  import os
  import pickle
  import warnings
  from collections import Counter
  import dgl
  import mxnet
  import numpy
  from gluoncv.data.base import VisionDataset
  from gluoncv.data.transforms.presets.rcnn import FasterRCNNDefaultTrainTransform, FasterRCNNDefaultValTransform
label_desc: Use image node_id 1 to create a new VGRelation object from inherited base classes: VisionDataset with example: obj = VGRelation(root, split)