mmagic.datasets.transforms.formatting
¶
Module Contents¶
Classes¶
Pack data into DataSample for training, evaluation and testing. |
- class mmagic.datasets.transforms.formatting.PackInputs(keys: Tuple[List[str], str] = ['merged', 'img'], meta_keys: Tuple[List[str], str] = [], data_keys: Tuple[List[str], str] = [])[source]¶
Bases:
mmcv.transforms.base.BaseTransform
Pack data into DataSample for training, evaluation and testing.
- MMagic follows the design of data structure from MMEngine.
Data from the loader will be packed into data field of DataSample. More details of DataSample refer to the documentation of MMEngine: https://mmengine.readthedocs.io/en/latest/advanced_tutorials/data_element.html
- Parameters
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 [source]¶
Method to pack the input data.
- Parameters
results (dict) – Result dict from the data pipeline.
- Returns
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:DataSample): The annotation info of the
sample.
- Return type
dict