EasyOCR icon indicating copy to clipboard operation
EasyOCR copied to clipboard

Suggestion/feature request: create an interface to change model loading/inference strategy

Open rpvelloso opened this issue 2 years ago • 1 comments

Let's say that I want to run easyocr on an edge device or some other achitecture. It would be very easy to do that if I could inject the loading/inference strategy object into easyocr's instance, e.g.: easyocr.Reader(..., new ModelInterfaceImpl()). The default implementation could be the pytorch one and an alternate implementation for ONNX could be provided out-of-the-box too.

Something like this (high level definition):

DetectModelInterface {
abstract load()/init()
abstract predict()
abstract batch_predict()
abstract release()/close()/unload()
}

RecogModelInterface {
... same methods with different signatures
}

With that mechanism I could implement this interface for, let's say, rockchip's NPU or Google Coral, and run easyocr on an edge device with hw acceleration and without having to rely on/install pytorch. It is also possible to swap the implementations and test various combinations of models.

rpvelloso avatar Nov 17 '22 19:11 rpvelloso

I agree, it would be very nice to be able to run it on a coral on a raspberry pi or other edge device.

diminDDL avatar Nov 30 '23 14:11 diminDDL