open-mmlab / mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
https://mmocr.readthedocs.io/en/dev-1.x/
Apache License 2.0
4.34k stars 749 forks source link

Add online crop to mmocr 1.0 [Feature] #1873

Open Sneriko opened 1 year ago

Sneriko commented 1 year ago

What is the feature?

When I wrote pipelines involving mmdetection models and mmocr models for object detection/instance segmentation and text recognition respectively it was very conventient to have the online crop function used with the format x1 y1 x2 y2 x3 y3 x4 y4 , so as not to have to crop the detected boxes and write to disk before doing the text recognition. I haven't found a way to implement this with mmocr 1.0, where online crop is removed. TextRecogCropPacker seemes to write the cropped images to disk, and I want to avoid this, doing it online instead during training and testing. Is this a planned feature, or is it already possible to do this in mmocr 1.0 in some way I haven't figured out?

Any other context?

No response

gaotongxiao commented 1 year ago

Is it what you want: https://github.com/open-mmlab/mmocr/blob/d7c59f3325aaf4cbf6ddd3ec69f03230bc582d19/mmocr/apis/inferencers/mmocr_inferencer.py#L167