Shortcuts

TestTimeAug

class mmcv.transforms.TestTimeAug(transforms: list)[源代码]

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 in transforms 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 and data_samples are both 4.

Required Keys:

  • Depending on the requirements of the transforms parameter.

Modified Keys:

  • All output keys of each transform.

参数

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 in transform().

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

Apply all transforms defined in transforms to the results.

As the example given in TestTimeAug, transforms consists of 2 Resize, 2 RandomFlip and 1 PackDetInputs. The data sampled from dataset will be processed as follows:

  1. Data will be processed by 2 Resize and return a list of 2 results.

  2. Each result in list will be further passed to 2 RandomFlip, and aggregates into a list of 4 results.

  3. Each result will be processed by PackDetInputs, and return a list of dict.

  4. Aggregates the same fields of results, and finally returns a dict. Each value of the dict represents 4 transformed results.

参数

results (dict) – Result dict contains the data to transform.

返回

The augmented data, where each value is wrapped into a list.

返回类型

dict

Read the Docs v: stable
Versions
latest
stable
2.x
v2.0.1
v2.0.0
1.x
v1.7.1
v1.7.0
v1.6.2
v1.6.1
v1.6.0
v1.5.3
v1.5.2_a
v1.5.1
v1.5.0
v1.4.8
v1.4.7
v1.4.6
v1.4.5
v1.4.4
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.18
v1.3.17
v1.3.16
v1.3.15
v1.3.14
v1.3.13
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.