Skip to content

Commit 0b67787

Browse files
committed
v1.2.2
1 parent 1af0603 commit 0b67787

File tree

5 files changed

+49
-37
lines changed

5 files changed

+49
-37
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
Ready-to-use OCR with 70+ languages supported including Chinese, Japanese, Korean and Thai.
1010

1111
## What's new
12+
- 5 January 2021 - Version 1.2.2
13+
- 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))
14+
- 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))
15+
- Update [documentation](https://www.jaided.ai/easyocr/documentation).
1216
- 17 November 2020 - Version 1.2
1317
- 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.
1418
- 12 October 2020 - Version 1.1.10

easyocr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .easyocr import Reader
22

3-
__version__ = '1.2.1'
3+
__version__ = '1.2.2'

easyocr/easyocr.py

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,24 @@ def __init__(self, lang_list, gpu=True, model_storage_directory=None,
7575
# check and download detection model
7676
corrupt_msg = 'MD5 hash mismatch, possible file corruption'
7777
detector_path = os.path.join(self.model_storage_directory, DETECTOR_FILENAME)
78-
if os.path.isfile(detector_path) == False:
79-
if not self.download_enabled:
80-
raise FileNotFoundError("Missing %s and downloads disabled" % detector_path)
81-
LOGGER.warning('Downloading detection model, please wait. '
82-
'This may take several minutes depending upon your network connection.')
83-
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
84-
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg
85-
LOGGER.info('Download complete')
86-
elif calculate_md5(detector_path) != model_url['detector'][1]:
87-
if not self.download_enabled:
88-
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % detector_path)
89-
LOGGER.warning(corrupt_msg)
90-
os.remove(detector_path)
91-
LOGGER.warning('Re-downloading the detection model, please wait. '
92-
'This may take several minutes depending upon your network connection.')
93-
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
94-
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg
78+
if detector:
79+
if os.path.isfile(detector_path) == False:
80+
if not self.download_enabled:
81+
raise FileNotFoundError("Missing %s and downloads disabled" % detector_path)
82+
LOGGER.warning('Downloading detection model, please wait. '
83+
'This may take several minutes depending upon your network connection.')
84+
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
85+
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg
86+
LOGGER.info('Download complete')
87+
elif calculate_md5(detector_path) != model_url['detector'][1]:
88+
if not self.download_enabled:
89+
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % detector_path)
90+
LOGGER.warning(corrupt_msg)
91+
os.remove(detector_path)
92+
LOGGER.warning('Re-downloading the detection model, please wait. '
93+
'This may take several minutes depending upon your network connection.')
94+
download_and_unzip(model_url['detector'][0], DETECTOR_FILENAME, self.model_storage_directory)
95+
assert calculate_md5(detector_path) == model_url['detector'][1], corrupt_msg
9596

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

198199
model_path = os.path.join(self.model_storage_directory, model_file)
199200
# check recognition model file
200-
if os.path.isfile(model_path) == False:
201-
if not self.download_enabled:
202-
raise FileNotFoundError("Missing %s and downloads disabled" % model_path)
203-
LOGGER.warning('Downloading recognition model, please wait. '
204-
'This may take several minutes depending upon your network connection.')
205-
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
206-
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
207-
LOGGER.info('Download complete.')
208-
elif calculate_md5(model_path) != model_url[model_file][1]:
209-
if not self.download_enabled:
210-
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % model_path)
211-
LOGGER.warning(corrupt_msg)
212-
os.remove(model_path)
213-
LOGGER.warning('Re-downloading the recognition model, please wait. '
214-
'This may take several minutes depending upon your network connection.')
215-
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
216-
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
217-
LOGGER.info('Download complete')
201+
if recognizer:
202+
if os.path.isfile(model_path) == False:
203+
if not self.download_enabled:
204+
raise FileNotFoundError("Missing %s and downloads disabled" % model_path)
205+
LOGGER.warning('Downloading recognition model, please wait. '
206+
'This may take several minutes depending upon your network connection.')
207+
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
208+
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
209+
LOGGER.info('Download complete.')
210+
elif calculate_md5(model_path) != model_url[model_file][1]:
211+
if not self.download_enabled:
212+
raise FileNotFoundError("MD5 mismatch for %s and downloads disabled" % model_path)
213+
LOGGER.warning(corrupt_msg)
214+
os.remove(model_path)
215+
LOGGER.warning('Re-downloading the recognition model, please wait. '
216+
'This may take several minutes depending upon your network connection.')
217+
download_and_unzip(model_url[model_file][0], model_file, self.model_storage_directory)
218+
assert calculate_md5(model_path) == model_url[model_file][1], corrupt_msg
219+
LOGGER.info('Download complete')
218220

219221
self.lang_char = []
220222
for lang in lang_list:

releasenotes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
- 5 January 2021 - Version 1.2.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))
3+
- 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))
4+
- Update [documentation](https://www.jaided.ai/easyocr/documentation).
5+
- 24 November 2020 - Version 1.2.1
6+
- Preparation for user-created models
17
- 17 November 2020 - Version 1.2
28
- 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.
39
- 12 October 2020 - Version 1.1.10

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def readme():
1717
name='easyocr',
1818
packages=['easyocr'],
1919
include_package_data=True,
20-
version='1.2.1',
20+
version='1.2.2',
2121
install_requires=requirements,
2222
entry_points={"console_scripts": ["easyocr= easyocr.cli:main"]},
2323
license='Apache License 2.0',

0 commit comments

Comments
 (0)