File size: 2,223 Bytes
1b4ed07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 2026 AutomatosX
# SPDX-License-Identifier: AGPL-3.0-only
# Modified 2026-10-17 for v1.2; prior component notices are in NOTICE.
"""AX DocLayout: page-raster document structure detection.

The AXDocLayout-M v1.2 model contract is a layout detector: an RGB page
raster in, versioned JSON boxes out. The public API verifies the pinned
immutable Hub bundle before inference. ``LocalOnnxBundle`` is an
unqualified local runner pinned to the staged ONNX digest; it is not Hub load.
"""

from __future__ import annotations

from ax_doclayout.artifact import SOURCE_CHECKPOINT_SHA256, STAGED_ONNX_SHA256
from ax_doclayout.contract import (
    COORDINATE_SPACE,
    DETECTION_SCHEMA_VERSION,
    PREPROCESS_ID,
    TAXONOMY_ID,
    BoundingBox,
    Element,
    InvalidPageStructureError,
    ModelIdentity,
    PageImage,
    PageStructure,
)
from ax_doclayout.errors import (
    ArtifactUnavailableError,
    AXDocLayoutError,
    BackendUnavailableError,
    InferenceError,
    InvalidPageImageError,
    InvalidRevisionError,
)
from ax_doclayout.local_onnx import QUALIFICATION, LocalOnnxBundle, LocalOnnxResult
from ax_doclayout.model import AXDocLayout
from ax_doclayout.postprocess import (
    DEFAULT_SCORE_THRESHOLD,
    elements_from_letterbox_detections,
    page_structure_from_elements,
)
from ax_doclayout.preprocess import (
    Letterbox,
    inverse_letterbox_box,
    letterbox_page,
    letterbox_rgb,
)

__version__ = "1.2.0.post2"

__all__ = [
    "COORDINATE_SPACE",
    "DEFAULT_SCORE_THRESHOLD",
    "DETECTION_SCHEMA_VERSION",
    "PREPROCESS_ID",
    "QUALIFICATION",
    "SOURCE_CHECKPOINT_SHA256",
    "STAGED_ONNX_SHA256",
    "TAXONOMY_ID",
    "AXDocLayout",
    "AXDocLayoutError",
    "ArtifactUnavailableError",
    "BackendUnavailableError",
    "BoundingBox",
    "Element",
    "InferenceError",
    "InvalidPageImageError",
    "InvalidPageStructureError",
    "InvalidRevisionError",
    "Letterbox",
    "LocalOnnxBundle",
    "LocalOnnxResult",
    "ModelIdentity",
    "PageImage",
    "PageStructure",
    "__version__",
    "elements_from_letterbox_detections",
    "inverse_letterbox_box",
    "letterbox_page",
    "letterbox_rgb",
    "page_structure_from_elements",
]