RandomChoice¶
- class mmcv.transforms.RandomChoice(transforms: List[Union[Dict, Callable[[Dict], Dict], List[Union[Dict, Callable[[Dict], Dict]]]]], prob: Optional[List[float]] = None)[源代码]¶
Process data with a randomly chosen transform from given candidates.
- 参数
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.
实际案例
>>> # config >>> pipeline = [ >>> dict(type='RandomChoice', >>> transforms=[ >>> [dict(type='RandomHorizontalFlip')], # subpipeline 1 >>> [dict(type='RandomRotate')], # subpipeline 2 >>> ] >>> ) >>> ]