question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

always download model itself.

See original GitHub issue

I am new to EasyOCR. As the example in Readme.MD, using pip install easyocr, and runing the example. I download the model from model hub, and put into ~/.EasyOCR/model,

$ ls -1 ~/.EasyOCR/model/
english_g2.zip
temp.zip
zh_sim_g2.zip

but, each time I run the code, it always show the downloading. My network is not good, so, the download always interrupted.

$ python3 test1.py
CUDA not available - defaulting to CPU. Note: This module is much faster with a GPU.
Downloading detection model, please wait. This may take several minutes depending upon your network connection.
Progress: |████----------------------------------------------| 10.0% Complet
Traceback (most recent call last):
  File "test1.py", line 5, in <module>
    reader = easyocr.Reader(['ch_sim','en']) # this needs to run only once to load the model into memory
  File "/usr/local/lib/python3.6/site-packages/easyocr/easyocr.py", line 90, in __init__
    download_and_unzip(detection_models[detector_model]['url'], detection_models[detector_model]['filename'], self.model_storage_directory, verbose)
  File "/usr/local/lib/python3.6/site-packages/easyocr/utils.py", line 586, in download_and_unzip
    urlretrieve(url, zip_path, reporthook=reporthook)
  File "/usr/lib64/python3.6/urllib/request.py", line 289, in urlretrieve
    % (read, size), result)
urllib.error.ContentTooShortError: <urlopen error retrieval incomplete: got only 9188135 out of 77251756 bytes>

Is there any wrong ? Do I need unzip the file ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
q1208ccommented, Nov 3, 2021

Unzip both the text detection models and the language models and keep them within the same directory. Mention the path of this directory while creating a easyocr.Reader object by specifying the model_storage_directory parameter. Finally, set download_enabled to False. The last step is the most important because Easyocr will always prefer to download models from its online repository instead of searching the local file system.

Thank for your help. It’s working now.

1reaction
pronoym99commented, Oct 31, 2021

Unzip both the text detection models and the language models and keep them within the same directory. Mention the path of this directory while creating a easyocr.Reader object by specifying the model_storage_directory parameter. Finally, set download_enabled to False. The last step is the most important because Easyocr will always prefer to download models from its online repository instead of searching the local file system.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do random apps keep downloading on my Android device?
This is the most important solution which will help you to stop apps from downloading by themselves on Android phone and tablet. Many...
Read more >
Why Is My iPhone Downloading Apps By Itself and How to ...
Disabling Automatic App Downloads. Thankfully, it's very easy to stop your iPhone or iPad from downloading apps automatically. Open the Settings ...
Read more >
My file automatically opens instead of saving when I download ...
Click on "Settings" and you'll see a new page pop up in your Chrome browser window. Scroll down to Advanced Settings, click Downloads,...
Read more >
How Do I Stop Downloaded Files From Opening Automatically ...
Objective: Stop auto-opening downloads in Chrome; Chrome is trying to open files I download; The error message that file cannot be opened when...
Read more >
Change your download settings for Podcasts on iPhone
Turn Enable When Following (under Automatic Downloads) off or on. Tip: To automatically download a particular podcast, open the Podcasts app , touch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found