RandomChoice¶
- class mmcv.transforms.RandomChoice(transforms: List[Dict | Callable[[Dict], Dict] | List[Dict | Callable[[Dict], Dict]]], prob: List[float] | None = None)[source]¶
Process data with a randomly chosen transform from given candidates.
- Parameters:
transforms (list[list]) – A list of transform candidates, each is a sequence of transforms.
prob (list[float], optional) – The probabilities associated with each pipeline. The length should be equal to the pipeline number and the sum should be 1. If not given, a uniform distribution will be assumed.
Examples
>>> # config >>> pipeline = [ >>> dict(type='RandomChoice', >>> transforms=[ >>> [dict(type='RandomHorizontalFlip')], # subpipeline 1 >>> [dict(type='RandomRotate')], # subpipeline 2 >>> ] >>> ) >>> ]