parameters: (dataset_list, transforms, dataset_catalog, is_train=True)
return_statement: return [dataset]
docstring: Arguments:
          dataset_list (list[str]): Contains the names of the datasets, i.e.,
              coco_2014_trian, coco_2014_val, etc
          transforms (callable): transforms to apply to each (image, target) sample
          dataset_catalog (DatasetCatalog): contains the information on how to
              construct a dataset.
          is_train (bool): whether to setup the dataset for training or testing
docstring_summary: Arguments:
          dataset_list (list[str]): Contains the names of the datasets, i.e.,
              coco_2014_trian, coco_2014_val, etc
          transforms (callable): transforms to apply to each (image, target) sample
          dataset_catalog (DatasetCatalog): contains the information on how to
              construct a dataset.
          is_train (bool): whether to setup the dataset for training or testing
docstring_tokens: Arguments : dataset_list ( list [ str ] ) : Contains the names of the datasets i . e . coco_2014_trian coco_2014_val etc transforms ( callable ) : transforms to apply to each ( image target ) sample dataset_catalog ( DatasetCatalog ) : contains the information on how to construct a dataset . is_train ( bool ) : whether to setup the dataset for training or testing
function: def build_dataset(dataset_list, transforms, dataset_catalog, is_train=True):
      """
      Arguments:
          dataset_list (list[str]): Contains the names of the datasets, i.e.,
              coco_2014_trian, coco_2014_val, etc
          transforms (callable): transforms to apply to each (image, target) sample
          dataset_catalog (DatasetCatalog): contains the information on how to
              construct a dataset.
          is_train (bool): whether to setup the dataset for training or testing
      """
      if not isinstance(dataset_list, (list, tuple)):
          raise RuntimeError(
              "dataset_list should be a list of strings, got {}".format(dataset_list)
          )
      datasets = []
      for dataset_name in dataset_list:
          data = dataset_catalog.get(dataset_name)
          factory = getattr(D, data["factory"])
          args = data["args"]
          # for COCODataset, we want to remove images without annotations
          # during training
          if data["factory"] == "COCODataset":
              args["remove_images_without_annotations"] = is_train
          if data["factory"] == "PascalVOCDataset":
              args["use_difficult"] = not is_train
          args["transforms"] = transforms
          # make dataset from factory
          dataset = factory(**args)
          datasets.append(dataset)
  
      # for testing, return a list of datasets
      if not is_train:
          return datasets
  
      # for training, concatenate all datasets into a single one
      dataset = datasets[0]
      if len(datasets) > 1:
          dataset = D.ConcatDataset(datasets)
  
      return [dataset]
function_tokens: def build_dataset ( dataset_list , transforms , dataset_catalog , is_train = True ) : if not isinstance ( dataset_list , ( list , tuple ) ) : raise RuntimeError ( "dataset_list should be a list of strings, got {}" . format ( dataset_list ) ) datasets = [ ] for dataset_name in dataset_list : data = dataset_catalog . get ( dataset_name ) factory = getattr ( D , data [ "factory" ] ) args = data [ "args" ] # for COCODataset, we want to remove images without annotations # during training if data [ "factory" ] == "COCODataset" : args [ "remove_images_without_annotations" ] = is_train if data [ "factory" ] == "PascalVOCDataset" : args [ "use_difficult" ] = not is_train args [ "transforms" ] = transforms # make dataset from factory dataset = factory ( * * args ) datasets . append ( dataset ) # for testing, return a list of datasets if not is_train : return datasets # for training, concatenate all datasets into a single one dataset = datasets [ 0 ] if len ( datasets ) > 1 : dataset = D . ConcatDataset ( datasets ) return [ dataset ]