Skip to content

Creating a OCR reader for automatic captcha to string in Python using EasyOCR package.

Notifications You must be signed in to change notification settings

harischeong/captcha_reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Contributors LinkedIn


Logo

Captcha reader

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
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

This project provides a wrapper around a pre-trained OCR reader from EasyOCR open source python package.

(back to top)

Built With

  • Python

(back to top)

Getting Started

Please install all the files in the requirements.txt with

pip install -r requirements.txt

Prerequisites

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.

(back to top)

Usage

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.

Metrics

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.

(back to top)

Roadmap

  • Add training function.
  • Add automatic train/test/validation split.

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License.

(back to top)

Contact

Haris Cheong - @twitter_handle - [email protected]

Project Link: https://github.com/harischeong/captcha_reader

(back to top)

Acknowledgments

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.

(back to top)

About

Creating a OCR reader for automatic captcha to string in Python using EasyOCR package.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages