EasyOCR
EasyOCR copied to clipboard
Suggestion/feature request: create an interface to change model loading/inference strategy
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.
I agree, it would be very nice to be able to run it on a coral on a raspberry pi or other edge device.