Skip to content
image-classification Β· basics 32Γ—32 Patches Β· 16Γ—16 Token Grid Β· Calibration WASM q8 Β· 88.94 MB License: Apache-2.0

Inside 16Γ—16 ViT Patch Sensitivity & Threshold Calibration

AI-Anime-Image-Detector-ViT divides a 512Γ—512 illustration into 16Γ—16 = 256 non-overlapping 32Γ—32 pixel patches. Sweep a live Patch Occlusion Sensitivity Grid to measure which facial, linework, or shading blocks shift P(ai) vs P(real), then calibrate the decision threshold against a live Confidence Calibration Histogram.

1 Β· Live ViT Patch Occlusion Sensitivity Grid

Pick a procedural anime plate or ledgered sample, or upload/drop/paste your own artwork. Each masked pass occludes one super-patch aligned to the ViT's 32Γ—32 token boundaries and records the exact signed shift in P(ai).

Initialising model loader…

Supported Real (P(ai) rose when masked) Drove AI (P(ai) dropped when masked)

Click any cell after running to inspect that masked pass.

Baseline verdict–
Baseline P(ai)–
Peak |Ξ” P(ai)|–
Verdict flips–
Mean pass ms–
NaN / invalid0

Selected region details appear here after running.

Patch region sensitivity ranking (sorted by absolute P(ai) shift when masked)
Cell 512Γ—512 bounds Masked P(ai) Ξ” P(ai) Masked verdict Inspect
Run the patch occlusion sweep to populate region sensitivity scores.

2 Β· Confidence Calibration Histogram & Decision Threshold Tuner

Score the 6-item starter benchmark (4 procedural anime plates + 2 out-of-domain photos) live in the Web Worker, then tune the P(ai) threshold slider to inspect how sharply the binary head separates inputs and which samples sit near the decision boundary.

Ready once model loads.

Scored samples0
Flagged AI (β‰₯ T)0
Cleared Real (< T)0
Near boundary (Β±15%)0
Mean entropy–

P(ai) Confidence Calibration Histogram (0–100% in 5 bins)

Live calibration samples vs tuned decision threshold
Sample Domain P(ai) Logit margin Entropy Decision @ T
Click "Run 6-sample calibration sweep" above to populate real calibration scores.

See inside the code

Show the code β€” anime-core.mjs: computeOcclusionGrid() & computeOcclusionSaliency()
Show the code β€” anime-core.mjs: buildConfidenceHistogram() & evaluateThresholdCalibration()
Show the code β€” anime.js: drawOcclusionHeatmap() (16Γ—16 ViT grid + signed Ξ” P(ai) tint)

References