Shortcuts

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] and target_size[1], respectively. If it’s an integer, them both target width and target height will be target_size.

  • positive_sample_ratio (float) – The probability of sampling regions that go through text regions. Defaults to 5. / 8.

返回类型

None

transform(results)[源代码]

Applying random crop on results. :param results: Result dict contains the data to transform. :type results: dict

返回

The transformed data

返回类型

dict

参数

results (Dict) –

Read the Docs v: dev-1.x
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.