page-segmentation module for OCR-d
Introduction
This module implements a page segmentation algorithm based on a Fully Convolutional Network (FCN). The FCN creates a classification for each pixel in a binary image. This result is then segmented per class using XY cuts.
Requirements
- For GPU-Support: CUDA and CUDNN
- other requirements are installed via Makefile / pip, see
requirements.txtin repository root.
Installation
If you want to use GPU support, set the environment variable TENSORFLOW_GPU
to a nonempty value, otherwise leave it unset. Then:
make deps
to install dependencies and
make install
to install the package.
Both are python packages installed via pip, so you may want to activate a virtalenv before installing.
Usage
ocrd-pc-segmentation follows the ocrd CLI.
It expects a binary page image and produces region entries in the PageXML file.
Configuration
The following parameters are recognized in the JSON parameter file:
overwrite_regions: remove previously existing text regionsxheight: height of character "x" in pixels used during training.model: pixel-classifier model path. The special values__DEFAULT__and__LEGACY__load the bundled default model or previous default model respectively.gpu_allow_growth: required for GPU use with some graphic cards (set to true, if you get CUDNN_INTERNAL_ERROR)resize_height: scale down pixelclassifier output to this height before postprocessing. Independent of training / used model. (performance / quality tradeoff, defaults to 300)
Testing
There is a simple CLI test, that will run the tool on a single image from the assets repository.
make test-cli
Training
To train models for the pixel classifier, see its README
Release files for ocrd-pc-segmentation 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ocrd_pc_segmentation-0.2.3.tar.gz | 15.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ocrd_pc_segmentation-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.0 MB
Release files / ocrd_pc_segmentation-0.2.3.tar.gz
| Download URL | ocrd_pc_segmentation-0.2.3.tar.gz |
|---|---|
| Size | 15.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b6818be8a58709c07610a18069c77db3e37ddbe4a27acb5fedd45ebd14612c5
|
|
BLAKE2b-256 checksum How to use checksums |
c8e945889b7724f4ac06f8c34b7a73784f00acbd99e8c8a4a6eeca794d7155cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.7
|
Release files / ocrd_pc_segmentation-0.2.3-py3-none-any.whl
| Download URL | ocrd_pc_segmentation-0.2.3-py3-none-any.whl |
|---|---|
| Size | 15.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12f7bc0ece78dd7df7e0816e01013885ad458239902c560410c367008bf48fa2
|
|
BLAKE2b-256 checksum How to use checksums |
500a541404a7d0cb17a380a9d7cdb4b23e1848cc21e60ac53e75f1154c430c2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.7
|