0

EasyOCR works well and is quick on localhost but is extremely slow and never finishes once deployed on digital ocean(Ubuntu 22.10). I have two versions.

1: One where i download the model storage_directory

2: Without downloading but directing to path where "craft_mlt_25k.pth" and "english_g2.pth" exist. Downloaded from -> https://www.jaided.ai/easyocr/modelhub/

import easyocr
reader = easyocr.Reader(['en', 'sv'], gpu=False, download_enabled=True, model_storage_directory=None)
results = reader.readtext(img)

easyocr_Confidence = 0.4
easyocrString = ""
for detection in results:
  if detection[2] > easyocr_Confidence:
     easyocrString += detection[1] + ' '

print(easyocrString)  
import easyocr
path = "/var/www/*****/*****/*****/server/utils"
reader = easyocr.Reader(['en'], gpu=False, download_enabled=False, model_storage_directory=path)
results = reader.readtext(img)

easyocr_Confidence = 0.4
easyocrString = ""
for detection in results:
    if detection[2] > easyocr_Confidence:
        easyocrString += detection[1] + ' '
        
print(easyocrString)  

What am i missing here or doing incorrect? Is this possible to achieve?

Redstain
  • 157
  • 2
  • 10
  • Any time metrics, machine specs? – doneforaiur Jun 08 '23 at 15:38
  • Ubuntu 22.10. Trying to get some metrics. I assume the download of the model storage directory is to slow. Not sure why the path to already downloaded directory wont work though. – Redstain Jun 08 '23 at 17:04
  • I think CPU would have much more of an impact on the performance than the read/write speed. I'm not familiar with OCR but I have used Speech to Text models on my machine and on the cloud. There was a significant speed difference just because the remote machines had 2 CPU cores and I have 16. I can see that the model is very small, rather than the CPU difference can it be environment related? Maybe some outdated packages, etc. – doneforaiur Jun 08 '23 at 17:13
  • Then i guess the only way to make it work is to pay for a digital ocean plan which allows for more CPU access? Or is there some other way? – Redstain Jun 08 '23 at 20:10
  • 1
    Certainly you could give it a try. I assume you are accounting for the model load/download times, etc. Other than the machine specs, I don't think there's an issue. – doneforaiur Jun 09 '23 at 05:58
  • I'll try to see if there are other OCR alternatives that require less CPU usage. I'ts unfortunately very expensive to increase CPU usage on digital ocean. Thanks for the help. – Redstain Jun 09 '23 at 07:39

0 Answers0