Ring decoder: local tone split, sharpened crop, frame accumulation, crop scanner

This commit is contained in:
2026-08-16 19:22:24 +01:00
parent 418e7667e5
commit 05cfa36e5b
5 changed files with 265 additions and 26 deletions
+11 -3
View File
@@ -95,9 +95,9 @@ def neg_trials(n):
def seqs(n):
r = random.Random(47)
out = []
for d, contrast, fps in itertools.product([80, 100, 120, 150], [0.45, 0.3], [15, 7]):
for d, contrast, fps in itertools.product([60, 70, 80, 100, 120, 150], [0.45, 0.3], [15, 7]):
for _ in range(n):
s = camera(r, d, contrast, 1.0, 1920)
s = camera(r, d, contrast, r.choice([0.7, 1.5]), 1920)
s.update(tilt=r.choice([0, 10, 20]), fps=fps, secs=6, interval=500, shake=r.uniform(0.3, 1.2),
tokens=[code(r) for _ in range(14)], t0=r.randrange(1 << 20) * 500 + r.uniform(0, 400))
out.append(s)
@@ -168,6 +168,13 @@ async def run_far(p, n, pipes, diag):
print(f" d {d}: ok {len(good)}/{len(sub)} fails by stage {dict(st)}"
f" bit errs with true geometry {sum(x['bitErr'] for x in sub) / len(sub):.1f} (ideal thr {sum(x['idealErr'] for x in sub) / len(sub):.1f})"
f" worst-ring d' {sum(min(x['dprime']) for x in sub) / len(sub):.1f} sync span {sum(x['span'] for x in sub) / len(sub):.0f} levels")
print(" bit errors with true geometry per decision rule, and bleed model (own, ring neighbours, adjacent rings, residual):")
for d in sorted({r["d"] for r in res}):
labs = [r["diag"]["lab"] for r in res if r["d"] == d and "isi" in r["diag"]["lab"]]
keys = [k for k in labs[0] if k != "isi"]
isi = [sum(x["isi"][i] for x in labs) / len(labs) for i in range(5)]
print(f" d {d}: " + " ".join(f"{k} {sum(x.get(k, 0) for x in labs) / len(labs):.1f}" for k in keys)
+ f" | own {isi[1]:.2f} ang {isi[2]:.2f} rad {isi[3]:.2f} resid {isi[4]:.2f}")
out = ROOT / "tools" / "bench_out"
out.mkdir(exist_ok=True)
for i, r in enumerate(res[:3]):
@@ -240,4 +247,5 @@ async def main():
server.terminate()
asyncio.run(main())
if __name__ == "__main__":
asyncio.run(main())