vkit.pipeline

  1# Copyright 2022 vkit-x Administrator. All Rights Reserved.
  2#
  3# This project (vkit-x/vkit) is dual-licensed under commercial and SSPL licenses.
  4#
  5# The commercial license gives you the full rights to create and distribute software
  6# on your own terms without any SSPL license obligations. For more information,
  7# please see the "LICENSE_COMMERCIAL.txt" file.
  8#
  9# This project is also available under Server Side Public License (SSPL).
 10# The SSPL licensing is ideal for use cases such as open source projects with
 11# SSPL distribution, student/academic purposes, hobby projects, internal research
 12# projects without external distribution, or other projects where all SSPL
 13# obligations can be met. For more information, please see the "LICENSE_SSPL.txt" file.
 14from .interface import (
 15    PipelineStep,
 16    PipelineStepFactory,
 17    PipelineStepCollectionFactory,
 18    PipelineState,
 19    PipelinePostProcessor,
 20    PipelinePostProcessorFactory,
 21    PipelineRunRngStateOutput,
 22    Pipeline,
 23)
 24from .pool import PipelinePool
 25
 26# Text detection.
 27from .text_detection.page_shape import (
 28    page_shape_step_factory,
 29    PageShapeStepConfig,
 30    PageShapeStepInput,
 31    PageShapeStepOutput,
 32    PageShapeStep,
 33)
 34from .text_detection.page_background import (
 35    page_background_step_factory,
 36    PageBackgroundStepConfig,
 37    PageBackgroundStepInput,
 38    PageBackgroundStepOutput,
 39    PageBackgroundStep,
 40)
 41from .text_detection.page_layout import (
 42    page_layout_step_factory,
 43    PageLayoutStepConfig,
 44    PageLayoutStepInput,
 45    PageLayout,
 46    PageLayoutStepOutput,
 47    PageLayoutStep,
 48)
 49from .text_detection.page_image import (
 50    page_image_step_factory,
 51    PageImageStepConfig,
 52    PageImageStepInput,
 53    PageImageCollection,
 54    PageImageStepOutput,
 55    PageImageStep,
 56)
 57from .text_detection.page_barcode import (
 58    page_barcode_step_factory,
 59    PageBarcodeStepConfig,
 60    PageBarcodeStepInput,
 61    PageBarcodeStepOutput,
 62    PageBarcodeStep,
 63)
 64from .text_detection.page_seal_impression import (
 65    page_seal_impresssion_step_factory,
 66    PageSealImpresssionStepConfig,
 67    PageSealImpresssionStepInput,
 68    PageSealImpresssionStepOutput,
 69    PageSealImpresssionStep,
 70)
 71from .text_detection.page_text_line import (
 72    page_text_line_step_factory,
 73    PageTextLineStepConfig,
 74    PageTextLineStepInput,
 75    PageTextLineCollection,
 76    PageTextLineStepOutput,
 77    PageTextLineStep,
 78)
 79from .text_detection.page_non_text_symbol import (
 80    page_non_text_symbol_step_factory,
 81    PageNonTextSymbolStepConfig,
 82    PageNonTextSymbolStepInput,
 83    PageNonTextSymbolStepOutput,
 84    PageNonTextSymbolStep,
 85)
 86from .text_detection.page_text_line_bounding_box import (
 87    page_text_line_bounding_box_step_factory,
 88    PageTextLineBoundingBoxStepConfig,
 89    PageTextLineBoundingBoxStepInput,
 90    PageTextLineBoundingBoxStepOutput,
 91    PageTextLineBoundingBoxStep,
 92)
 93from .text_detection.page_text_line_label import (
 94    page_text_line_label_step_factory,
 95    PageTextLineLabelStepConfig,
 96    PageTextLineLabelStepInput,
 97    PageCharPolygonCollection,
 98    PageTextLinePolygonCollection,
 99    PageTextLineLabelStepOutput,
100    PageTextLineLabelStep,
101)
102from .text_detection.page_assembler import (
103    page_assembler_step_factory,
104    PageAssemblerStepConfig,
105    PageAssemblerStepInput,
106    Page,
107    PageAssemblerStepOutput,
108    PageAssemblerStep,
109)
110from .text_detection.page_distortion import (
111    page_distortion_step_factory,
112    PageDistortionStepConfig,
113    PageDistortionStepInput,
114    PageDistortionStepOutput,
115    PageDistortionStep,
116)
117from .text_detection.page_resizing import (
118    page_resizing_step_factory,
119    PageResizingStepConfig,
120    PageResizingStepInput,
121    PageResizingStepOutput,
122    PageResizingStep,
123)
124from .text_detection.page_cropping import (
125    page_cropping_step_factory,
126    PageCroppingStepConfig,
127    PageCroppingStepInput,
128    CroppedPage,
129    PageCroppingStepOutput,
130    PageCroppingStep,
131)
132from .text_detection.page_text_region import (
133    page_text_region_step_factory,
134    PageTextRegionStepConfig,
135    PageTextRegionStepInput,
136    PageTextRegionStepOutput,
137    PageTextRegionStep,
138)
139from .text_detection.page_text_region_label import (
140    page_text_region_label_step_factory,
141    PageTextRegionLabelStepConfig,
142    PageTextRegionLabelStepInput,
143    PageCharRegressionLabelTag,
144    PageCharRegressionLabel,
145    PageTextRegionLabelStepOutput,
146    PageTextRegionLabelStep,
147)
148from .text_detection.page_text_region_cropping import (
149    page_text_region_cropping_step_factory,
150    PageTextRegionCroppingStepConfig,
151    PageTextRegionCroppingStepInput,
152    CroppedPageTextRegion,
153    PageTextRegionCroppingStepOutput,
154    PageTextRegionCroppingStep,
155)
156
157# Registry.
158pipeline_step_collection_factory = PipelineStepCollectionFactory()
159
160pipeline_step_collection_factory.register_step_factories(
161    'text_detection',
162    [
163        page_shape_step_factory,
164        page_background_step_factory,
165        page_layout_step_factory,
166        page_image_step_factory,
167        page_barcode_step_factory,
168        page_seal_impresssion_step_factory,
169        page_text_line_step_factory,
170        page_non_text_symbol_step_factory,
171        page_text_line_bounding_box_step_factory,
172        page_text_line_label_step_factory,
173        page_assembler_step_factory,
174        page_distortion_step_factory,
175        page_resizing_step_factory,
176        page_cropping_step_factory,
177        page_text_region_step_factory,
178        page_text_region_label_step_factory,
179        page_text_region_cropping_step_factory,
180    ],
181)