Shortcuts

mmedit.datasets.comp1k_dataset

Module Contents

Classes

AdobeComp1kDataset

Adobe composition-1k dataset.

class mmedit.datasets.comp1k_dataset.AdobeComp1kDataset(ann_file: str = '', metainfo: Optional[dict] = None, data_root: str = '', data_prefix: dict = dict(img_path=''), filter_cfg: Optional[dict] = None, indices: Optional[Union[int, Sequence[int]]] = None, serialize_data: bool = True, pipeline: List[Union[dict, Callable]] = [], test_mode: bool = False, lazy_init: bool = False, max_refetch: int = 1000)[source]

Bases: mmengine.dataset.BaseDataset

Adobe composition-1k dataset.

The dataset loads (alpha, fg, bg) data and apply specified transforms to the data. You could specify whether composite merged image online or load composited merged image in pipeline.

Example for online comp-1k dataset:

[
    {
        "alpha": 'alpha/000.png',
        "fg": 'fg/000.png',
        "bg": 'bg/000.png'
    },
    {
        "alpha": 'alpha/001.png',
        "fg": 'fg/001.png',
        "bg": 'bg/001.png'
    },
]

Example for offline comp-1k dataset:

[
    {
        "alpha": 'alpha/000.png',
        "merged": 'merged/000.png',
        "fg": 'fg/000.png',
        "bg": 'bg/000.png'
    },
    {
        "alpha": 'alpha/001.png',
        "merged": 'merged/001.png',
        "fg": 'fg/001.png',
        "bg": 'bg/001.png'
    },
]
Parameters
  • ann_file (str) – Annotation file path. Defaults to ‘’.

  • data_root (str, optional) – The root directory for data_prefix and ann_file. Defaults to None.

  • pipeline (list, optional) – Processing pipeline. Defaults to [].

  • test_mode (bool, optional) – test_mode=True means in test phase. Defaults to False.

  • **kwargs – Other arguments passed to mmengine.dataset.BaseDataset.

Examples

See unit-tests TODO: Move some codes in unittest here

METAINFO[source]
load_data_list() List[dict][source]

Load annotations from an annotation file named as self.ann_file

In order to be compoatible to both new and old annotation format, we copy implementations from mmengine and do some modificatoins.

Returns

A list of annotation.

Return type

list[dict]

parse_data_info(raw_data_info: dict) Union[dict, List[dict]][source]

Join data_root to each path in data_info.

Read the Docs v: latest
Versions
master
latest
stable
zyh-re-docs
zyh-doc-notfound-extend
zyh-api-rendering
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.