feat(perception): integrate vegetation policy review
This commit is contained in:
@@ -93,12 +93,33 @@ def build_vegetation_shadow_lab_router(
|
||||
candidate = _resolve_candidate(root_provider, result_id)
|
||||
manifest = _read_verified(candidate)
|
||||
route_video = manifest.get("route_video")
|
||||
if not isinstance(route_video, dict) or not 0 <= sequence < 4489:
|
||||
if (
|
||||
not isinstance(route_video, dict)
|
||||
or route_video.get("frame_count") != 4489
|
||||
or not 0 <= sequence < 4489
|
||||
):
|
||||
raise HTTPException(status_code=404, detail="Vegetation video mask not found")
|
||||
archive = route_video.get("mask_archive")
|
||||
if not isinstance(archive, dict) or archive.get("path") != "video/ddrnet-semantic-masks.zip":
|
||||
archive_relative = archive.get("path") if isinstance(archive, dict) else None
|
||||
if not isinstance(archive_relative, str):
|
||||
raise HTTPException(status_code=404, detail="Vegetation video mask not found")
|
||||
archive_path = candidate / "video" / "ddrnet-semantic-masks.zip"
|
||||
relative = PurePosixPath(archive_relative)
|
||||
if (
|
||||
relative.is_absolute()
|
||||
or str(relative) != archive_relative
|
||||
or any(part in {"", ".", ".."} for part in relative.parts)
|
||||
or relative.suffix != ".zip"
|
||||
):
|
||||
raise HTTPException(status_code=404, detail="Vegetation video mask not found")
|
||||
artifacts = manifest.get("artifacts")
|
||||
if not isinstance(artifacts, list) or not any(
|
||||
isinstance(item, dict)
|
||||
and item.get("path") == archive_relative
|
||||
and item.get("media_type") == "application/zip"
|
||||
for item in artifacts
|
||||
):
|
||||
raise HTTPException(status_code=404, detail="Vegetation video mask not found")
|
||||
archive_path = candidate.joinpath(*relative.parts)
|
||||
member = f"masks/frame-{sequence + 1:06d}.png"
|
||||
try:
|
||||
before = archive_path.stat()
|
||||
|
||||
Reference in New Issue
Block a user