mmagic.datasets.mscoco_dataset
¶
Module Contents¶
Classes¶
MSCoCo 2014 dataset. |
- class mmagic.datasets.mscoco_dataset.MSCoCoDataset(ann_file: str = '', metainfo: Optional[dict] = None, data_root: str = '', drop_caption_rate=0.0, phase='train', year=2014, data_prefix: Union[str, dict] = '', extensions: Sequence[str] = ('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif'), lazy_init: bool = False, classes: Union[str, Sequence[str], None] = None, caption_style: str = '', **kwargs)[source]¶
Bases:
mmagic.datasets.basic_conditional_dataset.BasicConditionalDataset
MSCoCo 2014 dataset.
- Parameters
ann_file (str) – Annotation file path. Defaults to ‘’.
metainfo (dict, optional) – Meta information for dataset, such as class information. Defaults to None.
data_root (str) – The root directory for
data_prefix
andann_file
. Defaults to ‘’.drop_caption_rate (float, optional) – Rate of dropping caption, used for training. Defaults to 0.0.
phase (str, optional) – Subdataset used for certain phase, can be set to train, test and val. Defaults to ‘train’.
year (int, optional) – Version of CoCo dataset, can be set to 2014 and 2017. Defaults to 2014.
data_prefix (str | dict) – Prefix for the data. Defaults to ‘’.
extensions (Sequence[str]) – A sequence of allowed extensions. Defaults to (‘.jpg’, ‘.jpeg’, ‘.png’, ‘.ppm’, ‘.bmp’, ‘.pgm’, ‘.tif’).
lazy_init (bool) – Whether to load annotation during instantiation. In some cases, such as visualization, only the meta information of the dataset is needed, which is not necessary to load annotation file.
Basedataset
can skip load annotations to save time by setlazy_init=False
. Defaults to False.caption_style (str) – If you want to add a style description for each caption, you can set caption_style to your style prompt. For example, ‘realistic style’. Defaults to empty str.
**kwargs – Other keyword arguments in
BaseDataset
.