eynollah


Nameeynollah JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/qurator-spk/eynollah
Summary
upload_time2023-05-15 15:35:50
maintainer
docs_urlNone
authorVahid Rezanezhad
requires_python
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements ocrd scikit-learn tensorflow imutils matplotlib setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Eynollah
> Document Layout Analysis (segmentation) using pre-trained models and heuristics

[![PyPI Version](https://img.shields.io/pypi/v/eynollah)](https://pypi.org/project/eynollah/)
[![CircleCI Build Status](https://circleci.com/gh/qurator-spk/eynollah.svg?style=shield)](https://circleci.com/gh/qurator-spk/eynollah)
[![GH Actions Test](https://github.com/qurator-spk/eynollah/actions/workflows/test-eynollah.yml/badge.svg)](https://github.com/qurator-spk/eynollah/actions/workflows/test-eynollah.yml)
[![License: ASL](https://img.shields.io/github/license/qurator-spk/eynollah)](https://opensource.org/license/apache-2-0/)

![](https://user-images.githubusercontent.com/952378/102350683-8a74db80-3fa5-11eb-8c7e-f743f7d6eae2.jpg)

## Features
* Support for up to 10 segmentation classes: 
  * background, [page border](https://ocr-d.de/en/gt-guidelines/trans/lyRand.html), [text region](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_TextRegionType.html), [text line](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_TextLineType.html), [header](https://ocr-d.de/en/gt-guidelines/trans/lyUeberschrift.html), [image](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_ImageRegionType.html), [separator](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_SeparatorRegionType.html), [marginalia](https://ocr-d.de/en/gt-guidelines/trans/lyMarginalie.html), [initial](https://ocr-d.de/en/gt-guidelines/trans/lyInitiale.html), [table](https://ocr-d.de/en/gt-guidelines/trans/lyTabellen.html)
* Support for various image optimization operations:
  * cropping (border detection), binarization, deskewing, dewarping, scaling, enhancing, resizing
* Text line segmentation to bounding boxes or polygons (contours) including for curved lines and vertical text
* Detection of reading order
* Output in [PAGE-XML](https://github.com/PRImA-Research-Lab/PAGE-XML)
* [OCR-D](https://github.com/qurator-spk/eynollah#use-as-ocr-d-processor) interface

## Installation
Python versions `3.7-3.10` with Tensorflow `>=2.4` are currently supported.

For (limited) GPU support the [matching](https://www.tensorflow.org/install/source#gpu) CUDA toolkit `>=10.1` needs to be installed.

You can either install via 

```
pip install eynollah
```

or clone the repository, enter it and install (editable) with

```
git clone git@github.com:qurator-spk/eynollah.git
cd eynollah; pip install -e .
```

Alternatively, you can run `make install` or `make install-dev` for editable installation.

## Models
Pre-trained models can be downloaded from [qurator-data.de](https://qurator-data.de/eynollah/).

In case you want to train your own model to use with Eynollah, have a look at [sbb_pixelwise_segmentation](https://github.com/qurator-spk/sbb_pixelwise_segmentation). 

## Usage
The command-line interface can be called like this:

```sh
eynollah \
  -i <image file> \
  -o <output directory> \
  -m <path to directory containing model files> \
     [OPTIONS]
```

The following options can be used to further configure the processing:

| option   |      description      |
|----------|:-------------|
| `-fl`  | full layout analysis including all steps and segmentation classes |
| `-light` | lighter and faster but simpler method for main region detection and deskewing |
| `-tab` | apply table detection |
| `-ae`  | apply enhancement (the resulting image is saved to the output directory) |
| `-as`  | apply scaling |
| `-cl`  | apply countour detection for curved text lines instead of bounding boxes |
| `-ib`  | apply binarization (the resulting image is saved to the output directory)  |
| `-ep`  | enable plotting (MUST always be used with `-sl`, `-sd`, `-sa`, `-si` or `-ae`) |
| `-ho`  | ignore headers for reading order dectection |
| `-di <directory>`  | process all images in a directory in batch mode |
| `-si <directory>`  | save image regions detected to this directory |
| `-sd <directory>`  | save deskewed image to this directory |
| `-sl <directory>`  | save layout prediction as plot to this directory |
| `-sp <directory>`  | save cropped page image to this directory |
| `-sa <directory>`  | save all (plot, enhanced/binary image, layout) to this directory |

If no option is set, the tool will perform layout detection of main regions (background, text, images, separators and marginals).
The tool produces better quality output when RGB images are used as input than greyscale or binarized images.

#### Use as OCR-D processor

Eynollah ships with a CLI interface to be used as [OCR-D](https://ocr-d.de) processor. 

In this case, the source image file group with (preferably) RGB images should be used as input like this:

```
ocrd-eynollah-segment -I OCR-D-IMG -O SEG-LINE -P models
```
    
Any image referenced by `@imageFilename` in PAGE-XML is passed on directly to Eynollah as a processor, so that e.g.

```
ocrd-eynollah-segment -I OCR-D-IMG-BIN -O SEG-LINE -P models
```
    
uses the original (RGB) image despite any binarization that may have occured in previous OCR-D processing steps

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/qurator-spk/eynollah",
    "name": "eynollah",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Vahid Rezanezhad",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b1/af/27d014795624f644127d94a8d3fe6a1dd676cbf8120898badee963e88bb6/eynollah-0.3.0.tar.gz",
    "platform": null,
    "description": "# Eynollah\n> Document Layout Analysis (segmentation) using pre-trained models and heuristics\n\n[![PyPI Version](https://img.shields.io/pypi/v/eynollah)](https://pypi.org/project/eynollah/)\n[![CircleCI Build Status](https://circleci.com/gh/qurator-spk/eynollah.svg?style=shield)](https://circleci.com/gh/qurator-spk/eynollah)\n[![GH Actions Test](https://github.com/qurator-spk/eynollah/actions/workflows/test-eynollah.yml/badge.svg)](https://github.com/qurator-spk/eynollah/actions/workflows/test-eynollah.yml)\n[![License: ASL](https://img.shields.io/github/license/qurator-spk/eynollah)](https://opensource.org/license/apache-2-0/)\n\n![](https://user-images.githubusercontent.com/952378/102350683-8a74db80-3fa5-11eb-8c7e-f743f7d6eae2.jpg)\n\n## Features\n* Support for up to 10 segmentation classes: \n  * background, [page border](https://ocr-d.de/en/gt-guidelines/trans/lyRand.html), [text region](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_TextRegionType.html), [text line](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_TextLineType.html), [header](https://ocr-d.de/en/gt-guidelines/trans/lyUeberschrift.html), [image](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_ImageRegionType.html), [separator](https://ocr-d.de/en/gt-guidelines/pagexml/pagecontent_xsd_Complex_Type_pc_SeparatorRegionType.html), [marginalia](https://ocr-d.de/en/gt-guidelines/trans/lyMarginalie.html), [initial](https://ocr-d.de/en/gt-guidelines/trans/lyInitiale.html), [table](https://ocr-d.de/en/gt-guidelines/trans/lyTabellen.html)\n* Support for various image optimization operations:\n  * cropping (border detection), binarization, deskewing, dewarping, scaling, enhancing, resizing\n* Text line segmentation to bounding boxes or polygons (contours) including for curved lines and vertical text\n* Detection of reading order\n* Output in [PAGE-XML](https://github.com/PRImA-Research-Lab/PAGE-XML)\n* [OCR-D](https://github.com/qurator-spk/eynollah#use-as-ocr-d-processor) interface\n\n## Installation\nPython versions `3.7-3.10` with Tensorflow `>=2.4` are currently supported.\n\nFor (limited) GPU support the [matching](https://www.tensorflow.org/install/source#gpu) CUDA toolkit `>=10.1` needs to be installed.\n\nYou can either install via \n\n```\npip install eynollah\n```\n\nor clone the repository, enter it and install (editable) with\n\n```\ngit clone git@github.com:qurator-spk/eynollah.git\ncd eynollah; pip install -e .\n```\n\nAlternatively, you can run `make install` or `make install-dev` for editable installation.\n\n## Models\nPre-trained models can be downloaded from [qurator-data.de](https://qurator-data.de/eynollah/).\n\nIn case you want to train your own model to use with Eynollah, have a look at [sbb_pixelwise_segmentation](https://github.com/qurator-spk/sbb_pixelwise_segmentation). \n\n## Usage\nThe command-line interface can be called like this:\n\n```sh\neynollah \\\n  -i <image file> \\\n  -o <output directory> \\\n  -m <path to directory containing model files> \\\n     [OPTIONS]\n```\n\nThe following options can be used to further configure the processing:\n\n| option   |      description      |\n|----------|:-------------|\n| `-fl`  | full layout analysis including all steps and segmentation classes |\n| `-light` | lighter and faster but simpler method for main region detection and deskewing |\n| `-tab` | apply table detection |\n| `-ae`  | apply enhancement (the resulting image is saved to the output directory) |\n| `-as`  | apply scaling |\n| `-cl`  | apply countour detection for curved text lines instead of bounding boxes |\n| `-ib`  | apply binarization (the resulting image is saved to the output directory)  |\n| `-ep`  | enable plotting (MUST always be used with `-sl`, `-sd`, `-sa`, `-si` or `-ae`) |\n| `-ho`  | ignore headers for reading order dectection |\n| `-di <directory>`  | process all images in a directory in batch mode |\n| `-si <directory>`  | save image regions detected to this directory |\n| `-sd <directory>`  | save deskewed image to this directory |\n| `-sl <directory>`  | save layout prediction as plot to this directory |\n| `-sp <directory>`  | save cropped page image to this directory |\n| `-sa <directory>`  | save all (plot, enhanced/binary image, layout) to this directory |\n\nIf no option is set, the tool will perform layout detection of main regions (background, text, images, separators and marginals).\nThe tool produces better quality output when RGB images are used as input than greyscale or binarized images.\n\n#### Use as OCR-D processor\n\nEynollah ships with a CLI interface to be used as [OCR-D](https://ocr-d.de) processor. \n\nIn this case, the source image file group with (preferably) RGB images should be used as input like this:\n\n```\nocrd-eynollah-segment -I OCR-D-IMG -O SEG-LINE -P models\n```\n    \nAny image referenced by `@imageFilename` in PAGE-XML is passed on directly to Eynollah as a processor, so that e.g.\n\n```\nocrd-eynollah-segment -I OCR-D-IMG-BIN -O SEG-LINE -P models\n```\n    \nuses the original (RGB) image despite any binarization that may have occured in previous OCR-D processing steps\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/qurator-spk/eynollah"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2372532cc392e228a8caaf7da7352b9963a22ada74f85db1907b232a51fd1a2c",
                "md5": "f510ff108b7c010ef6b8891b0ff11aed",
                "sha256": "3e4a87bc84ab875dc9072c721dc1409bb7a4584fc4b9dae0bf183ad2801df156"
            },
            "downloads": -1,
            "filename": "eynollah-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f510ff108b7c010ef6b8891b0ff11aed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 75563,
            "upload_time": "2023-05-15T15:35:48",
            "upload_time_iso_8601": "2023-05-15T15:35:48.703464Z",
            "url": "https://files.pythonhosted.org/packages/23/72/532cc392e228a8caaf7da7352b9963a22ada74f85db1907b232a51fd1a2c/eynollah-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1af27d014795624f644127d94a8d3fe6a1dd676cbf8120898badee963e88bb6",
                "md5": "c89f044e833b7550e6315d69eb9396df",
                "sha256": "baaf54b95b4530627af65d368335f31d9c8b7f8ed1f79807172b07c10730a301"
            },
            "downloads": -1,
            "filename": "eynollah-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c89f044e833b7550e6315d69eb9396df",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 70885,
            "upload_time": "2023-05-15T15:35:50",
            "upload_time_iso_8601": "2023-05-15T15:35:50.751335Z",
            "url": "https://files.pythonhosted.org/packages/b1/af/27d014795624f644127d94a8d3fe6a1dd676cbf8120898badee963e88bb6/eynollah-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-15 15:35:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "qurator-spk",
    "github_project": "eynollah",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "requirements": [
        {
            "name": "ocrd",
            "specs": [
                [
                    ">=",
                    "2.23.3"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "0.23.2"
                ]
            ]
        },
        {
            "name": "tensorflow",
            "specs": [
                [
                    ">=",
                    "2.4.0"
                ]
            ]
        },
        {
            "name": "imutils",
            "specs": [
                [
                    ">=",
                    "0.5.3"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "50"
                ]
            ]
        }
    ],
    "lcname": "eynollah"
}
        
Elapsed time: 0.06892s