Page segmentation and segmentation evaluation
Project description
ocrd_segment
This repository aims to provide a number of OCR-D compliant processors for layout analysis and evaluation.
Installation
In your Python virtual environment, run:
pip install ocrd_segment
Usage
Contains processors for various tasks:
- exporting segment images (including results from preprocessing like cropping/masking, deskewing, dewarping or binarization) along with polygon coordinates and metadata:
- ocrd-segment-extract-pages (for pages, also exports MS-COCO format and pageview plots)
- ocrd-segment-extract-regions (for regions, also exports MS-COCO format))
- ocrd-segment-extract-lines (for lines, also exports text and .xlsx)
- ocrd-segment-extract-words (for words, also exports text)
- ocrd-segment-extract-glyphs (for glyphs, also exports text)
- importing layout segmentations from other formats:
- ocrd-segment-from-masks (for mask/label images, i.e. semantic segmentation)
- ocrd-segment-from-coco (for MS-COCO annotation)
- post-processing or repairing layout segmentations:
- ocrd-segment-repair (validity and consistency of all coordinates; also, for regions, reduce overlaps/redundancy between neighbours, and/or simplify polygons, and/or shrink to the alpha shape of foreground contours)
- ocrd-segment-project (remake segment coordinates into the concave hull / alpha shape of their constituents)
- ocrd-segment-replace-original (rebase all segments on cropped+deskewed border frame as new full page)
- ocrd-segment-replace-page (2 input fileGrps; overwrite segmentation below page of first fileGrp by all segments of second fileGrp, rebasing all coordinates; "inverse" of
replace-original
) - ocrd-segment-replace-text (insert text below page from single-segment text files; "inverse" of
extract-*
)
- comparing different layout segmentations:
- ocrd-segment-evaluate :construction: (2 input fileGrps; align, compare and evaluate page segmentations; early stage)
- page-segment-evaluate (same with standalone CLI)
- pattern-based segmentation (input file groups N=1, based on a PAGE template, e.g. from Aletheia, and some XSLT or Python to apply it to the input file group)
ocrd-segment-via-template
:construction: (unpublished)
- data-driven segmentation (input file groups N=1, based on a statistical model, e.g. Neural Network)
ocrd-segment-via-model
:construction: (unpublished)
For detailed behaviour, see --help
on each processor CLI.
For detailed description on input/output and parameters, see ocrd-tool.json or --dump-json
on each processor CLI.
Testing
None yet.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ocrd_segment-0.1.22.tar.gz
(53.7 kB
view hashes)
Built Distribution
Close
Hashes for ocrd_segment-0.1.22-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 427c68011cde5ce56d816886c379b1914475015607cbe2ec343b4db24cd01fbb |
|
MD5 | c7fc2e0a69b7cd4ec391d6f04d66b237 |
|
BLAKE2b-256 | 1043c5ca29a41f8a6179635a320c6eb7db9f1b356dd706b8cca33f4dc8dc996a |