Model application

This section explains how to apply a model on unknown (i.e. unannotated) pages and generate only predictions (no evaluations). Since this is a special case of testing, the test command is reused for this purpose.

Initialize new project

Ocropus only works on binarized line images. Therefore, you first have to initialize a new project from the new pages via convert and burst.

Run ocrocis convert --help and ocrocis burst --help to see how to initialize a new project from PDFs or image files.

Apply model on project

Applying a model to a project works just like testing. Just skip the next and train commands and go right to the testing.

ocrocis predict --book --model [FILE] [OPTIONS] [PAGE-NUMBER...]

The --book switch is an alias for --dir ./book. It tells Ocrocis that you want to test on the unannotated book repository. Since it is unannotated, only predictions are computed, not evaluations.

All other options are the same as in testing (see ocrocis predict --help).

If you do not specify the project home via --home, make sure you are within the newly initialized project directory.

If you use Docker, make sure the model you want to use is in the current directory or below. Copy it there if necessary.

If you do not specify an external model, a model from the same project is infered.

Examples

ocrocis predict --book
ocrocis predict --book {1..3}
ocrocis predict --book --verbose --model some-model-from-another-project.pyrnn.gz
ocrocis predict --book --verbose --model iterations/02/models
ocrocis predict --book --verbose --model iterations/02/models/model-00010000.pyrnn.gz
ocrocis predict --book --verbose --model iterations/02/models/model-00010000.pyrnn.gz {1..3}