feat: Unified Ingest SDK for DMS/ADAS promote, cuboid export and 3D fit
Replace subprocess build with promote_batch SDK, add ADAS cuboid export/fit/validate pipeline, stage normalization, and offline unit tests wired into smoke_labeling_api. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
56
platform/as_platform/data/promote/base.py
Normal file
56
platform/as_platform/data/promote/base.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""Pack promote adapter base types."""
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass
|
||||
class PromoteContext:
|
||||
project: str
|
||||
task: str
|
||||
batch: str
|
||||
pack: str
|
||||
batch_dir: Path
|
||||
project_root: Path
|
||||
dry_run: bool = False
|
||||
skip_validate: bool = False
|
||||
allow_partial_3d: bool = False
|
||||
refresh: bool = True
|
||||
extra: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PromoteResult:
|
||||
ok: bool
|
||||
project: str
|
||||
task: str
|
||||
batch: str
|
||||
pack: str
|
||||
dest_path: str = ""
|
||||
images: int = 0
|
||||
labels: int = 0
|
||||
manifest_paths: list[str] = field(default_factory=list)
|
||||
warnings: list[str] = field(default_factory=list)
|
||||
stage: str = "ingested"
|
||||
detail: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
out = asdict(self)
|
||||
out["ok"] = self.ok
|
||||
return out
|
||||
|
||||
|
||||
class PackPromoteAdapter(ABC):
|
||||
project: str = ""
|
||||
|
||||
@abstractmethod
|
||||
def promote(self, ctx: PromoteContext) -> PromoteResult:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def validate(self, ctx: PromoteContext) -> list[str]:
|
||||
"""Return list of error messages; empty means pass."""
|
||||
raise NotImplementedError
|
||||
Reference in New Issue
Block a user