Skip to content
image-classification Β· vision ViT-B/32 Β· 512Γ—512 Β· 16Γ—16 Patches WASM q8 Β· 88.94 MB License: Apache-2.0

AI Anime Image Detector ViT β€” Synthetic vs Human Illustration Classifier

Fine-tuned from a 12-layer Vision Transformer on 1M human-drawn and 217K AI-generated anime illustrations at native 512Γ—512 resolution (32Γ—32 patches, 16Γ—16 = 256 spatial tokens + [CLS]), running locally in a Web Worker via 88.94 MB CPU WASM q8.

At a glance

AI Anime Image Detector ViT model specification and runtime grounding
Upstream base model legekka/AI-Anime-Image-Detector-ViT
Loaded ONNX repo onnx-community/AI-Anime-Image-Detector-ViT-ONNX (onnx/model_quantized.onnx)
Pipeline task image-classification Β· id2label {"0": "real", "1": "ai"}
Architecture ViTForImageClassification (vit) β€” 12 layers, 12 heads, hidden size 768, MLP 3072, 512Γ—512 input, 32Γ—32 patches (16Γ—16 grid + [CLS])
Image processor ViTImageProcessor β€” 512Γ—512 bilinear resize, rescale 1/255, mean [0.5, 0.5, 0.5], std [0.5, 0.5, 0.5]
Backend & size CPU WASM q8 β€” 88.94 MB (88,943,600 B) via local @huggingface/transformers@4.3.0 worker pin (3.7.5 WASM EP lacks ConvInteger(10) for /vit/embeddings/patch_embeddings/projection/Conv_quant)
License Apache-2.0 (upstream checkpoint and ONNX conversion)

Live Synthetic vs Human Illustration Classifier

Test deterministic procedural anime illustration plates, rights-cleared gallery photos/charts (out-of-domain controls), uploaded artwork, clipboard paste (Ctrl/Cmd+V), or a webcam snapshot. Inference and logit extraction run 100% locally in a module Web Worker.

Initialising model loader…

No artwork selected yet.

Top verdict–
P(ai)–
P(real)–
Logit margin (ai βˆ’ real)–
Shannon entropy–
Latency–
Backend / dtypewasm Β· q8
NaN / invalid0
Raw pipeline output & logits (exact id2label real/ai readout)
{}

See inside the ViT-B/32 @ 512Γ—512 pipeline

Unlike 224Γ—224 ImageNet ViTs that downsample away subtle brush strokes, screentone dots, and latent diffusion upsampling artifacts, AI-Anime-Image-Detector-ViT preserves a 512Γ—512 input frame and projects 32Γ—32 pixel patches into a 16Γ—16 token grid (256 spatial patches + 1 [CLS] token).

How the API works

Transformers.js executes onnx-community/AI-Anime-Image-Detector-ViT-ONNX inside a module Web Worker pinned locally to @huggingface/transformers@4.3.0 so ORT-Web executes the quantized ConvInteger patch projection cleanly:

import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0";

const detector = await pipeline(
  "image-classification",
  "onnx-community/AI-Anime-Image-Detector-ViT-ONNX",
  { device: "wasm", dtype: "q8" },
);
const results = await detector(image, { top_k: 2 });
// -> [{ label: "real", score: ... }, { label: "ai", score: ... }]

See inside the code

Inspect the exact ES modules powering this page β€” local 4.3.0 worker load, single-pass logit extraction, and pure binary analysis maths.

Show the code β€” worker.js: ensureLoaded() (local 4.3.0 WASM q8 + epoch guards)
Show the code β€” worker.js: classifyImage() (white-flatten, raw logits, real nanCount)
Show the code β€” anime-core.mjs: analyzeDetection() (logit margin & Shannon entropy)

Explore the 5-route use-case ladder

References & model card