Shortcuts

mmedit.datasets.transforms.formatting

Module Contents

Classes

PackEditInputs

Pack data into EditDataSample for training, evaluation and testing.

class mmedit.datasets.transforms.formatting.PackEditInputs(keys: Tuple[List[str], str] = ['merged', 'img'], meta_keys: Tuple[List[str], str] = [], data_keys: Tuple[List[str], str] = [])[源代码]

Bases: mmcv.transforms.base.BaseTransform

Pack data into EditDataSample for training, evaluation and testing.

MMediting follows the design of data structure from MMEngine.

Data from the loader will be packed into data field of EditDataSample. More details of DataSample refer to the documentation of MMEngine: https://mmengine.readthedocs.io/en/latest/advanced_tutorials/data_element.html

参数
  • Tuple[List[str] (meta_keys) – The keys to saved in returned inputs, which are used as the input of models, default to [‘img’, ‘noise’, ‘merged’].

  • str – The keys to saved in returned inputs, which are used as the input of models, default to [‘img’, ‘noise’, ‘merged’].

  • None] – The keys to saved in returned inputs, which are used as the input of models, default to [‘img’, ‘noise’, ‘merged’].

  • Tuple[List[str] – The keys to saved in data_field of the data_samples.

  • str – The keys to saved in data_field of the data_samples.

  • None] – The keys to saved in data_field of the data_samples.

  • Tuple[List[str] – The meta keys to saved in metainfo of the data_samples. All the other data will be packed into the data of the data_samples

  • str – The meta keys to saved in metainfo of the data_samples. All the other data will be packed into the data of the data_samples

  • None] – The meta keys to saved in metainfo of the data_samples. All the other data will be packed into the data of the data_samples

transform(results: dict) dict[源代码]

Method to pack the input data.

参数

results (dict) – Result dict from the data pipeline.

返回

A dict contains

  • ’inputs’ (obj:dict): The forward data of models. According to different tasks, the inputs may contain images, videos, labels, text, etc.

  • ’data_samples’ (obj:EditDataSample): The annotation info of the

    sample.

返回类型

dict

__repr__() str[源代码]

Return repr(self).