feat(semantics): add portable annotation, learning and review contracts
Add portable corpus, annotation provenance, admission, review and bounded agent-cycle contracts. Preserve dataset ownership and explicit research acceptance limits.
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
"""Worker-only rendering of the previously frozen six control windows."""
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from mapping import prepare_crops, render
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
root = Path("/experiment")
|
||||
control = json.loads((root / "control.json").read_text())
|
||||
source = json.loads((root / "control-source-receipt.json").read_text())["source"]
|
||||
out = root / "control-observations"
|
||||
out.mkdir(exist_ok=False)
|
||||
start = time.monotonic()
|
||||
jobs = []
|
||||
for w in control["windows"]:
|
||||
x, y, z = w["center"]
|
||||
views = [
|
||||
dict(
|
||||
id="top",
|
||||
projection="ortho",
|
||||
size=[768, 768],
|
||||
width_m=12,
|
||||
eye=[x, y, z + 25],
|
||||
target=[x, y, z],
|
||||
up=[0, 1, 0],
|
||||
),
|
||||
dict(
|
||||
id="oblique",
|
||||
projection="pinhole",
|
||||
size=[768, 768],
|
||||
fov_degrees=65,
|
||||
eye=[x, y - 7, z + 9],
|
||||
target=[x, y, z],
|
||||
up=[0, 0, 1],
|
||||
),
|
||||
]
|
||||
jobs.append(
|
||||
dict(
|
||||
source=source,
|
||||
bounds_xy=[[x - 6, y - 6], [x + 6, y + 6]],
|
||||
halo_m=15,
|
||||
views=views,
|
||||
)
|
||||
)
|
||||
for start_index in range(0, len(jobs), 3):
|
||||
batch = jobs[start_index : start_index + 3]
|
||||
for i, (job, rows) in enumerate(zip(batch, prepare_crops(batch), strict=True)):
|
||||
w = control["windows"][start_index + i]
|
||||
folder = out / w["id"]
|
||||
folder.mkdir()
|
||||
(folder / "cameras.json").write_text(json.dumps(job, allow_nan=False))
|
||||
render(job, folder, prepared_rows=rows)
|
||||
del rows
|
||||
sheet = Image.new("RGB", (1536, 800), "#161616")
|
||||
for n, view in enumerate(["top", "oblique"]):
|
||||
sheet.paste(Image.open(folder / (view + ".png")), (n * 768, 32))
|
||||
ImageDraw.Draw(sheet).text(
|
||||
(12, 10),
|
||||
w["id"] + " | RAW TOP / RAW OBLIQUE | no algorithm overlay",
|
||||
fill="white",
|
||||
)
|
||||
sheet.save(folder / "raw-review.jpg", quality=94)
|
||||
print("complete " + w["id"], flush=True)
|
||||
files = {
|
||||
p.relative_to(out).as_posix(): dict(
|
||||
bytes=p.stat().st_size, sha256=hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
)
|
||||
for p in out.rglob("*")
|
||||
if p.is_file()
|
||||
}
|
||||
manifest = dict(
|
||||
schema_version="missioncore.boundary-control-observations/v1",
|
||||
control_sha256=hashlib.sha256((root / "control.json").read_bytes()).hexdigest(),
|
||||
source=source,
|
||||
files=files,
|
||||
seconds=time.monotonic() - start,
|
||||
training_eligible=False,
|
||||
)
|
||||
(out / "manifest.json").write_text(json.dumps(manifest, indent=2, allow_nan=False))
|
||||
print(
|
||||
json.dumps(
|
||||
dict(seconds=manifest["seconds"], bytes=sum(f["bytes"] for f in files.values()))
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user