PackInputs¶
- class mmpretrain.datasets.transforms.PackInputs(input_key='img', algorithm_keys=(), meta_keys=('sample_idx', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction'))[source]¶
Pack the inputs data.
Required Keys:
input_key
*algorithm_keys
*meta_keys
Deleted Keys:
All other keys in the dict.
Added Keys:
inputs (
torch.Tensor
): The forward data of models.data_samples (
DataSample
): The annotation info of the sample.
- Parameters:
input_key (str) – The key of element to feed into the model forwarding. Defaults to ‘img’.
algorithm_keys (Sequence[str]) – The keys of custom elements to be used in the algorithm. Defaults to an empty tuple.
meta_keys (Sequence[str]) – The keys of meta information to be saved in the data sample. Defaults to
PackInputs.DEFAULT_META_KEYS
.
Default algorithm keys
Besides the specified
algorithm_keys
, we will set some default keys into the output data sample and do some formatting. Therefore, you don’t need to set these keys in thealgorithm_keys
.gt_label
: The ground-truth label. The value will be converted into a 1-D tensor.gt_score
: The ground-truth score. The value will be converted into a 1-D tensor.mask
: The mask for some self-supervise tasks. The value will be converted into a tensor.