Shortcuts

TextDetRandomCrop

class mmocr.datasets.transforms.TextDetRandomCrop(target_size, positive_sample_ratio=0.625)[source]

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

Parameters
  • 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.

Return type

None

transform(results)[source]

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

Returns

The transformed data

Return type

dict

Parameters

results (Dict) –

Read the Docs v: dev-1.x
Versions
latest
stable
v1.0.1
v1.0.0
0.x
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.1
v0.2.0
v0.1.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.