TestTimeAug¶
- class mmcv.transforms.TestTimeAug(transforms: list)[source]¶
Test-time augmentation transform.
An example configuration is as followed:
dict(type='TestTimeAug', transforms=[ [dict(type='Resize', scale=(1333, 400), keep_ratio=True), dict(type='Resize', scale=(1333, 800), keep_ratio=True)], [dict(type='RandomFlip', prob=1.), dict(type='RandomFlip', prob=0.)], [dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction'))]])
results
will be transformed using all transforms defined intransforms
arguments.For the above configuration, there are four combinations of resize and flip:
Resize to (1333, 400) + no flip
Resize to (1333, 400) + flip
Resize to (1333, 800) + no flip
resize to (1333, 800) + flip
After that, results are wrapped into lists of the same length as below:
dict( inputs=[...], data_samples=[...] )
The length of
inputs
anddata_samples
are both 4.Required Keys:
Depending on the requirements of the
transforms
parameter.
Modified Keys:
All output keys of each transform.
- Parameters
transforms (list[list[dict]]) – Transforms to be applied to data sampled from dataset.
transforms
is a list of list, and each list element usually represents a series of transforms with the same type and different arguments. Data will be processed by each list elements sequentially. See more information intransform()
.
- transform(results: dict) → dict[source]¶
Apply all transforms defined in
transforms
to the results.As the example given in
TestTimeAug
,transforms
consists of 2Resize
, 2RandomFlip
and 1PackDetInputs
. The data sampled from dataset will be processed as follows:Data will be processed by 2
Resize
and return a list of 2 results.Each result in list will be further passed to 2
RandomFlip
, and aggregates into a list of 4 results.Each result will be processed by
PackDetInputs
, and return a list of dict.Aggregates the same fields of results, and finally returns a dict. Each value of the dict represents 4 transformed results.