Resize¶
- class mmocr.datasets.transforms.Resize(scale=None, scale_factor=None, keep_ratio=False, clip_object_border=True, backend='cv2', interpolation='bilinear')[源代码]¶
Resize image & bboxes & polygons.
This transform resizes the input image according to
scale
orscale_factor
. Bboxes and polygons are then resized with the same scale factor. ifscale
andscale_factor
are both set, it will usescale
to resize.Required Keys:
img
img_shape
gt_bboxes
gt_polygons
Modified Keys:
img
img_shape
gt_bboxes
gt_polygons
Added Keys:
scale
scale_factor
keep_ratio
- 参数
scale (int or tuple) – Image scales for resizing. Defaults to None.
scale_factor (float or tuple[float, float]) – Scale factors for resizing. It’s either a factor applicable to both dimensions or in the form of (scale_w, scale_h). 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. 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’.
- 返回类型