ocrd-segment


Nameocrd-segment JSON
Version 0.1.24 PyPI version JSON
download
home_pagehttps://github.com/OCR-D/ocrd_segment
SummaryPage segmentation and segmentation evaluation
upload_time2024-04-25 15:40:54
maintainerNone
docs_urlNone
authorKonstantin Baierer, Kay-Michael Würzner, Robert Sachunsky
requires_pythonNone
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements ocrd shapely scikit-image numpy xlsxwriter rapidfuzz opencv-python-headless ocrd-fork-pycocotools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ocrd_segment

This repository aims to provide a number of [OCR-D](https://ocr-d.de) [compliant](https://ocr-d.de/en/spec) [processors](https://ocr-d.de/en/spec/cli) for layout analysis and evaluation.

[![CircleCI](https://dl.circleci.com/status-badge/img/gh/OCR-D/ocrd_segment/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/OCR-D/ocrd_segment/tree/master)
[![image](https://img.shields.io/pypi/v/ocrd_segment.svg)](https://pypi.org/project/ocrd_segment/)
[![Docker Automated build](https://img.shields.io/docker/automated/ocrd/segment.svg)](https://hub.docker.com/r/ocrd/segment/tags/)

## Installation

In your [Python virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/), 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](ocrd_segment/extract_pages.py) (for pages, also exports [MS-COCO](https://cocodataset.org/) format and pageview plots)
  - [ocrd-segment-extract-regions](ocrd_segment/extract_regions.py) (for regions, so exports [MS-COCO](https://cocodataset.org/) format))
  - [ocrd-segment-extract-lines](ocrd_segment/extract_lines.py) (for lines, also exports text and .xlsx)
  - [ocrd-segment-extract-words](ocrd_segment/extract_words.py) (for words, also exports text)
  - [ocrd-segment-extract-glyphs](ocrd_segment/extract_glyphs.py) (for glyphs, also exports text)
- importing layout segmentations from other formats:
  - [ocrd-segment-from-masks](ocrd_segment/import_image_segmentation.py) (for mask/label images, i.e. semantic segmentation)
  - [ocrd-segment-from-coco](ocrd_segment/import_coco_segmentation.py) (for [MS-COCO](https://cocodataset.org/) annotation)
- post-processing or repairing layout segmentations:
  - [ocrd-segment-repair](ocrd_segment/repair.py) (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](ocrd_segment/project.py) (remake segment coordinates into the concave hull / alpha shape of their constituents)
  - [ocrd-segment-replace-original](ocrd_segment/replace_original.py) (rebase all segments on cropped+deskewed border frame as new full page)
  - [ocrd-segment-replace-page](ocrd_segment/replace_page.py) (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](ocrd_segment/replace_text.py) (insert text below page from single-segment text files; "inverse" of `extract-*`)
- comparing different layout segmentations:
  - [ocrd-segment-evaluate](ocrd_segment/evaluate.py) :construction: (2 input fileGrps; align, compare and evaluate page segmentations; early stage)
  - [page-segment-evaluate](ocrd_segment/evaluate.py) (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](ocrd_segment/ocrd-tool.json) or `--dump-json` on each processor CLI.

## Development

### Prerequisities

Requires `libgeos-dev` library for building `shapely` binary requirement, see [Shapely Installation from source](https://shapely.readthedocs.io/en/stable/installation.html#installation-from-source-with-custom-geos-libary). Please ensure it's available before trying to install local requirements.

## Testing

None yet.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OCR-D/ocrd_segment",
    "name": "ocrd-segment",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Konstantin Baierer, Kay-Michael W\u00fcrzner, Robert Sachunsky",
    "author_email": "unixprog@gmail.com, wuerzner@gmail.com, sachunsky@informatik.uni-leipzig.de",
    "download_url": "https://files.pythonhosted.org/packages/4b/01/bd598397db82e075a9fcc7591d098160d1facfb3c7be55d7cfeea46e3392/ocrd_segment-0.1.24.tar.gz",
    "platform": null,
    "description": "# ocrd_segment\n\nThis repository aims to provide a number of [OCR-D](https://ocr-d.de) [compliant](https://ocr-d.de/en/spec) [processors](https://ocr-d.de/en/spec/cli) for layout analysis and evaluation.\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/OCR-D/ocrd_segment/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/OCR-D/ocrd_segment/tree/master)\n[![image](https://img.shields.io/pypi/v/ocrd_segment.svg)](https://pypi.org/project/ocrd_segment/)\n[![Docker Automated build](https://img.shields.io/docker/automated/ocrd/segment.svg)](https://hub.docker.com/r/ocrd/segment/tags/)\n\n## Installation\n\nIn your [Python virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/), run:\n\n    pip install ocrd_segment\n\n## Usage\n\nContains processors for various tasks:\n\n- exporting segment images (including results from preprocessing like cropping/masking, deskewing, dewarping or binarization) along with polygon coordinates and metadata:\n  - [ocrd-segment-extract-pages](ocrd_segment/extract_pages.py) (for pages, also exports [MS-COCO](https://cocodataset.org/) format and pageview plots)\n  - [ocrd-segment-extract-regions](ocrd_segment/extract_regions.py) (for regions, so exports [MS-COCO](https://cocodataset.org/) format))\n  - [ocrd-segment-extract-lines](ocrd_segment/extract_lines.py) (for lines, also exports text and .xlsx)\n  - [ocrd-segment-extract-words](ocrd_segment/extract_words.py) (for words, also exports text)\n  - [ocrd-segment-extract-glyphs](ocrd_segment/extract_glyphs.py) (for glyphs, also exports text)\n- importing layout segmentations from other formats:\n  - [ocrd-segment-from-masks](ocrd_segment/import_image_segmentation.py) (for mask/label images, i.e. semantic segmentation)\n  - [ocrd-segment-from-coco](ocrd_segment/import_coco_segmentation.py) (for [MS-COCO](https://cocodataset.org/) annotation)\n- post-processing or repairing layout segmentations:\n  - [ocrd-segment-repair](ocrd_segment/repair.py) (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)\n  - [ocrd-segment-project](ocrd_segment/project.py) (remake segment coordinates into the concave hull / alpha shape of their constituents)\n  - [ocrd-segment-replace-original](ocrd_segment/replace_original.py) (rebase all segments on cropped+deskewed border frame as new full page)\n  - [ocrd-segment-replace-page](ocrd_segment/replace_page.py) (2 input fileGrps; overwrite segmentation below page of first fileGrp by all segments of second fileGrp, rebasing all coordinates; \"inverse\" of `replace-original`)\n  - [ocrd-segment-replace-text](ocrd_segment/replace_text.py) (insert text below page from single-segment text files; \"inverse\" of `extract-*`)\n- comparing different layout segmentations:\n  - [ocrd-segment-evaluate](ocrd_segment/evaluate.py) :construction: (2 input fileGrps; align, compare and evaluate page segmentations; early stage)\n  - [page-segment-evaluate](ocrd_segment/evaluate.py) (same with standalone CLI)\n- 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)\n  - `ocrd-segment-via-template` :construction: (unpublished)\n- data-driven segmentation (input file groups N=1, based on a statistical model, e.g. Neural Network)  \n  - `ocrd-segment-via-model` :construction: (unpublished)\n\nFor detailed behaviour, see `--help` on each processor CLI.\nFor detailed description on input/output and parameters, see [ocrd-tool.json](ocrd_segment/ocrd-tool.json) or `--dump-json` on each processor CLI.\n\n## Development\n\n### Prerequisities\n\nRequires `libgeos-dev` library for building `shapely` binary requirement, see [Shapely Installation from source](https://shapely.readthedocs.io/en/stable/installation.html#installation-from-source-with-custom-geos-libary). Please ensure it's available before trying to install local requirements.\n\n## Testing\n\nNone yet.\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Page segmentation and segmentation evaluation",
    "version": "0.1.24",
    "project_urls": {
        "Homepage": "https://github.com/OCR-D/ocrd_segment"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "66622e7bb113ff69bfeaf4525a90e393b5bcebdf86fadc74b7c498cde69a23fd",
                "md5": "8b20674715e28d6caa051a351f1212c9",
                "sha256": "28fa5428c47761c8c602cd949859675afc007f095fc595cf6cf6f0f17d270b5d"
            },
            "downloads": -1,
            "filename": "ocrd_segment-0.1.24-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8b20674715e28d6caa051a351f1212c9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 64322,
            "upload_time": "2024-04-25T15:40:53",
            "upload_time_iso_8601": "2024-04-25T15:40:53.466258Z",
            "url": "https://files.pythonhosted.org/packages/66/62/2e7bb113ff69bfeaf4525a90e393b5bcebdf86fadc74b7c498cde69a23fd/ocrd_segment-0.1.24-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b01bd598397db82e075a9fcc7591d098160d1facfb3c7be55d7cfeea46e3392",
                "md5": "ea25a846502e5ce473833feaf5b982d4",
                "sha256": "3de0a3d56f652044557d7de5272572f44cb16b183e55cf9c6e1be63fcd66ee2e"
            },
            "downloads": -1,
            "filename": "ocrd_segment-0.1.24.tar.gz",
            "has_sig": false,
            "md5_digest": "ea25a846502e5ce473833feaf5b982d4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 56277,
            "upload_time": "2024-04-25T15:40:54",
            "upload_time_iso_8601": "2024-04-25T15:40:54.900640Z",
            "url": "https://files.pythonhosted.org/packages/4b/01/bd598397db82e075a9fcc7591d098160d1facfb3c7be55d7cfeea46e3392/ocrd_segment-0.1.24.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-25 15:40:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OCR-D",
    "github_project": "ocrd_segment",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [
        {
            "name": "ocrd",
            "specs": [
                [
                    ">=",
                    "2.20.0"
                ]
            ]
        },
        {
            "name": "shapely",
            "specs": [
                [
                    ">=",
                    "2.0"
                ]
            ]
        },
        {
            "name": "scikit-image",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "xlsxwriter",
            "specs": []
        },
        {
            "name": "rapidfuzz",
            "specs": []
        },
        {
            "name": "opencv-python-headless",
            "specs": []
        },
        {
            "name": "ocrd-fork-pycocotools",
            "specs": []
        }
    ],
    "lcname": "ocrd-segment"
}
        
Elapsed time: 0.28982s