File size: 2,598 Bytes
34f3bc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Dataset schema discovery — single source of truth for dataset layout.

Replaces the fragile `robot_type` -> constants dict lookup with a two-tier
chain (explicit meta/labvla_manifest.json > info.json `names` auto-infer)
that produces a frozen `DatasetSchema` object consumed by all downstream code.

See doc/schema_manifest.md for the manifest format and when each tier kicks in.
"""

from src.utils.constants import ACTION, OBS_IMAGES, OBS_STATE

from .dataset_schema import DatasetSchema
from .discovery import discover_schema
from .errors import (
    SchemaDiscoveryError,
    SchemaError,
    SchemaSpecError,
    SchemaValidationError,
)
from .registry import register, resolve, registered_names

# Blueprint: declarative authoring layer. New schemas should be written as
# SingleArmBlueprint(...).build() or MultiChannelBlueprint(...).build() —
# the compiler emits a DatasetSchema identical to hand-authored low-level
# form, but derives delta_mask / gripper_action_dims / arm_layout
# automatically from the high-level SingleArm spec.
from .annotation_loss import AnnotationLossSpec
from .arm_layout import ArmCount, ArmLayoutSpec
from .blueprint import (
    AnnotationSpec,
    MultiChannelBlueprint,
    SingleArm,
    SingleArmBlueprint,
    StateActionChannel,
)
from .camera_mapping import (
    expand_camera_mapping,
    expand_camera_source,
    expand_camera_target,
    infer_image_mapping_from_info,
    validate_camera_mapping,
)
from .merge_recipe import MergeRecipe, SourceArmLayout
from .validate import validate_arm_layout, validate_schema

__all__ = [
    # Constants re-exported from utils.constants so `from schema import
    # OBS_IMAGES` works without pulling the whole utils package.
    "ACTION",
    "OBS_IMAGES",
    "OBS_STATE",
    # Internal normalized form (still public for rare low-level authoring).
    "DatasetSchema",
    "SchemaError",
    "SchemaDiscoveryError",
    "SchemaSpecError",
    "SchemaValidationError",
    "discover_schema",
    "register",
    "resolve",
    "registered_names",
    # Declarative authoring (preferred entrypoint for new datasets).
    "AnnotationSpec",
    "AnnotationLossSpec",
    "ArmCount",
    "ArmLayoutSpec",
    "MergeRecipe",
    "MultiChannelBlueprint",
    "SingleArm",
    "SingleArmBlueprint",
    "SourceArmLayout",
    "StateActionChannel",
    # Camera mapping SSOT helpers.
    "expand_camera_mapping",
    "expand_camera_source",
    "expand_camera_target",
    "infer_image_mapping_from_info",
    "validate_camera_mapping",
    # Validators.
    "validate_arm_layout",
    "validate_schema",
]