Python-based tools for document analysis and OCR

Related tags

Computer Visionocropy
Overview

ocropy

Build Status CircleCI Docker Automated build Docker Pulls license Wiki Join the chat at https://gitter.im/tmbdev/ocropy

OCRopus is a collection of document analysis programs, not a turn-key OCR system. In order to apply it to your documents, you may need to do some image preprocessing, and possibly also train new models.

In addition to the recognition scripts themselves, there are a number of scripts for ground truth editing and correction, measuring error rates, determining confusion matrices, etc. OCRopus commands will generally print a stack trace along with an error message; this is not generally indicative of a problem (in a future release, we'll suppress the stack trace by default since it seems to confuse too many users).

Installing

To install OCRopus dependencies system-wide:

$ sudo apt-get install $(cat PACKAGES)
$ wget -nd https://github.com/zuphilip/ocropy-models/raw/master/en-default.pyrnn.gz
$ mv en-default.pyrnn.gz models/
$ sudo python setup.py install

Alternatively, dependencies can be installed into a Python Virtual Environment:

$ virtualenv ocropus_venv/
$ source ocropus_venv/bin/activate
$ pip install -r requirements.txt
$ wget -nd https://github.com/zuphilip/ocropy-models/raw/master/en-default.pyrnn.gz
$ mv en-default.pyrnn.gz models/
$ python setup.py install

An additional method using Conda is also possible:

$ conda create -n ocropus_env python=2.7
$ conda activate ocropus_env
$ conda install --file requirements.txt
$ wget -nd https://github.com/zuphilip/ocropy-models/raw/master/en-default.pyrnn.gz
$ mv en-default.pyrnn.gz models/
$ python setup.py install

To test the recognizer, run:

$ ./run-test

Running

To recognize pages of text, you need to run separate commands: binarization, page layout analysis, and text line recognition. The default parameters and settings of OCRopus assume 300dpi binary black-on-white images. If your images are scanned at a different resolution, the simplest thing to do is to downscale/upscale them to 300dpi. The text line recognizer is fairly robust to different resolutions, but the layout analysis is quite resolution dependent.

Here is an example for a page of Fraktur text (German); you need to download the Fraktur model from https://github.com/zuphilip/ocropy-models/raw/master/fraktur.pyrnn.gz to run this example:

# perform binarization
./ocropus-nlbin tests/ersch.png -o book

# perform page layout analysis
./ocropus-gpageseg 'book/????.bin.png'

# perform text line recognition (on four cores, with a fraktur model)
./ocropus-rpred -Q 4 -m models/fraktur.pyrnn.gz 'book/????/??????.bin.png'

# generate HTML output
./ocropus-hocr 'book/????.bin.png' -o ersch.html

# display the output
firefox ersch.html

There are some things the currently trained models for ocropus-rpred will not handle well, largely because they are nearly absent in the current training data. That includes all-caps text, some special symbols (including "?"), typewriter fonts, and subscripts/superscripts. This will be addressed in a future release, and, of course, you are welcome to contribute new, trained models.

You can also generate training data using ocropus-linegen:

ocropus-linegen -t tests/tomsawyer.txt -f tests/DejaVuSans.ttf

This will create a directory "linegen/..." containing training data suitable for training OCRopus with synthetic data.

Roadmap


Project Announcements
The text line recognizer has been ported to C++ and is now a separate project, the CLSTM project, available here: https://github.com/tmbdev/clstm
New GPU-capable text line recognizers and deep-learning based layout analysis methods are in the works and will be published as separate projects some time in 2017.
Please welcome @zuphilip and @kba as additional project maintainers. @tmb is busy developing new DNN models for document analysis (among other things). (10/15/2016)

A lot of excellent packages have become available for deep learning, vision, and GPU computing over the last few years. At the same time, it has become feasible now to address problems like layout analysis and text line following through attentional and reinforcement learning mechanisms. I (@tmb) am planning on developing new software using these new tools and techniques for the traditional document analysis tasks. These will become available as separate projects.

Note that for text line recognition and language modeling, you can also use the CLSTM command line tools. Except for taking different command line options, they are otherwise drop-in replacements for the Python-based text line recognizer.

Contributing

OCRopy and CLSTM are both command line driven programs. The best way to contribute is to create new command line programs using the same (simple) persistent representations as the rest of OCRopus.

The biggest needs are in the following areas:

  • text/image segmentation
  • text line detection and extraction
  • output generation (hOCR and hOCR-to-* transformations)

CLSTM vs OCRopy

The CLSTM project (https://github.com/tmbdev/clstm) is a replacement for ocropus-rtrain and ocropus-rpred in C++ (it used to be a subproject of ocropy but has been moved into a separate project now). It is significantly faster than the Python versions and has minimal library dependencies, so it is suitable for embedding into C++ programs.

Python and C++ models can not be interchanged, both because the save file formats are different and because the text line normalization is slightly different. Error rates are about the same.

In addition, the C++ command line tool (clstmctc) has different command line options and currently requires loading training data into HDF5 files, instead of being trained off a list of image files directly (image file-based training will be added to clstmctc soon).

The CLSTM project also provides LSTM-based language modeling that works very well with post-processing and correcting OCR output, as well as solving a number of other OCR-related tasks, such as dehyphenation or changes in orthography (see our publications). You can train language models using clstmtext.

Generally, your best bet for CLSTM and OCRopy is to rely only on the command line tools; that makes it easy to replace different components. In addition, you should keep your OCR training data in .png/.gt.txt files so that you can easily retrain models as better recognizers become available.

After making CLSTM a full replacement for ocropus-rtrain/ocropus-rpred, the next step will be to replace the binarization, text/image segmentation, and layout analysis in OCRopus with trainable 2D LSTM models.

Comments
  • How to always read left to right?

    How to always read left to right?

    Hi guys,

    I've been developing a bit with Ocropy but it sometimes seems to read from top to bottom, I'd like it to always read from left to right, no matter what. Does anybody have any clue on how to do this?

    P.S: my apoligies for creating an issue for this.

    :grey_question: question 
    opened by Yenthe666 16
  • error while training

    error while training

    After executing (on 156 files of groundtruth text and imagery): ocropus-rtrain gt/????/*.png -F 10000 -o mub_combined & I've got the following reproduceable error:

    454 150.32 (1486, 48) gt/0001/01000b.bin.png TRU: u'quod dicitur Fulda, quod est situm in pago Grapfeld, constructum in honore sancti' ALN: u'quuod dicituur Fuulda, qquod et situumm in pagoo Grapfeld, construuctuuumm in honnore ' OUT: u' iiii ii te ti imm tm e iii eutmut m mi eii '

    oops, got FloatingPointError overflow encountered in exp

    Traceback (most recent call last): File "/usr/local/bin/ocropus-rtrain", line 228, in pcs = network.trainSequence(line,cs,update=do_update,key=fname) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 863, in trainSequence self.outputs = array(self.lstm.forward(xs)) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 587, in forward xs = net.forward(xs) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 636, in forward outputs = [net.forward(xs) for net in self.nets] File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 545, in forward self.WIP,self.WFP,self.WOP) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 419, in forward_py go[t] = ffunc(gox[t]) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 367, in ffunc return 1.0/(1.0+exp(-x)) FloatingPointError: overflow encountered in exp Traceback (most recent call last): File "/usr/local/bin/ocropus-rtrain", line 232, in network = ocrolib.load_object(last_save) File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 502, in load_object fname = ocropus_find_file(fname) File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 680, in ocropus_find_file if os.path.exists(fname): File "/usr/lib/python2.7/genericpath.py", line 18, in exists os.stat(path) TypeError: coercing to Unicode: need string or buffer, NoneType found

    another case with half of the files (dir 0001 only):

    960 110.63 (1490, 48) gt/0001/010022.bin.png TRU: u'in honorem\u2074 domini salvatoris Jesu Christi et beate Marie genetricis\u2075 eius episco-' ALN: u'in honorem~ domini salvatoris Jesu Christi et beate MMarie genetricis eius episco-' OUT: u'iu bouoreu ouiui salvatoris lesu bristi et beate arie geuetricis eius episoo-'

    oops, got FloatingPointError overflow encountered in exp

    Traceback (most recent call last): File "/usr/local/bin/ocropus-rtrain", line 228, in pcs = network.trainSequence(line,cs,update=do_update,key=fname) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 863, in trainSequence self.outputs = array(self.lstm.forward(xs)) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 587, in forward xs = net.forward(xs) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 636, in forward outputs = [net.forward(xs) for net in self.nets] File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 619, in forward return self.net.forward(xs[::-1])[::-1] File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 545, in forward self.WIP,self.WFP,self.WOP) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 419, in forward_py go[t] = ffunc(gox[t]) File "/usr/local/lib/python2.7/dist-packages/ocrolib/lstm.py", line 367, in ffunc return 1.0/(1.0+exp(-x)) FloatingPointError: overflow encountered in exp Traceback (most recent call last): File "/usr/local/bin/ocropus-rtrain", line 232, in network = ocrolib.load_object(last_save) File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 502, in load_object fname = ocropus_find_file(fname) File "/usr/local/lib/python2.7/dist-packages/ocrolib/common.py", line 680, in ocropus_find_file if os.path.exists(fname): File "/usr/lib/python2.7/genericpath.py", line 18, in exists os.stat(path) TypeError: coercing to Unicode: need string or buffer, NoneType found

    opened by stexandev 16
  • Is there a way to access confidence level?

    Is there a way to access confidence level?

    We are running it on some documents and we need absolute accuracy so we are using human proofreading, but is there any way to access confidence level so that we can just examine the ones with low confidence level?

    :sparkles: enhancement 
    opened by 1a1a11a 15
  • Higher error probability with first letter of line

    Higher error probability with first letter of line

    Expected Behavior

    Hallo. I am training Ocropus with the Hume dialogues pages. I am following a methodology of look ahead simulations. A trained model, starting with the default model, is applied to the Hume images, starting with page 8. Lines with errors are then picked as the training set and used to train the model. This is then applied to the pages that follow and so on. One thing I am observing is there are more errors with the first letter than a letter at any other position on a line. Is this expected or is it a bug or a deficiency?

    Current Behavior

    Expecting the error rate would be the same at any position of a line.

    Possible Solution

    Steps to Reproduce (for bugs)

    1. Download the Hume dialogs pages.
    2. Run Ocropus on these images (The image segmentation is easier starting page 8, so I started with that).
    3. Pick up lines that shows errors. Generate text files with fixed lines.
    4. Train Ocropus with the lines so produced.
    5. Repeat steps 2, 3 and 4, each time running Ocropus on subsequent pages.

    Your Environment

    • Python version: 2.7.10 for training, 2.7.6 while running on images
    • Git revision of ocropy: Not sure. I downloaded it 11 Feb 2017.
    • Operating System and version:
      for training Cray supercomputer, for running images bash on Ubuntu on windows 10
    :grey_question: question 
    opened by urhub 14
  • getting typeerror object of type 'NoneType' has no len()

    getting typeerror object of type 'NoneType' has no len()

    i am trying to ./runtest i am getting error saying

    $ ./run-test
    INFO:  # ./tests/testpage.png
    INFO:  === ./tests/testpage.png 1
    INFO:  estimating skew angle
    INFO:  estimating thresholds
    INFO:  rescaling
    INFO:  ./tests/testpage.png lo-hi (0.39 1.44) angle  0.1 no-normalization
    INFO:  writing
    INFO:
    INFO:  ########## C:/Users/allud/ocropy/env/Scripts/ocropus-gpageseg temp/????
    INFO:
    INFO:  temp\0001.bin.png
    INFO:  scale 19.493589
    INFO:  computing segmentation
    INFO:  computing column separators
    INFO:  considering at most 3 whitespace column separators
    INFO:  computing lines
    INFO:  propagating labels
    INFO:  spreading labels
    INFO:  number of lines 100
    INFO:  finding reading order
    INFO:  writing lines
    INFO:      91  temp\0001.bin.png 19.5 92
    INFO:
    INFO:  ########## C:/Users/allud/ocropy/env/Scripts/ocropus-rpred -n temp/????
    INFO:
    INFO:  #inputs: 92
    Traceback (most recent call last):
      File "C:/Users/allud/ocropy/env/Scripts/ocropus-rpred", line 120, in <module>
        network = ocrolib.load_object(args.model,verbose=1)
      File "c:\python27\Lib\ocrolib\common.py", line 435, in load_object
        fname = ocropus_find_file(fname)
      File "c:\python27\Lib\ocrolib\common.py", line 625, in ocropus_find_file
        sysconfig.get_config_var("datarootdir"), "ocropus"))
      File "C:\Users\allud\ocropy\env\lib\ntpath.py", line 65, in join
        result_drive, result_path = splitdrive(path)
      File "C:\Users\allud\ocropy\env\lib\ntpath.py", line 115, in splitdrive
        if len(p) > 1:
    TypeError: object of type 'NoneType' has no len()
    (env)
    

    please help.

    opened by CruzzRazor 12
  • Add new tags for older releases

    Add new tags for older releases

    Hi @kba, @zuphilip :smile:

    I suggest to add new tags for older releases: 0.5, 0.5.4, 0.6, 0.7 See: https://github.com/tmbdev/ocropy/wiki/Older-versions

    I also suggest to remove these confusing tags and to add new tags instead: classic-ocropy-0.1.1 => 0.7.2 / 0.8.1 classic-ocropy-0.1 => 0.7.1 / 0.8.0

    opened by amitdo 12
  • Not segmenting if image size is less than 600x600

    Not segmenting if image size is less than 600x600

    The first part of binarization is working correctly for my image.But in the segmentation step if both or one of the height or width is less than 600x600, ocropus segmentation is not segmenting the binarized image. Is it necessary to have image > = 600x600, because upsampling the image makes the ocr part miserable. And also why is this 600x600 limitation? I am giving a cropped input to ocropus, so resizing is a problem.

    opened by srika91 11
  • Updating the wiki

    Updating the wiki

    I am spending some hours on a class project to update Ocropy documentation. I would like to collect requests for documentation you want to see in the Wiki.

    Possible Solution

    Please add comments here what you would like to see added or changed to the documentation.

    :pencil2: documentation 
    opened by urhub 10
  • Travis CI builds

    Travis CI builds

    A very simple setup for testing via Travis. It uses Miniconda to install dependencies and then runs the test script. I originally tried a straight install, but compiling SciPy took so long, it ran out of build time. The conda install is much much quicker.

    You will of course have to enable Travis for your repo before this has a real effect. And it doesn't really check whether the result correct, only that something is produced, but that's how the existing test script is. One could also do coverage testing using the other script and coveralls.io, but that's something for a another PR.

    opened by QuLogic 10
  • Could you recommend some materials about the algorithm you use?

    Could you recommend some materials about the algorithm you use?

    Hi! I feel this project is very interesting and I want to learn from it. So could you recommend me some materials(papers or books) you referred in this project? Thank you very much

    opened by hsmyy 10
  • RuntimeError: could not open display

    RuntimeError: could not open display

    After installed on the command line CentOS server, when I try to run any OCRopus command, I get the following error:

    $ ./ocropus-nlbin -h
    Traceback (most recent call last):
     File "./ocropus-nlbin", line 5, in <module>
       from pylab import *
     File "/usr/lib64/python2.7/site-packages/pylab.py", line 1, in <module>
       from matplotlib.pylab import *
     File "/usr/lib64/python2.7/site-packages/matplotlib/pylab.py", line 265, in <module>
       from matplotlib.pyplot import *
     File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 97, in <module>
       _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
     File "/usr/lib64/python2.7/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
       globals(),locals(),[backend_name])
     File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
       from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
     File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 13, in <module>
       import gtk; gdk = gtk.gdk
     File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
       _init()
     File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
       _gtk.init_check()
    RuntimeError: could not open display
    
    

    Expected Behavior

    On my home Ubuntu within Gnome command line it works just fine.

    Current Behavior

    Possible Solution

    Steps to Reproduce (for bugs)

    1. Install on CentOS command-line only server (without display)
    2. Run any command, like $ ./ocropus-nlbin -h
    3. Get the error

    Your Environment

    • Python version: 2.7.5
    • Git revision of ocropy: commit 358df8d104cf78fb0104bd28f333f272d908d4c3 Merge: dacf0fc e016e74 Author: Philipp Zumstein [email protected] Date: Mon May 22 22:38:33 2017 +0200

      Merge pull request #219 from tmbdev/del-bbox-func

      Delete unused function bounding_box in ocropus-linegen

    • Operating System and version: CentOS Linux release 7.3.1611 (Core)

    :computer: installation 
    opened by vlad-wonderkidstudio 9
  • On-premise to cloud migration issue

    On-premise to cloud migration issue

    Expected Behavior

    Current Behavior

    Possible Solution

    Steps to Reproduce (for bugs)

    Your Environment

    • Python version:
    • Git revision of ocropy:
    • Operating System and version:
    opened by cristinelpopescu 0
  • I want to get 1,000 synthetically generated data? Where do i set the number of data's to be generated? Thanks

    I want to get 1,000 synthetically generated data? Where do i set the number of data's to be generated? Thanks

    Expected Behavior

    Current Behavior

    Possible Solution

    Steps to Reproduce (for bugs)

    Your Environment

    • Python version:
    • Git revision of ocropy:
    • Operating System and version:
    opened by marutcomp 0
  • EOF error with cpickle.Unpickler in common.py

    EOF error with cpickle.Unpickler in common.py

    I am trying to run the very basic example found in the README file.

    I reached the following line:

    ./ocropus-rpred -Q 4 -m models/fraktur.pyrnn.gz 'book/0001/010001.bin.png'
    

    But it gives me the following error:

    INFO:
    INFO:  ########## ./ocropus-rpred -Q 4 -m models/fraktur.pyrnn.gz book/0001/01
    INFO:
    INFO:  #inputs: 1
    # loading object .\.\models/fraktur.pyrnn.gz
    Traceback (most recent call last):
      File "./ocropus-rpred", line 120, in <module>
        network = ocrolib.load_object(args.model,verbose=1)
      File "C:\Users\96171\Desktop\ocropy\ocrolib\common.py", line 445, in load_object
        return unpickler.load()
    EOFError
    
    

    The error is appearing in the following function from common.py:

    def load_object(fname,zip=0,nofind=0,verbose=0):
        """Loads an object from disk. By default, this handles zipped files
        and searches in the usual places for OCRopus. It also handles some
        class names that have changed."""
        if not nofind:
            fname = ocropus_find_file(fname)
        if verbose:
            print("# loading object", fname)
        if zip==0 and fname.endswith(".gz"):
            zip = 1
        if zip>0:
            # with gzip.GzipFile(fname,"rb") as stream:
            with os.popen("gunzip < '%s'"%fname,"rb") as stream:
                unpickler = cPickle.Unpickler(stream)
                unpickler.find_global = unpickle_find_global
                return unpickler.load()
        else:
            with open(fname,"rb") as stream:
                unpickler = cPickle.Unpickler(stream)
                unpickler.find_global = unpickle_find_global
                return unpickler.load()
    
    opened by hiyamgh 2
  • AssertionError: you must install and use OCRopus with Python version 2.7 or later, but not Python 3.x

    AssertionError: you must install and use OCRopus with Python version 2.7 or later, but not Python 3.x

    I have used Python 2.7 virtual environment for installing requirements.txt But I got the following:

    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:380: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      SNIMissingWarning,
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:139: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      InsecurePlatformWarning,
    WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/numpy/
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:139: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      InsecurePlatformWarning,
    WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/numpy/
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:139: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      InsecurePlatformWarning,
    WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/numpy/
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:139: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      InsecurePlatformWarning,
    WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/numpy/
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:139: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      InsecurePlatformWarning,
    WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/numpy/
    Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:139: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      InsecurePlatformWarning,
    ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
    ERROR: No matching distribution found for numpy
    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping
    C:\Users\User\venv\ocropus\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:139: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
      InsecurePlatformWarning,
    (ocropus)
    

    So I ended up using Pythn 3.6.

    I was able with python 3.6 to install requirements.txt but when I try now to install setu.py I get the following error:

    AssertionError: you must install and use OCRopus with Python version 2.7 or later, but not Python 3.x
    

    So how can I use python 2.7 and I'm not able to install the requirements.txt for it ?

    opened by hiyamgh 7
  • Trying to test out ocropus from sources

    Trying to test out ocropus from sources

    Trying to just try out OCRopus on some files that tesseract fails (badly) on.

    I download the zip file from github, and expand it into /tmp/ocropus. Then following README.md,

    1. I make sure all the packages in PACKAGES are installed. This is a Fedora 30 system, so it uses dnf, not apt-get, but all the packages are there.

    2. I use wget to get 83826134 Nov 2 2014 en-default.pyrnn.gz

    3. I then try to move to models/:

    /tmp/ocropus > mv en-default.pyrnn.gz models/ mv: cannot move 'en-default.pyrnn.gz' to 'models/': Not a directory

    so to correct this, I: /tmp/ocropus > mkdir models models created /tmp/ocropus > mv en-default.pyrnn.gz models/ /tmp/ocropus > ls models 83826134 en-default.pyrnn.gz

    1. I don't want to install in /usr/bin, since I just want to try it, but let's let is go to see what happens:

    python setup.py install running install running build running build_py error: package directory 'ocrolib' does not exist

    1. Another missing directory, so mkdir ocrolib, and try again

    Now we get, in a much longer set of messages:

    package init file 'ocrolib/init.py' not found (or not a regular file) ...

    warning: install_lib: 'build/lib' does not exist -- no Python modules to install

    and finally:

    copying build/scripts-2.7/ocropus-gated-train -> /usr/bin error: [Errno 13] Permission denied: '/usr/bin/ocropus-gated-train'

    Now trying to test,

    /tmp/ocropus > ./run-test Traceback (most recent call last): File "./ocropus-nlbin", line 15, in import ocrolib ImportError: No module named ocrolib

    but we have a directory ocrolib/, but it is empty.

    Possible Solution

    Your Environment

    • Python version: Python 2.7.17
    • Git revision of ocropy: fatal: not a git repository (or any of the parent directories): .git

    • Operating System and version: Fedora Linux 30

    opened by crazylyle 0
Releases(v1.3.3)
  • v1.3.3(Dec 16, 2017)

  • v1.3.2(Dec 16, 2017)

    Added:

    • Add -f/--file option to ocropus-rtrain to read input filenames from a file #275

    Fixed:

    • Do not add $datarootdir/ocropus to model search path in windows #268

    Changed:

    • Use numpy functions instead of C implementations of sumprod/sumouter #265 #276
    • Code and docs for on-the-fly compilation of C code removed #274
    • Remove unused lru function annotaiton #273
    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Dec 9, 2017)

    Python coding:

    • Standardize Imports - Part I, #176 #206
    • split functions from nlbin #244

    Other features:

    • Clip exponential in ffunc to avoid overflow #201
    • Ignored empty lines in fonts list file #233
    • Change checks for write_page_segmentation #220 (allow also small images for segmentation)
    • Expand tests for coverage and CI

    Bugfixing: #251, #252

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Dec 9, 2017)

    Testing, continuous integration:

    • Test page workflow and confidence measure, update coverage test #145
    • circle.yml file for Circle CI testing, run-test-ci #149
    • Travis CI builds #37
    • Unit tests #209

    Python coding:

    • Cleanup imports in common.py, lstm.py, extract exceptions #154
    • py3k: Use print function instead of statement #155
    • py3k: Use new-style exceptions. #175

    Other features:

    • Fix behaviour of maxcolseps parameter in ocropus-gpageseg # 172
    • Update characters for training #188
    • Print summaries to stdout instead of stderr #170

    Bugfixing: #133, #131, #179, #218 Cleanup: #180, #207, #181, #216, #219 Documentation: #185, #193, #194, #196, #205, #217

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Dec 9, 2017)

    • Improve installation process: #108, #110, #111, #117, #146, #148, #152
    • Add new option --probabilities in ocropus-rpred #135
    • Fix and improve hocr metadata: #105, #160

    Bugfixing: #103, #123, #140 Cleanup: #84, #124, #143, #150, #156 Documentation: #120

    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Dec 9, 2017)

    New feature:

    • Added better print methods for distinguishing between info and error messages #53

    Bugfixing and cleanup: #40, #43, #44, #75, #76

    Expand documentations: #34, #39

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Dec 9, 2017)

    New features:

    • Connect to CLSTM training and recognition
    • Added ocropus-lpred
    • Added ocropus-ltrain
    • Added ocropus-dewarp
    • Added ocropus-linegen
    • Added Apache license
    • Allow "extract" outside original image bounds #19

    Documentation:

    • Add solution for OS X (clang) #28
    • Add instructions for installing ocropy into a virtualenv #29

    Reorganization:

    • Updated download path for models
    • moved ocropus-gtedit back to main directory

    Bugfixing

    Source code(tar.gz)
    Source code(zip)
  • v1.0(Nov 2, 2014)

    A cleaned up version of OCRopy with everything but the new RNN recognizer retired.

    Library files that aren't needed anymore have been removed (actually, moved into OLD for the time being).

    The installation process has been simplified.

    A simple example of training has been added.

    Source code(tar.gz)
    Source code(zip)
  • v0.8.1(Nov 1, 2014)

  • v0.8.0(Nov 1, 2014)

    This release contains the segmenting recognizer, language modeling, beam search, tree-VQ recognizer, and LSTM recognizer, plus character database editing tools. This was part of the OCRopus release as of late 2013.

    Source code(tar.gz)
    Source code(zip)
Owner
OCRopus
The OCRopus OCR System and Related Software
OCRopus
Controlling the computer volume with your hands // OpenCV

HandsControll-AI Controlling the computer volume with your hands // OpenCV Step 1 git clone https://github.com/Hayk-21/HandsControll-AI.git pip instal

Hayk 1 Nov 04, 2021
かの有名なあの東方二次創作ソング、「bad apple!」のMVをPythonでやってみたって話

bad apple!! 内容 このプログラムは、bad apple!(feat. nomico)のPVをPythonを用いて再現しよう!という内容です。 実はYoutube並びにGithub上に似たようなプログラムがあったしなんならそっちの方が結構良かったりするんですが、一応公開しますw 使い方 こ

赤紫 8 Jan 05, 2023
This is a GUI for scrapping PDFs with the help of optical character recognition making easier than ever to scrape PDFs.

pdf-scraper-with-ocr With this tool I am aiming to facilitate the work of those who need to scrape PDFs either by hand or using tools that doesn't imp

Jacobo José Guijarro Villalba 75 Oct 21, 2022
Developed an AI-based system to control the mouse cursor using Python and OpenCV with the real-time camera.

Developed an AI-based system to control the mouse cursor using Python and OpenCV with the real-time camera. Fingertip location is mapped to RGB images to control the mouse cursor.

Ravi Sharma 71 Dec 20, 2022
Deep learning based page layout analysis

Deep Learning Based Page Layout Analyze This is a Python implementaion of page layout analyze tool. The goal of page layout analyze is to segment page

186 Dec 29, 2022
A tool combining EasyOCR and LaMa to automatically detect text and replace it with an inpainted background.

EasyLaMa (WIP) This is a tool combining EasyOCR and LaMa to automatically detect text and replace it with an inpainted background. Installation For GP

3 Sep 17, 2022
Resizing Canny Countour In Python

Resizing_Canny_Countour Install Visual Studio Code , https://code.visualstudio.com/download Select Python and install with terminal( pip install openc

Walter Ng 1 Nov 07, 2021
Image Smoothing and Blurring Using OpenCV

Image-Smoothing-and-Blurring-Using-OpenCV This repository contains codes for performing image smoothing and blurring using OpenCV. There are different

Happy N. Monday 3 Feb 15, 2022
This pyhton script converts a pdf to Image then using tesseract as OCR engine converts Image to Text

Script_Convertir_PDF_IMG_TXT Este script de pyhton convierte un pdf en Imagen luego utilizando tesseract como motor OCR convierte la Imagen a Texto. p

alebogado 1 Jan 27, 2022
PyTorch Re-Implementation of EAST: An Efficient and Accurate Scene Text Detector

Description This is a PyTorch Re-Implementation of EAST: An Efficient and Accurate Scene Text Detector. Only RBOX part is implemented. Using dice loss

365 Dec 20, 2022
An advanced 2D image manipulation with features such as edge detection and image segmentation built using OpenCV

OpenCV-ToothPaint3-Advanced-Digital-Image-Editor This application named ‘Tooth Paint’ version TP_2020.3 (64-bit) or version 3 was developed within a w

JunHong 1 Nov 05, 2021
Python library to extract tabular data from images and scanned PDFs

Overview ExtractTable - API to extract tabular data from images and scanned PDFs The motivation is to make it easy for developers to extract tabular d

Org. Account 165 Dec 31, 2022
PyQT5 app that colorize black & white pictures using CNN(use pre-trained model which was made with OpenCV)

About PyQT5 app that colorize black & white pictures using CNN(use pre-trained model which was made with OpenCV) Colorizor Приложение для проекта Yand

1 Apr 04, 2022
Creating a virtual tv using opencv in python3.

Virtual-TV Creating a virtual tv using opencv in python3. In order to run the code follow the below given steps: Make sure the desired videos which ar

Vamsi 1 Jan 01, 2022
code for our ICCV 2021 paper "DeepCAD: A Deep Generative Network for Computer-Aided Design Models"

DeepCAD This repository provides source code for our paper: DeepCAD: A Deep Generative Network for Computer-Aided Design Models Rundi Wu, Chang Xiao,

Rundi Wu 85 Dec 31, 2022
An expandable and scalable OCR pipeline

Overview Nidaba is the central controller for the entire OGL OCR pipeline. It oversees and automates the process of converting raw images into citable

81 Jan 04, 2023
Extract tables from scanned image PDFs using Optical Character Recognition.

ocr-table This project aims to extract tables from scanned image PDFs using Optical Character Recognition. Install Requirements Tesseract OCR sudo apt

Abhijeet Singh 209 Dec 06, 2022
A small C++ implementation of LSTM networks, focused on OCR.

clstm CLSTM is an implementation of the LSTM recurrent neural network model in C++, using the Eigen library for numerical computations. Status and sco

Tom 794 Dec 30, 2022
Code for the paper "Controllable Video Captioning with an Exemplar Sentence"

SMCG Code for the paper "Controllable Video Captioning with an Exemplar Sentence" Introduction We investigate a novel and challenging task, namely con

10 Dec 04, 2022
A Screen Translator/OCR Translator made by using Python and Tesseract, the user interface are made using Tkinter. All code written in python.

About An OCR translator tool. Made by me by utilizing Tesseract, compiled to .exe using pyinstaller. I made this program to learn more about python. I

Fauzan F A 41 Dec 30, 2022