Git Product home page Git Product logo

russian-ocr's Introduction

Russian OCR (an exercise project)

Status: I haven't touched this project since the course ended. Even though the method seems promising, it currently has a overfitting problem because the generator generates too simple training data. So if you want to improve upon this, start from improving the training data generator.

Installation and dependencies

Dependencies are managed with pipenv.

The first you need is a text file of Russian text. This model was trained with this Russian News Corpus, which you can get from here. You can also download the generated training data from here

The code to compare against Tesseract is located in test directory. To run it, you need to install Tesseract 4 properly. See this for more information.

A pretrained model can be downloaded from Google Drive

Running

The model can be trained at Google Colaboratory.

Once you have installed the pipenv dependencies, you can activate the virtualenv with:

pipenv shell

To make a prediction on your own machine, run predict.py like following:

python predict.py --model <path/to/model> predict_this.png

NOTE: The input must be a grayscale image with the height of 32 pixels. While compare_tesseract.py and the training cannot handle JPEG files, they should work fine with predict.py.

To generate training data yourself

To run automated comparison against Tesseract, go to test directory, and run the following:

python compare_tesseract.py -m <path/to/model> <input_directory>

The content of the directory can be generated with

Each image in the input_directory must be a PNG file, and must have a corresponding .gt.txt file, which contains the ground truth. For example, if there exists an image with the name 1.png, there must also be a file 1.gt.txt.

License

Apache 2.0

russian-ocr's People

Contributors

wlinna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.