Hsyshasuzh/longmemory-geo / project /evaluation /initialize_dior_bridge_source_review.py
Hsyshasuzh's picture
download
raw
1.83 kB
"""Initialize an immutable-dependency review form for a DIOR-R source queue."""
from __future__ import annotations
import argparse
import hashlib
import json
from pathlib import Path
def sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def initialize(queue: Path) -> dict:
payload = json.loads(queue.read_text())
return {
"schema_version": "1.0.0",
"queue": str(queue),
"queue_sha256": sha256(queue),
"status": "PENDING_INDEPENDENT_SOURCE_LABEL_REVIEW",
"rules": [
"Inspect the original source image and oriented source annotation at full resolution.",
"Do not infer background from an absent annotation or alter source labels in this form.",
"A visual decision alone does not make a record training eligible.",
],
"records": [
{
"id": record["id"],
"source_image_id": record["source_image_id"],
"decision": "PENDING",
"bridge_geometry": "PENDING",
"annotation_completeness": "PENDING",
"ignored_or_auxiliary_context": "PENDING",
"notes": "",
"training_eligible": False,
}
for record in payload["records"]
],
}
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--queue", type=Path, required=True)
parser.add_argument("--output", type=Path, required=True)
args = parser.parse_args()
result = initialize(args.queue)
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(result, indent=2) + "\n")
print(json.dumps({"output": str(args.output), "records": len(result["records"])}))
if __name__ == "__main__":
main()

Xet Storage Details

Size:
1.83 kB
·
Xet hash:
9da5f0ebf1c6eabf2af7e438e755541af0642ec9f71b8db5c9f1b60dc92906f0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.