Shortcuts

ConcatDataset

class mmengine.dataset.ConcatDataset(datasets, lazy_init=False, ignore_keys=None)[源代码]

A wrapper of concatenated dataset.

Same as torch.utils.data.dataset.ConcatDataset and support lazy_init.

备注

ConcatDataset should not inherit from BaseDataset since get_subset and get_subset_ could produce ambiguous meaning sub-dataset which conflicts with original dataset. If you want to use a sub-dataset of ConcatDataset, you should set indices arguments for wrapped dataset which inherit from BaseDataset.

参数:
  • datasets (Sequence[BaseDataset] or Sequence[dict]) – A list of datasets which will be concatenated.

  • lazy_init (bool, optional) – Whether to load annotation during instantiation. Defaults to False.

  • ignore_keys (List[str] or str) – Ignore the keys that can be unequal in dataset.metainfo. Defaults to None. New in version 0.3.0.

full_init()[源代码]

Loop to full_init each dataset.

get_data_info(idx)[源代码]

Get annotation by index.

参数:

idx (int) – Global index of ConcatDataset.

返回:

The idx-th annotation of the datasets.

返回类型:

dict

get_subset(indices)[源代码]

Not supported in ConcatDataset for the ambiguous meaning of sub- dataset.

参数:

indices (List[int] | int) –

返回类型:

BaseDataset

get_subset_(indices)[源代码]

Not supported in ConcatDataset for the ambiguous meaning of sub- dataset.

参数:

indices (List[int] | int) –

返回类型:

None

property metainfo: dict

Get the meta information of the first dataset in self.datasets.

返回:

Meta information of first dataset.

返回类型:

dict