text: import os
  
  
  class DatasetCatalog(object):
      DATA_DIR = 'datasets'
      DATASETS = {
          'voc_2007_train': {
              'data_dir': 'voc/VOC2007',
              'split': 'train'
          },
          'voc_2007_val': {
              'data_dir': 'voc/VOC2007',
              'split': 'val'
          },
          'voc_2007_trainval': {
              'data_dir': 'voc/VOC2007',
              'split': 'trainval'
          },
          'voc_2007_test': {
              'data_dir': 'voc/VOC2007',
              'split': 'test'
          },
          'voc_2012_train': {
              'data_dir': 'voc/VOC2012',
              'split': 'train'
          },
          'voc_2012_val': {
              'data_dir': 'voc/VOC2012',
              'split': 'val'
          },
          'voc_2012_trainval': {
              'data_dir': 'voc/VOC2012',
              'split': 'trainval'
          },
          'coco_2017_train': {
              'img_dir': 'coco/train2017',
              'ann_file': 'coco/annotations/instances_train2017.json'
          },
          'coco_2017_val': {
              'img_dir': 'coco/train2017',
              'ann_file': 'coco/annotations/instances_val2017.json'
          },
      }
  
      @staticmethod
      def get(name):
          data_dir = DatasetCatalog.DATA_DIR
          attrs = DatasetCatalog.DATASETS[name]
  
          if 'coco' in name:
              args = dict(
                  root=os.path.join(data_dir, attrs['img_dir']),
                  ann_file=os.path.join(data_dir, attrs['ann_files'])
              )
              return dict(
                  factory='COCODatset',
                  args=args
              )
          elif 'voc' in name:
              args = dict(
                  data_dir=os.path.join(data_dir, attrs["data_dir"]),
                  split=attrs["split"],
              )
              return dict(
                  factory="PascalVOCDataset",
                  args=args,
              )
          else:
              raise RuntimeError(f'Unsupported dataset: {name}')
  