semvec/pypi-packages huggingface dataset:
ocrd-pc-segmentation 0.2.3
pixel-classifier based page segmentation

# 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](https://developer.nvidia.com/cuda-downloads) and
  [CUDNN](https://developer.nvidia.com/cudnn)
- other requirements are installed via Makefile / pip, see `requirements.txt`
  in 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:

```bash
make deps
```

to install dependencies and

```sh
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](https://ocr-d.github.io/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 regions
- `xheight`: 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](https://github.com/ocr-d-modul-2-segmentierung/page-segmentation/blob/master/README.md)
modernize 0.9rc0
A hack on top of fissix (lib2to3 fork) for modernizing code for hybrid codebases.
Requires Python: ~=3.6

::

    Python           _              _        
       _ __  ___  __| |___ _ _ _ _ (_)______ 
      | '  \/ _ \/ _` / -_) '_| ' \| |_ / -_)
      |_|_|_\___/\__,_\___|_| |_||_|_/__\___|


.. image:: https://img.shields.io/coveralls/github/PyCQA/modernize?label=coveralls&logo=coveralls
    :alt: Coveralls
    :target: https://coveralls.io/github/PyCQA/modernize
.. image:: https://img.shields.io/readthedocs/modernize?logo=read-the-docs
    :alt: Read the Docs
    :target: https://modernize.readthedocs.io/en/latest/
.. image:: https://img.shields.io/github/workflow/status/PyCQA/modernize/CI?label=GitHub%20Actions&logo=github
    :alt: GitHub Actions
    :target: https://github.com/PyCQA/modernize
.. image:: https://img.shields.io/pypi/v/modernize?logo=pypi
    :alt: PyPI
    :target: https://pypi.org/project/modernize/

This library is a very thin wrapper around `fissix
<https://github.com/jreese/fissix>`_, a fork of lib2to3, to utilize it
to make Python 2 code more modern with the intention of eventually
porting it over to Python 3.

The ``python -m modernize`` command works like
``python -m fissix``, see `fissix <https://github.com/jreese/fissix>`_.
Here's how you'd rewrite a
single file::

    python -m modernize -w example.py

It does not guarantee, but it attempts to spit out a codebase compatible
with Python 2.6+ or Python 3. The code that it generates has a runtime
dependency on `six <https://pypi.python.org/pypi/six>`_, unless the
``--no-six`` option is used. Version 1.9.0 or later of ``six`` is
recommended. Some of the fixers output code that is not compatible with
Python 2.5 or lower.

**Documentation:** `modernize.readthedocs.io
<https://modernize.readthedocs.io/>`_.

See the ``LICENSE`` file for the license of ``modernize``.
Using this tool does not affect licensing of the modernized code.