JaidedAI / EasyOCR

Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
https://www.jaided.ai
Apache License 2.0
23.62k stars 3.1k forks source link

Is there a way to trade accuracy for speed? #874

Open thiagodma opened 1 year ago

thiagodma commented 1 year ago

I'm building an application that needs the OCR to be really fast. I'm taking about 50ms to get text from a small image but I'd like to take something like 10ms. In my usecase I don't have to get perfect predictions, so I'd like to trade accuracy for speed.

Is there a simple way for doing that?

majunze2001 commented 1 year ago

@thiagodma Maybe you can try pytesseract.

thiagodma commented 1 year ago

Hmm, @majunze2001 I tried pytesseract but it was both slower and poorer on accuracy

JulianOrteil commented 1 year ago

Reduce input resolution, make it black and white (threshold it so you only black or white pixels, not grayscale), use a GPU (or a better one). The neural network is going to take as much time as it needs, EasyOCR can't override the operations it does to increase speed.

MdotO commented 1 year ago

In addition to @JulianOrteil suggestions, you may also try model compression techniques like pruning (and quantization and fp32-fp16 conversion but those will have relatively less speed gains) to gain a bit of speed and drastically reduce memory used by the model( model load time will also decrease ).