mmocr.utils.rescale_polygons¶
- mmocr.utils.rescale_polygons(polygons, scale_factor, mode='mul')[源代码]¶
Rescale polygons according to scale_factor.
The behavior is different depending on the mode. When mode is ‘mul’, the coordinates will be multiplied by scale_factor, which is usually used in preprocessing transforms such as
Resize()
. The coordinates will be divided by scale_factor if mode is ‘div’. It can be used in postprocessors to recover the polygon in the original image size.- 参数
polygons (list[ArrayLike] or ArrayLike) – A list of polygons, each written in [x1, y1, x2, y2, …] and in any form can be converted to an 1-D numpy array. E.g. list[list[float]], list[np.ndarray], or list[torch.Tensor].
model (str) – Rescale mode. Can be ‘mul’ or ‘div’. Defaults to ‘mul’.
mode (str) –
- 返回
Rescaled polygons. The type of the return value depends on the type of the input polygons.
- 返回类型
list[np.ndarray] or np.ndarray