forked from ocropus-archive/DUP-ocropy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
94 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,3 @@ | ||
To install, use: | ||
|
||
$ sudo apt-get install $(cat PACKAGES) | ||
$ python setup.py download_models | ||
$ sudo python setup.py install | ||
|
||
To test the recognizer, run: | ||
|
||
$ ./run-test | ||
|
||
OCRopus is really a collection of document analysis programs, not a turn-key OCR system. | ||
|
||
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). | ||
|
||
To recognize pages of text, you need to run separate commands: binarization, page layout | ||
analysis, and text line recognition. | ||
|
||
# perform binarization | ||
./ocoropus-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 also a number of older commands for text line recognition, | ||
layout analysis, etc., kept for backwards compatibility. The binarization | ||
and layout analysis commands of the current release will be replaced in | ||
the next release with entirely new, trainable commands. | ||
|
||
The main feature of this release is ocropus-rpred, which achieves very | ||
low error rates on a wide variety of fonts and inputs (even degraded) | ||
of body text, even without language models or dictionaries. The model | ||
has been trained on UW3 and UNLV data. Test set error on UW3 is | ||
about 0.5% without a language model or dictionary. | ||
|
||
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. | ||
This directory contains a lot of old Python code. This code isn't generally | ||
runnable anymore, but it's still included (for the time being) because bits | ||
and pieces may be useful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
To install, use: | ||
|
||
$ sudo apt-get install $(cat PACKAGES) | ||
$ python setup.py download_models | ||
$ sudo python setup.py install | ||
|
||
To test the recognizer, run: | ||
|
||
$ ./run-test | ||
|
||
OCRopus is really a collection of document analysis programs, not a turn-key OCR system. | ||
|
||
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). | ||
|
||
To recognize pages of text, you need to run separate commands: binarization, page layout | ||
analysis, and text line recognition. | ||
|
||
# perform binarization | ||
./ocoropus-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 also a number of older commands for text line recognition, | ||
layout analysis, etc., kept for backwards compatibility. The binarization | ||
and layout analysis commands of the current release will be replaced in | ||
the next release with entirely new, trainable commands. | ||
|
||
The main feature of this release is ocropus-rpred, which achieves very | ||
low error rates on a wide variety of fonts and inputs (even degraded) | ||
of body text, even without language models or dictionaries. The model | ||
has been trained on UW3 and UNLV data. Test set error on UW3 is | ||
about 0.5% without a language model or dictionary. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash -e | ||
|
||
rm -rf .coverage | ||
rm -rf .coverage.* | ||
rm -rf temp | ||
python -m coverage run -p ocropus-nlbin tests/testpage.png -o temp | ||
python -m coverage run -p ocropus-gpageseg 'temp/????.bin.png' | ||
python -m coverage run -p ocropus-rpred -n 'temp/????/??????.bin.png' | ||
python -m coverage run -p ocropus-hocr 'temp/????.bin.png' -o temp.html | ||
python -m coverage run -p ocropus-visualize-results temp | ||
python -m coverage run -p ocropus-gtedit html temp/????/??????.bin.png -o temp-correction.html | ||
python -m coverage run -p ocropus-rpred tests/0079-01000d.png | ||
python -m coverage run -p ocropus-errs tests/0079-01000d.gt.txt | ||
python -m coverage run -p ocropus-econf tests/0079-01000d.gt.txt | ||
python -m coverage merge | ||
rm -rf htmlcov | ||
python -m coverage html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash -ex | ||
|
||
tar -zxvf tests/uw3-500.tgz | ||
ocropus-rtrain 'book/*/*.bin.png' -d 5 -o uw3-500-model |