feat(perception): prepare blind detector review handoff
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Convert one completed blind CVAT task into an E48 review submission."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from k1link.compute.e46_review_handoff import convert_cvat_coco_to_e48_review
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--handoff-root", type=Path, required=True)
|
||||
parser.add_argument("--truth-island-root", type=Path, required=True)
|
||||
parser.add_argument(
|
||||
"--reviewer-slot",
|
||||
choices=("reviewer-a", "reviewer-b"),
|
||||
required=True,
|
||||
)
|
||||
parser.add_argument("--reviewer-id", required=True)
|
||||
parser.add_argument("--cvat-export", type=Path, required=True)
|
||||
parser.add_argument("--submitted-at-utc", required=True)
|
||||
parser.add_argument("--output", type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
document = convert_cvat_coco_to_e48_review(
|
||||
handoff_root=args.handoff_root,
|
||||
truth_island_root=args.truth_island_root,
|
||||
reviewer_slot=args.reviewer_slot,
|
||||
reviewer_id=args.reviewer_id,
|
||||
cvat_export_path=args.cvat_export,
|
||||
submitted_at_utc=args.submitted_at_utc,
|
||||
output_path=args.output,
|
||||
)
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
"output": str(args.output.expanduser().absolute()),
|
||||
"reviewer_id": document["reviewer_id"],
|
||||
"frame_count": len(document["images"]),
|
||||
"state": document["state"],
|
||||
},
|
||||
ensure_ascii=False,
|
||||
sort_keys=True,
|
||||
)
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Prepare two self-contained blind CVAT packages for E46."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from k1link.compute.e46_review_handoff import build_e46_review_handoff
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--truth-island-root", type=Path, required=True)
|
||||
parser.add_argument("--evaluation-pack-root", type=Path, required=True)
|
||||
parser.add_argument("--output-root", type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
result = build_e46_review_handoff(
|
||||
truth_island_root=args.truth_island_root,
|
||||
evaluation_pack_root=args.evaluation_pack_root,
|
||||
output_root=args.output_root,
|
||||
)
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
"result_id": result.result_id,
|
||||
"result_root": str(result.result_root),
|
||||
"state": result.manifest["state"],
|
||||
"frame_count": result.manifest["identity"]["frame_count"],
|
||||
"reviewer_slots": result.manifest["identity"]["reviewer_slots"],
|
||||
},
|
||||
ensure_ascii=False,
|
||||
sort_keys=True,
|
||||
)
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user