Shortcuts

RandomApply

class mmcv.transforms.RandomApply(transforms: Union[Dict, Callable[[Dict], Dict], List[Union[Dict, Callable[[Dict], Dict]]]], prob: float = 0.5)[源代码]

Apply transforms randomly with a given probability.

参数
  • transforms (list[dict | callable]) – The transform or transform list to randomly apply.

  • prob (float) – The probability to apply transforms. Default: 0.5

实际案例

>>> # config
>>> pipeline = [
>>>     dict(type='RandomApply',
>>>         transforms=[dict(type='HorizontalFlip')],
>>>         prob=0.3)
>>> ]
transform(results: Dict)Optional[Dict][源代码]

Randomly apply the transform.