faustomorales / keras-ocr

A packaged and flexible version of the CRAFT text detector and Keras CRNN recognition model.
https://keras-ocr.readthedocs.io/
MIT License
1.36k stars 347 forks source link

How can I load the models in an offline environment? #239

Closed seansteel3 closed 11 months ago

seansteel3 commented 11 months ago

I already have pre-retrained models downloaded and just need to load the detector and recognizer objects. Specifically trying to circumvent the "Looking for /root/.keras-ocr/crnn_kurapan_notop.h5" URL call when instantiating the detector/recognizer.

Feels like I am probably missing something obvious when reconfiguring the "PRETRAINED_WEIGHTS" dictionaries, but I can't figure out what...

seansteel3 commented 11 months ago

Indeed I was missing something very obvious once I looked closer at the detector.py code.

If anyone else runs into this "issue" as well, all you need to do is explicitly pass "weights = None" as an argument to the detector and/or recognizer and it will build with no URL requests.