TextDetRandomCrop¶
- class mmocr.datasets.transforms.TextDetRandomCrop(target_size, positive_sample_ratio=0.625)[源代码]¶
Randomly select a region and crop images to a target size and make sure to contain text region. This transform may break up text instances, and for broken text instances, we will crop it’s bbox and polygon coordinates. This transform is recommend to be used in segmentation-based network.
Required Keys:
img
gt_polygons
gt_bboxes
gt_bboxes_labels
gt_ignored
Modified Keys:
img
img_shape
gt_polygons
gt_bboxes
gt_bboxes_labels
gt_ignored
- 参数
target_size (tuple(int, int) or int) – Target size for the cropped image. If it’s a tuple, then target width and target height will be
target_size[0]
andtarget_size[1]
, respectively. If it’s an integer, them both target width and target height will betarget_size
.positive_sample_ratio (float) – The probability of sampling regions that go through text regions. Defaults to 5. / 8.
- 返回类型