Skip to content

Commit

Permalink
Merge branch 'feature/reading_order'
Browse files Browse the repository at this point in the history
  • Loading branch information
mittagessen committed Nov 14, 2023
2 parents 674a772 + 8a39a9a commit e9a699c
Show file tree
Hide file tree
Showing 55 changed files with 4,943 additions and 1,764 deletions.
1 change: 1 addition & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ requirements:
- pyarrow
- pytorch-lightning~=2.0
- torchmetrics>=1.1.0
- conda-forge::threadpoolctl~=3.2.0
- albumentations
- rich
about:
Expand Down
227 changes: 130 additions & 97 deletions docs/api_docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
API Reference
*************

Segmentation
============

kraken.blla module
==================
------------------

.. note::

Expand All @@ -14,7 +17,7 @@ kraken.blla module
.. autoapifunction:: kraken.blla.segment

kraken.pageseg module
=====================
---------------------

.. note::

Expand All @@ -24,150 +27,141 @@ kraken.pageseg module

.. autoapifunction:: kraken.pageseg.segment

kraken.rpred module
===================
Recognition
===========

.. autoapifunction:: kraken.rpred.bidi_record
kraken.rpred module
-------------------

.. autoapiclass:: kraken.rpred.mm_rpred
:members:

.. autoapiclass:: kraken.rpred.ocr_record
:members:

.. autoapifunction:: kraken.rpred.rpred

Serialization
=============

kraken.serialization module
===========================
---------------------------

.. autoapifunction:: kraken.serialization.render_report

.. autoapifunction:: kraken.serialization.serialize

.. autoapifunction:: kraken.serialization.serialize_segmentation

kraken.lib.models module
========================
Default templates
-----------------

.. autoapiclass:: kraken.lib.models.TorchSeqRecognizer
:members:
ALTO 4.4
^^^^^^^^

.. autoapifunction:: kraken.lib.models.load_any
.. literalinclude:: ../../templates/alto
:language: xml+jinja

kraken.lib.vgsl module
======================
PageXML
^^^^^^^

.. autoapiclass:: kraken.lib.vgsl.TorchVGSLModel
:members:
.. literalinclude:: ../../templates/alto
:language: xml+jinja

kraken.lib.xml module
=====================
hOCR
^^^^

.. autoapifunction:: kraken.lib.xml.parse_xml
.. literalinclude:: ../../templates/alto
:language: xml+jinja

.. autoapifunction:: kraken.lib.xml.parse_page
ABBYY XML
^^^^^^^^^

.. autoapifunction:: kraken.lib.xml.parse_alto
.. literalinclude:: ../../templates/abbyyxml
:language: xml+jinja

Containers and Helpers
======================

kraken.lib.codec module
=======================
-----------------------

.. autoapiclass:: kraken.lib.codec.PytorchCodec
:members:

kraken.lib.train module
=======================
kraken.containers module
------------------------

Training Schedulers
-------------------
.. autoapiclass:: kraken.containers.Segmentation
:members:

.. autoapiclass:: kraken.lib.train.TrainScheduler
:members:
.. autoapiclass:: kraken.containers.BaselineLine
:members:

.. autoapiclass:: kraken.lib.train.annealing_step
:members:
.. autoapiclass:: kraken.containers.BBoxLine
:members:

.. autoapiclass:: kraken.lib.train.annealing_const
:members:
.. autoapiclass:: kraken.containers.ocr_record
:members:

.. autoapiclass:: kraken.lib.train.annealing_exponential
:members:
.. autoapiclass:: kraken.containers.BaselineOCRRecord
:members:

.. autoapiclass:: kraken.lib.train.annealing_reduceonplateau
:members:
.. autoapiclass:: kraken.containers.BBoxOCRRecord
:members:

.. autoapiclass:: kraken.lib.train.annealing_cosine
:members:
.. autoapiclass:: kraken.containers.ProcessingStep
:members:

.. autoapiclass:: kraken.lib.train.annealing_onecycle
:members:
kraken.lib.ctc_decoder
----------------------

Training Stoppers
-----------------
.. autoapifunction:: kraken.lib.ctc_decoder.beam_decoder

.. autoapiclass:: kraken.lib.train.TrainStopper
:members:
.. autoapifunction:: kraken.lib.ctc_decoder.greedy_decoder

.. autoapiclass:: kraken.lib.train.EarlyStopping
:members:
.. autoapifunction:: kraken.lib.ctc_decoder.blank_threshold_decoder

.. autoapiclass:: kraken.lib.train.EpochStopping
:members:
kraken.lib.exceptions
---------------------

.. autoapiclass:: kraken.lib.train.NoStopping
.. autoapiclass:: kraken.lib.exceptions.KrakenCodecException
:members:

Loss and Evaluation Functions
-----------------------------

.. autoapifunction:: kraken.lib.train.recognition_loss_fn

.. autoapifunction:: kraken.lib.train.baseline_label_loss_fn

.. autoapifunction:: kraken.lib.train.recognition_evaluator_fn

.. autoapifunction:: kraken.lib.train.baseline_label_evaluator_fn

Trainer
-------

.. autoapiclass:: kraken.lib.train.KrakenTrainer
.. autoapiclass:: kraken.lib.exceptions.KrakenStopTrainingException
:members:

.. autoapiclass:: kraken.lib.exceptions.KrakenEncodeException
:members:

kraken.lib.dataset module
=========================

Datasets
--------
.. autoapiclass:: kraken.lib.exceptions.KrakenRecordException
:members:

