This OCR reader can read captchas automatically and provide performance metrics like levenshtein distance, character error rate and word error rate.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
This project provides a wrapper around a pre-trained OCR reader from EasyOCR open source python package.
Please install all the files in the requirements.txt with
pip install -r requirements.txt
You may install the requirements in your existing environment, but it is highly recommended to install a virtual environment to prevent version clash in your other projects.
There are two classes in this repository. The inference class is called "Captcha" and can be instantiated using
import reader
reader_captcha = reader.Captcha()
You can call the inference method using
reader_captcha(path_img, path_save)
,where
path_img
is the path to the captcha file and
path_save
is the path to where you want your predictions to be saved.
NOTE: please use the .txt file extension to save your predictions.
To calculate the levenshtein distance, character error rate and word error rate, first import the test script:
import test
Then, instantiate the Tester class with the list of the predicted .txt files and the list of the ground truth files:
tester = test.Tester(list_pred, list_gt)
Then call the
tester.all_metrics()
method. This will return the levenshtein distance, character error rate and word error rate respectively.
- Add training function.
- Add automatic train/test/validation split.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License.
Haris Cheong - @twitter_handle - [email protected]
Project Link: https://github.com/harischeong/captcha_reader
I have learnt so much from these repositories the last few hours, please feel free to peruse their repository for a rich source of information about OCR.