Shortcuts

RandomCrop

class mmocr.datasets.transforms.RandomCrop(min_side_ratio=0.4)[source]

Randomly crop images and make sure to contain at least one intact instance.

Required Keys:

  • img

  • gt_polygons

  • gt_bboxes

  • gt_bboxes_labels

  • gt_ignored

  • gt_texts (optional)

Modified Keys:

  • img

  • img_shape

  • gt_polygons

  • gt_bboxes

  • gt_bboxes_labels

  • gt_ignored

  • gt_texts (optional)

Parameters

min_side_ratio (float) – The ratio of the shortest edge of the cropped image to the original image size.

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) –