.. autoapiclass:: kraken.lib.dataset.BaselineSet
.. autoapiclass:: kraken.lib.exceptions.KrakenInvalidModelException
:members:

.. autoapiclass:: kraken.lib.dataset.PolygonGTDataset
.. autoapiclass:: kraken.lib.exceptions.KrakenInputException
:members:

.. autoapiclass:: kraken.lib.dataset.GroundTruthDataset
.. autoapiclass:: kraken.lib.exceptions.KrakenRepoException
:members:

Helpers
-------
.. autoapiclass:: kraken.lib.exceptions.KrakenCairoSurfaceException
:members:

.. autoapifunction:: kraken.lib.dataset.compute_error
kraken.lib.models module
------------------------

.. autoapifunction:: kraken.lib.dataset.preparse_xml_data
.. autoapiclass:: kraken.lib.models.TorchSeqRecognizer
:members:

.. autoapifunction:: kraken.lib.dataset.generate_input_transforms
.. autoapifunction:: kraken.lib.models.load_any

kraken.lib.segmentation module
------------------------------

.. autoapifunction:: kraken.lib.segmentation.reading_order

.. autoapifunction:: kraken.lib.segmentation.polygonal_reading_order
.. autoapifunction:: kraken.lib.segmentation.neural_reading_order

.. autoapifunction:: kraken.lib.segmentation.denoising_hysteresis_thresh
.. autoapifunction:: kraken.lib.segmentation.polygonal_reading_order

.. autoapifunction:: kraken.lib.segmentation.vectorize_lines

Expand All @@ -181,43 +175,82 @@ kraken.lib.segmentation module

.. autoapifunction:: kraken.lib.segmentation.extract_polygons

kraken.lib.vgsl module
----------------------

kraken.lib.ctc_decoder
======================
.. autoapiclass:: kraken.lib.vgsl.TorchVGSLModel
:members:

.. autoapifunction:: kraken.lib.ctc_decoder.beam_decoder
kraken.lib.xml module
---------------------

.. autoapifunction:: kraken.lib.ctc_decoder.greedy_decoder
.. autoapiclass:: kraken.lib.xml.XMLPage

.. autoapifunction:: kraken.lib.ctc_decoder.blank_threshold_decoder
Training
========

kraken.lib.exceptions
=====================
kraken.lib.train module
-----------------------

.. autoapiclass:: kraken.lib.exceptions.KrakenCodecException
:members:
Loss and Evaluation Functions
-----------------------------

.. autoapiclass:: kraken.lib.exceptions.KrakenStopTrainingException
.. autoapifunction:: kraken.lib.train.recognition_loss_fn

.. autoapifunction:: kraken.lib.train.baseline_label_loss_fn

.. autoapifunction:: kraken.lib.train.recognition_evaluator_fn

.. autoapifunction:: kraken.lib.train.baseline_label_evaluator_fn

Trainer
-------

.. autoapiclass:: kraken.lib.train.KrakenTrainer
:members:

.. autoapiclass:: kraken.lib.exceptions.KrakenEncodeException

kraken.lib.dataset module
-------------------------

Recognition datasets
^^^^^^^^^^^^^^^^^^^^

.. autoapiclass:: kraken.lib.dataset.ArrowIPCRecognitionDataset
:members:

.. autoapiclass:: kraken.lib.exceptions.KrakenRecordException
.. autoapiclass:: kraken.lib.dataset.BaselineSet
:members:

.. autoapiclass:: kraken.lib.exceptions.KrakenInvalidModelException
.. autoapiclass:: kraken.lib.dataset.GroundTruthDataset
:members:

.. autoapiclass:: kraken.lib.exceptions.KrakenInputException
Segmentation datasets
^^^^^^^^^^^^^^^^^^^^^

.. autoapiclass:: kraken.lib.dataset.PolygonGTDataset
:members:

.. autoapiclass:: kraken.lib.exceptions.KrakenRepoException
Reading order datasets
^^^^^^^^^^^^^^^^^^^^^^

.. autoapiclass:: kraken.lib.dataset.PairWiseROSet
:members:

.. autoapiclass:: kraken.lib.exceptions.KrakenCairoSurfaceException
.. autoapiclass:: kraken.lib.dataset.PageWiseROSet
:members:

Helpers
^^^^^^^

.. autoapiclass:: kraken.lib.dataset.ImageInputTransforms
:members:

.. autoapifunction:: kraken.lib.dataset.collate_sequences

.. autoapifunction:: kraken.lib.dataset.global_align

.. autoapifunction:: kraken.lib.dataset.compute_confusions

Legacy modules
==============
Expand Down
2 changes: 1 addition & 1 deletion docs/ketos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ option action
-F, \--savefreq Model save frequency in epochs during
training
-q, \--quit Stop condition for training. Set to `early`
for early stopping (default) or `dumb` for fixed
for early stopping (default) or `fixed` for fixed
number of epochs.
-N, \--epochs Number of epochs to train for.
\--min-epochs Minimum number of epochs to train for when using early stopping.
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- pyarrow
- conda-forge::pytorch-lightning~=2.0.0
- conda-forge::torchmetrics>=1.1.0
- conda-forge::threadpoolctl~=3.2
- pip
- albumentations
- rich
Expand Down
1 change: 1 addition & 0 deletions environment_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies:
- pyarrow
- conda-forge::pytorch-lightning~=2.0.0
- conda-forge::torchmetrics>=1.1.0
- conda-forge::threadpoolctl~=3.2
- pip
- albumentations
- rich
Expand Down
Loading

0 comments on commit e9a699c

Please sign in to comment.