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'))]])
resultswill be transformed using all transforms defined intransformsarguments.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
inputsanddata_samplesare both 4.Required Keys:
Depending on the requirements of the
transformsparameter.
Modified Keys:
All output keys of each transform.
- Parameters:
transforms (list[list[dict]]) – Transforms to be applied to data sampled from dataset.
transformsis 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
transformsto the results.As the example given in
TestTimeAug,transformsconsists of 2Resize, 2RandomFlipand 1PackDetInputs. The data sampled from dataset will be processed as follows:Data will be processed by 2
Resizeand 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.