Skip to content

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rkcosmos committed Jan 5, 2021
1 parent 1af0603 commit 0b67787
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 37 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
Ready-to-use OCR with 70+ languages supported including Chinese, Japanese, Korean and Thai.

## What's new
- 5 January 2021 - Version 1.2.2
- Add `optimal_num_chars` to `detect` method. If specified, bounding boxes with estimated number of characters near this value are returned first. (thanks [@adamfrees](https://github.com/adamfrees))
- Add `rotation_info` to `readtext` method. Allow EasyOCR to rotate each text box and return the one with the best confident score. Eligible values are 90, 180 and 270. For example, try [90, 180 ,270] for all possible text orientations. (thanks [@mijoo308](https://github.com/mijoo308))
- Update [documentation](https://www.jaided.ai/easyocr/documentation).
- 17 November 2020 - Version 1.2
- New language supports for Telugu and Kannada. These are experimental lite recognition models. Their file sizes are only around 7% of other models and they are ~6x faster at inference with CPU.
- 12 October 2020 - Version 1.1.10
Expand Down
2 changes: 1 addition & 1 deletion easyocr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .easyocr import Reader

__version__ = '1.2.1'
__version__ = '1.2.2'
72 changes: 37 additions & 35 deletions easyocr/easyocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,24 @@ def __init__(self, lang_list, gpu=True, model_storage_directory=None,
# check and download detection model
corrupt_msg = 'MD5 hash mismatch, possible file corruption'
detector_path = os.path.join(self.model_storage_directory, DETECTOR_FILENAME)
if os.path.isfile(detector_path) == False:
if not self.download_enabled:
raise FileNotFoundError("Missing %s and downloads disabled" % detector_path)
LOGGER.warning('Downloading detection model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg
LOGGER.info('Download complete')
elif calculate_md5(detector_path) != model_url['detector'][1]:
if not self.download_enabled:
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % detector_path)
LOGGER.warning(corrupt_msg)
os.remove(detector_path)
LOGGER.warning('Re-downloading the detection model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg
if detector:
if os.path.isfile(detector_path) == False:
if not self.download_enabled:
raise FileNotFoundError("Missing %s and downloads disabled" % detector_path)
LOGGER.warning('Downloading detection model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg
LOGGER.info('Download complete')
elif calculate_md5(detector_path) != model_url['detector'][1]:
if not self.download_enabled:
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % detector_path)
LOGGER.warning(corrupt_msg)
os.remove(detector_path)
LOGGER.warning('Re-downloading the detection model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg

# recognition model
separator_list = {}
Expand Down Expand Up @@ -197,24 +198,25 @@ def __init__(self, lang_list, gpu=True, model_storage_directory=None,

model_path = os.path.join(self.model_storage_directory, model_file)
# check recognition model file
if os.path.isfile(model_path) == False:
if not self.download_enabled:
raise FileNotFoundError("Missing %s and downloads disabled" % model_path)
LOGGER.warning('Downloading recognition model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
LOGGER.info('Download complete.')
elif calculate_md5(model_path) != model_url[model_file][1]:
if not self.download_enabled:
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % model_path)
LOGGER.warning(corrupt_msg)
os.remove(model_path)
LOGGER.warning('Re-downloading the recognition model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
LOGGER.info('Download complete')
if recognizer:
if os.path.isfile(model_path) == False:
if not self.download_enabled:
raise FileNotFoundError("Missing %s and downloads disabled" % model_path)
LOGGER.warning('Downloading recognition model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
LOGGER.info('Download complete.')
elif calculate_md5(model_path) != model_url[model_file][1]:
if not self.download_enabled:
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % model_path)
LOGGER.warning(corrupt_msg)
os.remove(model_path)
LOGGER.warning('Re-downloading the recognition model, please wait. '
'This may take several minutes depending upon your network connection.')
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
LOGGER.info('Download complete')

self.lang_char = []
for lang in lang_list:
Expand Down
6 changes: 6 additions & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
- 5 January 2021 - Version 1.2.2
- Add `optimal_num_chars` to `detect` method. If specified, bounding boxes with estimated number of characters near this value are returned first. (thanks [@adamfrees](https://github.com/adamfrees))
- Add `rotation_info` to `readtext` method. Allow EasyOCR to rotate each text box and return the one with the best confident score. Eligible values are 90, 180 and 270. For example, try [90, 180 ,270] for all possible text orientations. (thanks [@mijoo308](https://github.com/mijoo308))
- Update [documentation](https://www.jaided.ai/easyocr/documentation).
- 24 November 2020 - Version 1.2.1
- Preparation for user-created models
- 17 November 2020 - Version 1.2
- New language supports for Telugu and Kannada. These are experimental lite recognition models. Their file sizes are only around 7% of other models and they are ~6x faster at inference with CPU.
- 12 October 2020 - Version 1.1.10
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def readme():
name='easyocr',
packages=['easyocr'],
include_package_data=True,
version='1.2.1',
version='1.2.2',
install_requires=requirements,
entry_points={"console_scripts": ["easyocr= easyocr.cli:main"]},
license='Apache License 2.0',
Expand Down

0 comments on commit 0b67787

Please sign in to comment.