Resize¶
- class mmcv.transforms.Resize(scale: Optional[Union[int, Tuple[int, int]]] = None, scale_factor: Optional[Union[float, Tuple[float, float]]] = None, keep_ratio: bool = False, clip_object_border: bool = True, backend: str = 'cv2', interpolation='bilinear')[源代码]¶
Resize images & bbox & seg & keypoints.
This transform resizes the input image according to
scale
orscale_factor
. Bboxes, seg map and keypoints are then resized with the same scale factor. ifscale
andscale_factor
are both set, it will usescale
to resize.Required Keys:
img
gt_bboxes (optional)
gt_seg_map (optional)
gt_keypoints (optional)
Modified Keys:
img
gt_bboxes
gt_seg_map
gt_keypoints
img_shape
Added Keys:
scale
scale_factor
keep_ratio
- 参数
scale (int or tuple) – Images scales for resizing. Defaults to None
scale_factor (float or tuple[float]) – Scale factors for resizing. Defaults to None.
keep_ratio (bool) – Whether to keep the aspect ratio when resizing the image. Defaults to False.
clip_object_border (bool) – Whether to clip the objects outside the border of the image. In some dataset like MOT17, the gt bboxes are allowed to cross the border of images. Therefore, we don’t need to clip the gt bboxes in these cases. Defaults to True.
backend (str) – Image resize backend, choices are ‘cv2’ and ‘pillow’. These two backends generates slightly different results. Defaults to ‘cv2’.
interpolation (str) – Interpolation method, accepted values are “nearest”, “bilinear”, “bicubic”, “area”, “lanczos” for ‘cv2’ backend, “nearest”, “bilinear” for ‘pillow’ backend. Defaults to ‘bilinear’.