Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: unexpected EOF, expected 2304602 more bytes. The file might be corrupted. #52

Closed
snoop2head opened this issue Jul 7, 2020 · 3 comments

Comments

@snoop2head
Copy link
Contributor

snoop2head commented Jul 7, 2020

Development Environment

  • Mac OS Catalina 10.15.5
  • pyenv virtual environment
  • Python 3.8.3
  • poetry as package manager

How to replicate the error

Set up Virtual Environment and Dependencies

# zsh shell
pyenv virtualenv 3.8.3 OCR
pyenv activate OCR

Install easyocr via poetry

pip install poetry
poetry init
poetry add easyocr

Run Python File

# detect.py
import easyocr
reader = easyocr.Reader(["en"], gpu=False)
reader.readtext("./images/7c9bfd59ce7b1768d42566c0e9ec606a.jpg")

Image source

# zsh shell
python detect.py
# zsh shell
Using CPU. Note: This module is much faster with a GPU.
Traceback (most recent call last):
  File "detect.py", line 3, in <module>
    reader = easyocr.Reader(["en"], gpu=False)
  File "/Users/noopy/.pyenv/versions/ocr/lib/python3.8/site-packages/easyocr/easyocr.py", line 171, in __init__
    self.detector = get_detector(DETECTOR_PATH, self.device)
  File "/Users/noopy/.pyenv/versions/ocr/lib/python3.8/site-packages/easyocr/detection.py", line 59, in get_detector
    net.load_state_dict(copyStateDict(torch.load(trained_model, map_location=device)))
  File "/Users/noopy/.pyenv/versions/ocr/lib/python3.8/site-packages/torch/serialization.py", line 593, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/Users/noopy/.pyenv/versions/ocr/lib/python3.8/site-packages/torch/serialization.py", line 780, in _legacy_load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF, expected 2304602 more bytes. The file might be corrupted.

I've ran with Korean language, and switched images also.
Any candidates for the cause of EOF error?

@lstk520
Copy link

lstk520 commented Jul 8, 2020

i have the same issue

@rkcosmos
Copy link
Contributor

rkcosmos commented Jul 8, 2020

I think model file is not downloaded successfully, update to last version (v1.1.2) and re-download file should fix the issue. If automatic download does not work for any reason, you can also download model file manually.

@snoop2head
Copy link
Contributor Author

Downloaded manually, and it works! But I switched from using poetry to pip though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants