original_docstring: 
      Load and prepare dataset dicts for training / testing
  
      Args:
          dataset_names (Collection[str]): a list of dataset names
          keep_instance_predicate (Callable: Dict[str, Any] -> bool): predicate
              applied to instance dicts which defines whether to keep the instance
          proposal_files (Collection[str]): if given, a list of object proposal files
              that match each dataset in `dataset_names`.
      
docstring: Load and prepare dataset dicts for training / testing
docstring_tokens: Load and prepare dataset dicts for training / testing
code: def combine_detection_dataset_dicts(
      dataset_names: Collection[str],
      keep_instance_predicate: Optional[InstancePredicate] = None,
      proposal_files: Optional[Collection[str]] = None,
  ) -> List[Instance]:
      """
      Load and prepare dataset dicts for training / testing
  
      Args:
          dataset_names (Collection[str]): a list of dataset names
          keep_instance_predicate (Callable: Dict[str, Any] -> bool): predicate
              applied to instance dicts which defines whether to keep the instance
          proposal_files (Collection[str]): if given, a list of object proposal files
              that match each dataset in `dataset_names`.
      """
      assert len(dataset_names)
      if proposal_files is None:
          proposal_files = [None] * len(dataset_names)
      assert len(dataset_names) == len(proposal_files)
      # load annotations and dataset metadata
      dataset_map = {}
      for dataset_name in dataset_names:
          dataset_dicts = DatasetCatalog.get(dataset_name)
          dataset_map[dataset_name] = dataset_dicts
      # initialize category maps
      _add_category_id_to_contiguous_id_maps_to_metadata(dataset_names)
      # apply category maps
      all_datasets_dicts = []
      for dataset_name, proposal_file in zip(dataset_names, proposal_files):
          dataset_dicts = dataset_map[dataset_name]
          assert len(dataset_dicts), f"Dataset '{dataset_name}' is empty!"
          if proposal_file is not None:
              dataset_dicts = load_proposals_into_dataset(dataset_dicts, proposal_file)
          dataset_dicts = _maybe_filter_and_map_categories(dataset_name, dataset_dicts)
          _map_category_id_to_contiguous_id(dataset_name, dataset_dicts)
          print_instances_class_histogram(
              dataset_dicts, MetadataCatalog.get(dataset_name).thing_classes
          )
          all_datasets_dicts.append(dataset_dicts)
  
      if keep_instance_predicate is not None:
          all_datasets_dicts_plain = [
              d
              for d in itertools.chain.from_iterable(all_datasets_dicts)
              if keep_instance_predicate(d)
          ]
      else:
          all_datasets_dicts_plain = list(itertools.chain.from_iterable(all_datasets_dicts))
      return all_datasets_dicts_plain
code_tokens: def combine_detection_dataset_dicts ( dataset_names : Collection [ str ] , keep_instance_predicate : Optional [ InstancePredicate ] = None , proposal_files : Optional [ Collection [ str ] ] = None , ) -> List [ Instance ] : assert len ( dataset_names ) if proposal_files is None : proposal_files = [ None ] * len ( dataset_names ) assert len ( dataset_names ) == len ( proposal_files ) dataset_map = { } for dataset_name in dataset_names : dataset_dicts = DatasetCatalog . get ( dataset_name ) dataset_map [ dataset_name ] = dataset_dicts _add_category_id_to_contiguous_id_maps_to_metadata ( dataset_names ) all_datasets_dicts = [ ] for dataset_name , proposal_file in zip ( dataset_names , proposal_files ) : dataset_dicts = dataset_map [ dataset_name ] assert len ( dataset_dicts ) , f"Dataset '{dataset_name}' is empty!" if proposal_file is not None : dataset_dicts = load_proposals_into_dataset ( dataset_dicts , proposal_file ) dataset_dicts = _maybe_filter_and_map_categories ( dataset_name , dataset_dicts ) _map_category_id_to_contiguous_id ( dataset_name , dataset_dicts ) print_instances_class_histogram ( dataset_dicts , MetadataCatalog . get ( dataset_name ) . thing_classes ) all_datasets_dicts . append ( dataset_dicts ) if keep_instance_predicate is not None : all_datasets_dicts_plain = [ d for d in itertools . chain . from_iterable ( all_datasets_dicts ) if keep_instance_predicate ( d ) ] else : all_datasets_dicts_plain = list ( itertools . chain . from_iterable ( all_datasets_dicts ) ) return all_datasets_dicts_plain
short_docstring: Load and prepare dataset dicts for training / testing
short_docstring_tokens: Load and prepare dataset dicts for training / testing
comment: """
      Load and prepare dataset dicts for training / testing
  
      Args:
          dataset_names (Collection[str]): a list of dataset names
          keep_instance_predicate (Callable: Dict[str, Any] -> bool): predicate
              applied to instance dicts which defines whether to keep the instance
          proposal_files (Collection[str]): if given, a list of object proposal files
              that match each dataset in `dataset_names`.
      """$SEP$# load annotations and dataset metadata$SEP$# initialize category maps$SEP$# apply category maps