feat(lidar): add ground segmentation diagnostic benchmark

This commit is contained in:
DCCONSTRUCTIONS
2026-07-25 02:09:27 +03:00
parent e4fdd9fa20
commit 75a3e669d9
14 changed files with 2235 additions and 15 deletions
@@ -0,0 +1,104 @@
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import json
from pathlib import Path
from k1link.compute import (
PATCHWORKPP_SOURCE_COMMIT,
PATCHWORKPP_SOURCE_TAG,
LidarGroundBenchmarkV1,
LidarReplayPackV2,
PatchworkPPGroundSegmenter,
build_lidar_ground_annotation_template,
build_lidar_ground_benchmark,
)
def _arguments() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description=(
"Run diagnostic-only local-percentile vs Patchwork++ ground A/B "
"against one immutable LiDAR replay pack."
)
)
parser.add_argument("replay_pack", type=Path)
parser.add_argument("output_root", type=Path)
parser.add_argument(
"--annotation-root",
type=Path,
help="Optional root for an all-ignore human-review template.",
)
parser.add_argument(
"--annotation-frames",
type=int,
default=8,
)
parser.add_argument(
"--patchwork-module",
default="pypatchworkpp",
)
parser.add_argument(
"--patchwork-source-tag",
default=PATCHWORKPP_SOURCE_TAG,
)
parser.add_argument(
"--patchwork-source-commit",
default=PATCHWORKPP_SOURCE_COMMIT,
)
return parser.parse_args()
def main() -> int:
arguments = _arguments()
replay = LidarReplayPackV2(arguments.replay_pack)
try:
patchwork = PatchworkPPGroundSegmenter.load(
module_name=arguments.patchwork_module,
source_tag=arguments.patchwork_source_tag,
source_commit=arguments.patchwork_source_commit,
)
output = build_lidar_ground_benchmark(
replay,
arguments.output_root,
patchwork=patchwork,
)
annotation = (
build_lidar_ground_annotation_template(
replay,
arguments.annotation_root,
requested_frames=arguments.annotation_frames,
)
if arguments.annotation_root is not None
else None
)
finally:
replay.close()
result = LidarGroundBenchmarkV1(output)
try:
print(
json.dumps(
{
"benchmark_id": result.benchmark_id,
"status": result.report["status"],
"decision": result.report["decision"],
"current": result.report["current"],
"candidate": result.report["candidate"],
"comparison": result.report["comparison"],
"annotation_template_id": (
annotation.name if annotation is not None else None
),
},
ensure_ascii=False,
indent=2,
)
)
finally:
result.close()
return 0
if __name__ == "__main__":
raise SystemExit(main())