Edges Before Embeddings: A Confidence-Aware Blur Gate for Vision-Language Pipelines Duy Tran Thanh* [email protected]
arXiv:2606.25838v1 [cs.CV] 24 Jun 2026
https://github.com/bradduy/MagikaDocumentFromPixel
Abstract—Production vision pipelines silently degrade on blurry input, wasting compute on downstream OCR, retrieval, and vision-language model (VLM) calls that cannot recover a usable output. We present M AGIKA D OCUMENT F ROM P IXEL, a lightweight, CPU-friendly image quality gate that classifies a single image as sharp, blurred, or uncertain in roughly 7 ms on a single CPU core. The contributions are (i) a recipe selected from a 46-configuration, 8-sweep empirical search that isolates input resolution as the dominant lever and shows architecture capacity only pays off at ≥ 384 px; (ii) a confidence-aware routing formalism (Eq. 1) grounded in classical selective prediction [10]– [12]; (iii) the Edge Prior Module (EPM), a Laplacian-magnitude auxiliary input channel that gives the network direct access to the spectral evidence that classical blur heuristics [7] rely on and that lifts test F1 by +1.3 points in a matched-env comparison; and (iv) an observation that the gate is one instance of a recurring design pattern that appears independently in Magika contenttype detection [1], risk-controlled OCR with VLMs [2], and DocVLM [3]. The final recipe MobileNetV3-Large with the EPM trained at 384×384 on paired GoPro Large frames, evaluated with 5-scale test-time augmentation reaches F1 = 0.9803 (AUC 0.9989) with a 17 MB ONNX artifact, improving over our fixed-scale baseline on the same hardware (F1 = 0.9672) by +1.31 points. We are explicit about limitations: results are on a single motionblur distribution, numbers are from a single seed, and calibration is qualitative rather than measured. Index Terms—Compound AI Systems, Selective Prediction, Agentic Routing, Document AI Agents, Efficient Tool Use, VisionLanguage Model Guardrails
I. I NTRODUCTION Most production computer-vision pipelines were engineered under an implicit assumption that their input is legible. That assumption holds for curated benchmarks and breaks in deployment. Motion blur from hand-held capture, defocus on mobile devices, compression artifacts, low-light noise, and scanner skew all cause a pipeline to continue operating on unusable input. The typical failure modes we observe in engagements are: 1) Silent OCR corruption. An OCR system applied to a blurred receipt or invoice emits garbage tokens that are syntactically indistinguishable from legitimate text. Downstream rule engines and analytics cannot tell these apart. 2) Wasted VLM tokens. Vision-language models such as GPT-4V class services charge per token. A blurred frame * Duy Tran Thanh is concurrently a Senior Applied AI Engineer at OneMount Group, a Vietnam-based company in the finance and banking sector.
Approach
cheap binary abs- image CPU gate tains blur What it lacks
Laplacian / FFT [7] Learned IQA [14], [15] Deblur GANs [9] VLM judges (GPT-4V) Magika [1]
✓ ∼ × × ✓
∼ × × × ✓
× × × ∼ ✓
∼ ∼ ✓ ∼ ×
no abstention score, not a gate restores, not gates too slow / costly for files, not images
Ours: blur gate ⋆
✓
✓
✓
✓
satisfies all four
Fig. 1. Where our gate sits in the image-quality landscape. Each row scores a method on the four properties a production blur-gate needs; every existing approach fails at least one column. Our gate (⋆ ) is the first to satisfy all four, lifting F1 on GoPro Large from 0.9672 (fixed-scale baseline) to 0.9803 on the same hardware (Tab. IV). Architecture in Fig. 2.
still consumes the full per-call budget and yields no usable output. 3) Irrelevant retrieval. User-photo search returns lowquality matches on motion-blurred uploads, driving refund and support cost. 4) Infeasible curation. Hand-filtering blurry images out of multi-million-image datasets stalls supervised vision programs. 5) Slow capture feedback. Mobile and edge capture flows need immediate “please retake” feedback; a cloud roundtrip for every shot is too slow. The existing landscape leaves teams stuck between two ends. Heavy restoration networks (deblur GANs, hundreds of millions of parameters) are too expensive to run per upload and are designed to fix blur rather than detect it. Hand-crafted edgevariance heuristics (Laplacian variance, FFT band-energy) are cheap but break on textured-but-sharp scenes and smooth-butsharp scenes and cannot be tuned per domain [7]. What a production team actually needs is a gate a fast, cheap, CPU-executable model that sits in front of the expensive pipeline and decides whether to pass the image through, reject it, or abstain. This paper describes such a gate. Contributions. The paper does not propose a new backbone or a new loss. Its contributions are: • An empirical recipe. A reproducible ∼ 7 ms-CPU, 17 MB blur detector reaching F1 = 0.9749 on GoPro Large in the original CUDA environment, selected from 46 training runs organized into 8 sweeps (Section V). • The Edge Prior Module (EPM). A drop-in extension that concatenates per-pixel Laplacian magnitude as a
resize: same photo, 5 sizes
EPM (Edge Prior Module)
256 px 320 px
grayscale
Laplacian
standardize
384 px 448 px
photo (RGB)
Small CNN \ MobileNetV3-Large 17 MB, ∼7 ms on a CPU (same model, all 5)
512 px
Σ/5 average over the 5 sizes
confident? (τ = 0.60)
sharp → run OCR / VLM uncertain → human review blurred → ask for retake
Fig. 2. Full architecture, read left-to-right. The Edge Prior Module (EPM, Sec. III-D) extracts an edge map in three steps grayscale, Laplacian filter, standardize and concatenates it onto the RGB photo as a 4th input channel. The shared CNN is evaluated at five image resolutions; the Σ/5 block averages the per-scale predictions, and the routing diamond emits sharp, uncertain, or blurred depending on whether the averaged confidence clears τ = 0.60. The uncertain bucket is the deliberate abstention [10], [12] that routes low-confidence cases to a heavier model or a human. \ = learnable; = frozen / parameter-free.
4th input channel, giving the CNN direct access to the spectral evidence that classical blur heuristics [7] rely on. In a matched-env comparison (AMD/ROCm), the EPM improves 5-scale-TTA F1 from 0.9672 to 0.9803 (+1.31 points), with no architectural change other than the firstconv width (Section III-D). • A structural finding about which levers matter. Across the full search, input resolution dominates backbone capacity: moving 128 → 384 px adds ∼ 13 F1 points, and MobileNetV3-Large outperforms MobileNetV3-Small only at ≥ 384 px (Section V). • A routing formalism grounded in classical selective prediction. Equation 1 couples the classifier to a deployment-time abstention rule in the spirit of Chow [10] and Geifman-El-Yaniv [12], with the abstention threshold τ treated as a per-channel product knob (Section IV). • A cross-paper observation (not a claimed contribution, but a framing). The cheap-gate + confidence + route pattern appears independently in Magika [1], risk-controlled OCR with VLMs [2], and DocVLM [3]; we argue it is a default architecture for production vision/document systems (Section VII). Scope and honest limits. All reported numbers are on the GoPro Large motion-blur distribution with a single random seed. Cross-dataset generalization (RealBlur, HIDE, REDS, OCR/document blur), calibration metrics (ECE, reliability diagrams), threshold sensitivity, and multi-seed variance are not included in this paper and are discussed as explicit limitations and future work (Section VII-C). II. R ELATED W ORK A. Classical blur heuristics The canonical no-reference blur score is the variance of the Laplacian response over the image [7]; related estimators use FFT band energy or gradient statistics. These scores are fast but scene-dependent, conflate blur with low-texture content, and cannot be tuned per domain without retaining a full calibration set. B. Learned image quality assessment (IQA) No-reference IQA has matured substantially beyond handcrafted features: NIQE [13] is a statistical NSS baseline;
MUSIQ [14] and MANIQA [15] are Transformer-based multiscale quality regressors; HyperIQA [16] conditions on content. These models target a continuous aesthetic or perceptual score on datasets such as KonIQ-10k and LIVE-C, not the binary sharp/blur routing decision that a production gate must make. Re-targeting a continuous-score model for abstention also requires choosing a cutoff, which returns us to the selectiveprediction problem without simplifying it. C. Selective prediction and abstention Treating the model as a classifier that may refuse to answer has a long history. Chow’s rule [10] derives the optimal reject-option classifier under a fixed rejection cost; El-Yaniv and Wiener [11] generalize this to selective-function learning; Geifman and El-Yaniv [12] give a risk-controlled algorithm for deep networks. Our routing rule (Eq. 1) is a max-softmax threshold variant of this classical setup, applied to the blurgate problem with τ exposed as a deployment-time product knob rather than solved for a fixed risk target. D. Blind deblurring Restoration networks such as DeblurGAN [9] and its successors reconstruct a sharp image from a blurred one. These models are orders of magnitude larger than needed for a gating decision, and deblurring the input is rarely what a production pipeline wants: a better outcome for an unreadable receipt is usually “please retake” rather than a synthetic best-guess. E. Lightweight gates and Magika Our design is directly inspired by Magika [1], a < 1 MB CPU content-type detector that routes files in Gmail and VirusTotal using a tiny CNN and per-class confidence thresholds. The small-model-plus-confidence-routing pattern also appears in Risk-Controlled Generative OCR [2], which wraps a frozen VLM with geometric consensus and structural screening to emit a transcription or abstain, and in DocVLM [3], which compresses OCR into 64 learned queries so a frozen VLM is not overrun by textual tokens. We return to these connections in Section VII. F. Image quality as a precondition for VLMs Recent work on end-to-end document VLMs [4], [5] reports that input resolution and visual-token budget dominate architectural choices at model scale, echoing the empirical pattern we observe for a 3.3 M-parameter classifier (Section V).
TABLE I T RAINING CONFIGURATION OF THE FINAL RECIPE . Parameter
Value
Input resolution Optimizer Scheduler Loss Augmentation Epochs Precision Batch size Extra data
384 × 384 AdamW, lr = 1×10−4 Cosine annealing Cross-entropy Crop, flip, mild color jitter (“medium”) 25 Automatic mixed precision (AMP) 24 blur_gamma folder included
III. M ETHOD A. Task formulation We cast blur detection as a two-class problem with an explicit abstention class at inference. Given an image x, a classifier fθ : x 7→ (ps , pb ) ∈ ∆1 predicts the probability that the image is sharp (ps ) or blurred (pb ). Let ŷ = arg max{ps , pb } and c = max(ps , pb ). Inference returns one of three routing labels: if ŷ = ps and c ≥ τ, sharp (1) route(x) = blurred if ŷ = pb and c ≥ τ, uncertain if c < τ, with abstention threshold τ = 0.60 by default. The uncertain bucket is a deliberate product-level knob: raising τ trades recall for precision in either class and is calibrated per downstream use case (Section IV). B. Dataset: paired sharp/blur from GoPro Large We train on the GoPro Large dataset [6], which provides high-speed-camera frames paired into a sharp frame and its synthetic motion-blurred counterpart. We take both the blur/ and blur_gamma/ subfolders as the positive (blurred) class and the sharp/ subfolder as the negative class. This “Strategy A” labeling is label-free in the sense that no human annotation is required beyond the dataset’s own pairing. Including the blur_gamma folder a second blur style of the same scenes is a consistent +1% F1 free of engineering cost (Section V). C. Backbone and training The classifier is a MobileNetV3-Large backbone pretrained on ImageNet, with a 2-class softmax head. The model has ∼ 3.3 M parameters and compiles to a 17 MB ONNX artifact with dynamic batch and height/width axes. Training hyperparameters are: D. EPM: An Edge Prior Module The Edge Prior Module (EPM) is the gold module of Fig. 2; the single-channel image it produces is also referred to in plain-language passages as a sharpness map or, equivalently, an edge map. All three names denote the same object: an image whose pixel intensity is the magnitude of the spatial
Laplacian of the input’s luminance, and which is concatenated to the RGB photo as a 4th input channel. Classical blur heuristics [7] exploit the fact that blurring an image collapses high-frequency content: the variance of the per-pixel Laplacian drops for blurred content and remains high for sharp content. A pure CNN on RGB must re-learn this relationship from pixel statistics; we instead inject it as an auxiliary input. Let G(x) = 0.299 R + 0.587 G + 0.114 B be the luminance of the RGB input x, and let ∆ be the 3 × 3 8-connected Laplacian kernel. Define the auxiliary channel as the perimage-standardized Laplacian magnitude: |∆ ∗ G(x)| − µ(x) , (2) σ(x) with µ and σ the mean and standard deviation of the magnitude map. We concatenate ϕ(x) to x along the channel dimension so the backbone ingests a 4-channel input [ x ; ϕ(x) ] ∈ R4×H×W , and expand the first convolution from 3 to 4 input channels: the first three filters are initialized from the ImageNet-pretrained RGB weights; the fourth is initialized to 0.1× the per-output-channel mean of the RGB filters, which is a standard warm-start for auxiliary-channel extensions that keeps early training numerically tame. The addition costs a single cheap convolution (Laplacian kernel is fixed, 9 multiplications per pixel), adds 16 parameters to the first conv (one new 3×3 slice per output channel), and does not change inference latency materially. Empirically the EPM lifts test F1 by +1.31 points (Section V), which is the single largest same-environment gain in the full experiment log. ϕ(x) =
E. Multi-scale test-time augmentation (TTA) At inference, the network is evaluated at five resolutions {256, 320, 384, 448, 512} px and the softmax vectors are averaged before routing. Multi-scale TTA is effectively a free source of resolution diversity: 1 X (ps , pb ) = softmax fθ (x↓s ) , (3) |S| s∈S
with S = {256, 320, 384, 448, 512}. This yields +0.23-0.27% F1 over single-scale inference with no retraining and can be disabled on latency-bound deployments (single-scale at 384 px still achieves F1 = 0.9722). IV. C ONFIDENCE -AWARE ROUTING The abstention threshold τ is not a hyperparameter in the classical sense: it is a product knob exposed to whoever integrates the gate. Three observations make the routing design the most practically important part of the system. 1) Max-softmax, not calibration networks. Isotonic regression and temperature scaling produced no measurable F1 gain on GoPro Large; raw max-softmax is already monotonic enough to threshold. 2) Validation F1 saturates at 1.0. Threshold tuning on the validation split does not transfer; τ must be set on a small slice of production traffic.
Algorithm 1 Inference with multi-scale TTA and abstention 1: Input: image x; scales S; threshold τ 2: P ← 0 ∈ R2 3: for s ∈ S do 4: xs ← resize(x, s×s) 5: P ← P + softmax(fθ (xs )) 6: end for 7: (ps , pb ) ← P/|S| 8: if max(ps , pb ) < τ then 9: return uncertain, (ps , pb ) 10: else if ps ≥ pb then 11: return sharp, (ps , pb ) 12: else 13: return blurred, (ps , pb ) 14: end if TABLE II H EADLINE METRICS ON THE G O P RO L ARGE TEST SPLIT. T WO REFERENCE SYSTEMS ARE REPORTED : THE ORIGINAL NVIDIA/C UDA RECIPE (384 PX + 5- SCALE TTA) AND THE EPM EXTENSION ADDED IN THIS PAPER ( EVALUATED ON AMD/ROC M ). Metric
NVIDIA/Cuda recipe
+ EPM
0.9749 0.9752 0.9889 0.9613 0.9982 17 MB ∼ 7 ms ∼ 35 ms
0.9803 0.9806 0.9981 0.9631 0.9989 17 MB ∼ 7 ms ∼ 35 ms
F1 Accuracy Precision Recall AUC Model size (ONNX) Latency (single-scale, 384 px, CPU) Latency (5-scale TTA, CPU)
3) Per-channel tuning. KYC, social uploads, and datasetcuration flows can all share the same model with different τ values to trade precision against user friction. V. E XPERIMENTS A. Evaluation protocol All final numbers are computed on the official GoPro Large test split [6], evaluated per-image with no overlap against the training set. We report F1 , accuracy, precision, recall, and AUC of the binary classifier, with uncertain-routed examples excluded from the argmax counts (they are handled as abstentions). B. Champion metrics Table II summarizes the two reference systems: the original NVIDIA/Cuda recipe (the 8-sweep champion), and the EPM extension we introduce, evaluated on the same test split on AMD/ROCm. C. Sweep progression: resolution is the dominant lever We ran 46 training runs organized into 8 sweeps, varying (in order) resolution, training length, augmentation and threshold, extra data, backbone capacity, and ensembling. Table III reports the best F1 achieved at each sweep. Resolution alone accounts for roughly 13 points of F1 , the largest single lever in the search and capacity only begins paying off at ≥ 384 px.
TABLE III S WEEP PROGRESSION . E ACH ROW IS THE BEST F 1 AT THAT STAGE . #
Sweep theme
Best F1
1 2 3 4 5 6 7 8 ⋆
Resolution 128-160 px Resolution 160-224 px, 30 epochs Augmentation and threshold at 224 px +blur_gamma, 320 px +384 px MNV3-Large at 384 px Large variants EffNet / regularization +Multi-scale TTA
≤ 0.89 ≤ 0.92 ≤ 0.93 ≤ 0.95 ≤ 0.96 0.9722 ≤ 0.9722 ≤ 0.9722 0.9749
TABLE IV M ATCHED - ENV ABLATION ON AMD/ROC M . E ACH ROW IS A SEPARATE TRAINING RUN ; COLUMNS ARE INFERENCE - TIME F 1 ON THE G O P RO L ARGE TEST SPLIT AT SINGLE - SCALE 384 PX AND 5- SCALE TTA. ∆TTA IS THE F 1 GAIN FROM APPLYING 5- SCALE TTA. Training run Baseline (fixed 384) Res-Rand (random ∈ S) EPM (ours) EPM + Res-Rand (stacked)
F1 @ 384
F1 @ TTA
∆TTA
0.9632 0.9642 0.9746 0.9402
0.9672 0.9668 0.9803 0.9537
+0.40 +0.26 +0.57 +1.35
D. EPM and Res-Rand: matched-environment comparison Table IV reports a controlled comparison on the AMD/ROCm fallback hardware, all under the same training regime (MobileNetV3-Large, 25 epochs, AdamW lr=10−4 , cosine schedule, medium augmentation, including the blur_gamma subset). This matched-env view isolates the effect of the two extensions introduced here against the same fixed-scale baseline. The EPM is the dominant lever. The Laplacian-magnitude auxiliary channel lifts single-scale F1 by +1.14 points and 5-scale-TTA F1 by +1.31 points over the same-environment baseline. The mechanism is direct: the CNN no longer has to rediscover the frequency-domain evidence that classical heuristics [7] already measure; it receives it as an explicit input channel. The EPM also enlarges the TTA delta (+0.57 vs the baseline’s +0.40), suggesting the auxiliary channel offers independent evidence that averaging over scales can exploit. Res-Rand is a wash. Resolution-randomized training which samples a target resolution from S = {256, 320, 384, 448, 512} per batch and downsamples the batch to that resolution before the forward pass moves singlescale F1 by only +0.10 and regresses 5-scale-TTA F1 by −0.04 versus the same-env baseline. The secondary observation that Res-Rand has a smaller TTA delta (+0.26 vs +0.40 for fixed-scale training) is mechanistic evidence that a model already exposed to multiple scales at training time has less residual for inference-time averaging to pick up a finding that independently supports the paper’s “resolution is the dominant lever” thesis even though Res-Rand itself does not beat fixedscale + TTA. Stacking the EPM with Res-Rand hurts. The last row of Table IV shows that combining the two extensions regresses
TABLE V O PERATING REGIME ACROSS FAMILIES OF APPROACHES . L ATENCY FIGURES FOR PRIOR WORK ARE AS - REPORTED IN THE CITED PAPER ( DESKTOP CPU UNLESS NOTED ). D ESIGNED GATE TARGET MEANS THE METHOD ’ S NATIVE OUTPUT IS A ROUTING DECISION . Family
Output
Latency
Gate target?
Laplacian var. [7] BRISQUE [8] NIQE [13] MUSIQ [14] DeblurGAN [9] Generic VLM grader Ours
scalar score score score image text route
< 1 ms ∼ 10 ms ∼ 20 ms ∼ 50 ms GPU ∼ 200 ms GPU > 1 s + $/call ∼ 7 ms CPU
no no no no no (restorer) indirect yes
to F1 = 0.9537 at 5-scale TTA worse than either extension alone and worse than the fixed-scale baseline. The mechanism is mechanistic: the Laplacian response in Eq. 2 scales with resolution, so Res-Rand’s per-batch resolution swings induce matching swings in the auxiliary-channel statistics. The model then trains on a shifting input distribution for the very channel that was meant to provide stable evidence. The EPM and Res-Rand are therefore not composable as implemented, and should be used exclusively we recommend the EPM alone as the deployment-ready recipe. E. Ablations worth reporting as negative results The following choices consistently hurt or failed to help, and we report them explicitly so future teams on a similar problem do not waste compute re-discovering them: • Focal loss hurts on an approximately balanced dataset. • Aggressive augmentation (RandAugment, MixUp) degrades precision at ≥ 224 px. • Training beyond 25 epochs at 384 px overfits; validation F1 regresses. • Threshold tuning on validation does not transfer; validation saturates at F1 = 1.0. • Naive ensembles of top-N single models contribute negligible gain because individual-model errors are highly correlated. • MobileNetV3-Large below 320 px is neutral or worse than MobileNetV3-Small; capacity only pays off once the visual signal is dense enough.
(i) Pre-check in front of OCR or a VLM. Route sharp to the expensive downstream component, blurred back to the user as a retake request, and uncertain to a heavier fallback. The gate is roughly three orders of magnitude cheaper than a vision LLM call, so even rejecting 10% of traffic is a meaningful monthly saving. (ii) Upload-time quality filter. Middleware on an image upload API that tags or rejects low-quality uploads before storage. The uncertain bucket is the product knob that lets different channels (KYC, social, retail) share the same model with different precision/friction trade-offs. (iii) Edge / on-device inference. A 17 MB ONNX artifact with dynamic axes converts cleanly to CoreML and TFLite and runs in the browser via ONNX Runtime Web. Multi-scale TTA is opt-in; single-scale at 384 px still delivers F1 = 0.9722 when latency is the binding constraint. VII. D ISCUSSION A. A recurring production pattern Read in isolation, each of Magika [1], Risk-Controlled Generative OCR [2], DocVLM [3], and this work describes its own mechanism in its own vocabulary. Read together, all four instantiate the same control-theoretic shape: a cheap gate emits a confidence-bearing signal that is used to route an expensive downstream system, rather than to force a hard prediction. Table VI aligns the four systems on common axes. The four systems share neither architecture, domain, nor training data, yet converge on the same control-theoretic frame: a cheap controller decides whether to consume the expensive consumer. We read the pattern as a default architecture for production vision and document pipelines. B. Resolution as the dominant lever The empirical pattern inside our sweeps resolution dominates capacity until resolution is sufficient aligns with findings at very different model scales. DocVLM [3] reports that visualtoken budget dominates OCR-token budget for a fixed context; OCRVerse and Qianfan-OCR [4], [5] report small-model wins in vision-centric OCR at high input resolution. We therefore recommend resolution sweep first, architecture search second as a default prioritization when working in this design space.
F. Positioning against existing families of approaches
C. Limitations and future work
Table V positions our gate qualitatively against representative prior work. Because the cited IQA and deblurring methods are trained and evaluated on different benchmarks (KonIQ10k [14], LIVE-C, GoPro blind-deblurring), a head-to-head F1 on our test split would require retraining each baseline on paired sharp/blur frames out of scope for this paper. We therefore compare operating regime rather than raw score. A cross-method F1 benchmark is planned as an extension (Section VII-C).
We list the gaps that a careful reader should hold us accountable for. Single distribution. All results are on GoPro Large motion blur. Defocus, low-light noise, compression, and scanner skew are out-of-distribution. Cross-dataset evaluation on RealBlur [17], HIDE [18], and a document-blur set is planned as the first extension. Single seed. Reported F1 is from a single training run. A future version will report mean ± s.d. across at least three seeds with a paired McNemar test against the sweep6 baseline. Qualitative calibration only. We use a max-softmax threshold without reporting Expected Calibration Error (ECE) or
VI. D EPLOYMENT PATTERNS The gate is designed to drop into three common positions in a production vision pipeline.
TABLE VI T HE CHEAP - GATE + CONFIDENCE + ROUTE PATTERN ACROSS FOUR INDEPENDENTLY DESIGNED SYSTEMS . A LL FOUR COUPLE A SMALL GATE TO A CONFIDENCE - BEARING SIGNAL THAT ROUTES AN EXPENSIVE CONSUMER . System
Gate
Magika [1] Risk-Controlled OCR [2] DocVLM [3]
< 1 MB CNN on 3×512 bytes per-class calibrated threshold type-class or UNKNOWN/TXT parser / handler chain K = 5 geometric consensus + cross-view agreement τ (m) transcription or ⊥ abstain frozen VLM (GPT-4V-class) structural screen 64 learned queries distilling OCR token-budget allocation (visual compressed evidence forwarded frozen VLM reader vs. OCR) MobileNetV3-Large, 3.3 M, max-softmax ≥ τ = 0.60 sharp / blurred / uncertain OCR, VLM, paid API 17 MB
Ours
Confidence signal
reliability diagrams, and we dismissed temperature scaling and isotonic regression based on held-out F1 alone. A full calibration study (ECE, Brier score, reliability binning, comparison to focal-calibration and Platt) is a planned companion experiment. No τ sweep. The paper fixes τ = 0.60 without reporting the precision/recall curve as τ varies. A full PR trade-off and a risk-coverage curve (selective-prediction evaluation [12]) are the right figures here and are deferred. Saturating validation. GoPro Large validation saturates at F1 = 1.0, so model-selection signal is weak. A harder heldout mix (GoPro + RealBlur + synthetic defocus) would give a better training signal. Predicted failure modes. We did not run a qualitative error analysis. From the recipe’s inductive biases we predict three dominant error categories: (a) textured-but-sharp scenes (fur, foliage, dense crowds) misclassified as blurred because local gradient statistics look noisy; (b) smooth-but-sharp scenes (sky, uniform walls) misclassified as blurred for the opposite reason; (c) strong directional glare / lens flare misclassified as blurred. A quantitative error taxonomy is a planned extension. D. Reproducibility The final checkpoint, ONNX artifact, training configuration YAML, and the full sweep log (46 runs, 8 sweeps) are preserved. Training seed, optimizer state, and library versions are fixed in the configuration. The two hyperparameters that are not checked in the abstention threshold τ and the TTA scale set S are the deployment-time knobs that a downstream team is expected to calibrate. Code and artifact release will accompany the camera-ready version. E. Adapting to other domains For receipts, invoices, IDs, or scanned documents, the recipe generalizes cleanly: (i) mix GoPro with REDS or with synthetic defocus from domain-sharp images; (ii) swap the 2-class head for a richer taxonomy ({sharp, motion blur, defocus blur, low light}) when the downstream pipeline should react differently to different degradation types; (iii) calibrate τ on a hand-labeled slice of production traffic. VIII. C ONCLUSION We presented a lightweight, CPU-friendly blur detector intended to sit in front of expensive vision pipelines as a
Routing decision
Expensive consumer
routing gate. The base system achieves F1 = 0.9749 on GoPro Large with a 17 MB ONNX artifact at ∼ 7 ms per image; the Edge Prior Module (EPM), which concatenates a Laplacian-magnitude auxiliary channel grounded in classical blur heuristics, lifts F1 to 0.9803 in a matched-environment comparison the single largest same-environment gain in our full experiment log, and achieved with no material change to the architecture or inference latency. The experiment log isolates input resolution as the dominant lever, demonstrates that multi-scale test-time augmentation gives a free F1 gain at deployment time, and documents one positive and one negative extension candidate (EPM wins; resolution-randomized training is a wash). Beyond the numbers, the paper makes a structural argument: the gate is one instance of a recurring production pattern cheap gate, confidence signal, routing to an expensive consumer that we expect to see more of in applied computer-vision and document-AI systems. ACKNOWLEDGMENT The author thanks the Magika team for open-sourcing the content-type detector that inspired this work’s design philosophy, and the GoPro dataset maintainers for making paired sharp/blur frames publicly available. R EFERENCES [1] Y. Fratantonio et al., “Magika: AI-powered content-type detection,” arXiv preprint, 2024. Google, Gmail, VirusTotal deployment. [2] Authors of “From Plausibility to Verifiability: Risk-Controlled Generative OCR with VLMs,” arXiv preprint, 2025. [3] Authors of “DocVLM: Make Your VLM an Efficient Reader,” arXiv preprint, 2024. [4] Authors of “OCRVerse: Towards Holistic OCR in End-to-End VisionLanguage Models,” arXiv preprint, 2025. [5] Authors of “Qianfan-OCR: A Unified End-to-End Model for Document Intelligence,” arXiv preprint, 2025. [6] S. Nah, T. H. Kim, and K. M. Lee, “Deep multi-scale convolutional neural network for dynamic scene deblurring,” in Proc. IEEE Conf. Comput. Vis. Pattern Recognit. (CVPR), 2017. [7] J. L. Pech-Pacheco, G. Cristóbal, J. Chamorro-Martı́nez, and J. Fernández-Valdivia, “Diatom autofocusing in brightfield microscopy: a comparative study,” in Proc. 15th Int. Conf. Pattern Recognit. (ICPR), 2000, pp. 314-317. [8] A. Mittal, A. K. Moorthy, and A. C. Bovik, “No-reference image quality assessment in the spatial domain,” IEEE Trans. Image Process., vol. 21, no. 12, pp. 4695-4708, 2012. [9] O. Kupyn, V. Budzan, M. Mykhailych, D. Mishkin, and J. Matas, “DeblurGAN: Blind motion deblurring using conditional adversarial networks,” in Proc. IEEE Conf. Comput. Vis. Pattern Recognit. (CVPR), 2018.
[10] C. K. Chow, “An optimum character recognition system using decision functions,” IRE Trans. Electronic Computers, vol. EC-6, no. 4, pp. 247254, 1957. [11] R. El-Yaniv and Y. Wiener, “On the foundations of noise-free selective classification,” Journal of Machine Learning Research, vol. 11, pp. 16051641, 2010. [12] Y. Geifman and R. El-Yaniv, “Selective classification for deep neural networks,” in Advances in Neural Information Processing Systems (NeurIPS), 2017. [13] A. Mittal, R. Soundararajan, and A. C. Bovik, “Making a “completely blind” image quality analyzer,” IEEE Signal Process. Lett., vol. 20, no. 3, pp. 209-212, 2013. [14] J. Ke, Q. Wang, Y. Wang, P. Milanfar, and F. Yang, “MUSIQ: Multiscale image quality transformer,” in Proc. IEEE Int. Conf. Comput. Vis. (ICCV), 2021. [15] S. Yang, T. Wu, S. Shi, S. Lao, Y. Gong, M. Cao, J. Wang, and Y. Yang, “MANIQA: Multi-dimension attention network for no-reference image quality assessment,” in Proc. IEEE Conf. Comput. Vis. Pattern Recognit. Workshops (CVPRW), 2022. [16] S. Su, Q. Yan, Y. Zhu, C. Zhang, X. Ge, J. Sun, and Y. Zhang, “Blindly assess image quality in the wild guided by a self-adaptive hyper network,” in Proc. IEEE Conf. Comput. Vis. Pattern Recognit. (CVPR), 2020. [17] J. Rim, H. Lee, J. Won, and S. Cho, “Real-world blur dataset for learning and benchmarking deblurring algorithms,” in Proc. European Conf. Comput. Vis. (ECCV), 2020. [18] Z. Shen et al., “Human-aware motion deblurring,” in Proc. IEEE Int. Conf. Comput. Vis. (ICCV), 2019.