An EfficientNet-B2 model that classifies anime frames into 5 production style categories, expanding on v5 by splitting the painterly class into distinct pencil-sketch and painterly substyles. It can also produce 1,408-dimensional pooled feature embeddings for measuring visual similarity between frames. These embeddings are useful for style-oriented search, but are not guaranteed to be independent of image content.
All errors are borderline cases. Click any thumbnail to view full size.
Image
True
Predicted
Confidence
Notes
flat
retro
51.8%
Cel-shaded chibi art resembles vintage style
modern
flat
70.6%
Minimalist scene with almost no shading
retro
modern
94.3%
High-confidence error — clean remaster
retro
modern
88.5%
Muted palette but sharp compositing
stylised_painterly
flat
92.0%
AI-gen with minimal texture; reads as flat
stylised_painterly
stylised_pencil
96.0%
Ink-wash with strong pencil line dominance
stylised_painterly
modern
55.8%
Synthetic frame; clean digital finish undermines painterly read
stylised_pencil
retro
49.8%
Low-confidence; grainy scan resembles cel-era
stylised_pencil
flat
77.6%
Clean lines with minimal visible stroke texture
stylised_pencil
stylised_painterly
56.3%
Pastel wash over sketch — genuinely transitional
Comparison to V5 (4-class Baseline)
Metric
V5 (4-class)
V6 (5-class)
Notes
Overall OOD
98.41%
96.30%
−2.11pp (acceptable tradeoff for added granularity)
Flat
100.0%
98.6%
−1.4pp
Modern
98.5%
99.0%
+0.5pp ✓
Retro
99.0%
94.0%
−5pp (hard class, cel-era mastered series)
Painterly (V5)
94.0%
90.9% / 88.6%
V6 splits into painterly (90.9%) + pencil (88.6%)
Training Data
19,611
97,444
+397% (larger dataset, same architecture)
Architecture
Same
Same
EfficientNet-B2 @ 440px
Loss Function
Cross-entropy + merge
ASL (Asymmetric Softmax)
ASL delivers +8pp vs CE baseline
Why the Tradeoff?
V5's high accuracy (98.41% OOD) came from a small, highly-curated 19.6k image dataset and class-balanced sampling. V6 training expanded to 97.4k images across 5 classes to separate pencil and painterly:
Data imbalance: Retro has nearly 15× more training samples than flat (dataset-driven split, not architecture-driven)
Annotation subjectivity: The pencil class has 35 examples in the reported OOD benchmark (small sample size)
Boundary ambiguity: Pencil/painterly blend on 2-3% of training images (subjective human labels)
The 2.11pp OOD drop is acceptable given the added classification granularity. Pencil is the weakest class at 88.6%; the other reported class recalls range from 90.9% to 99.0%.
Shared Class Performance (V5 v6 split analysis)
For direct comparison, merging V6's painterly + pencil back into single "painterly" class:
V5 painterly: 94.0% (47/50 OOD)
V6 painterly+pencil merged: 90.6% (71/79 OOD)
Delta: −3.4pp (expected from increased training distribution mismatch)
< 0.85 confidence: Review recommended, especially for pencil class
Use as Style Embedding Model
Beyond classification, this model produces 1,408-dimensional embeddings by global-average-pooling the final convolutional feature map. They may capture visual drawing characteristics such as line weight, shading technique, color palette, and compositing approach, but can also retain scene-content information.
This enables:
Batch style search: Find all frames in a 1.5M screencap corpus with matching visual drawing style
Series identification: Cluster frames by series/studio without using metadata
Style interpolation: Measure how a show's visual style evolves over seasons
Synthetic dataset balance: Find style-similar examples of underrepresented classes
Embedding Usage
python
1import torch
2from safetensors.torch import load_file
3import timm
4from PIL import Image
5from torchvision import transforms
67# Load model8model = timm.create_model('efficientnet_b2', num_classes=5, pretrained=False)9state_dict = load_file('model.safetensors')10model.load_state_dict(state_dict)11model.eval()1213transform = transforms.Compose([14 transforms.Resize((440,440)),15 transforms.ToTensor(),16 transforms.Normalize([0.485,0.456,0.406],[0.229,0.224,0.225]),17])1819defget_style_embedding(image_path):20"""Extract a 1,408-dim embedding from the final convolutional features."""21 img = Image.open(image_path).convert('RGB')22 x = transform(img).unsqueeze(0)23with torch.no_grad():24 features = model.forward_features(x)# [1, 1408, 14, 14]25 embedding = features.mean(dim=[-2,-1])# [1, 1408] global avg pool26 embedding = embedding / embedding.norm(dim=1, keepdim=True)# L2 normalize27return embedding.squeeze(0).numpy()2829# Compare two frames30emb_a = get_style_embedding('frame_a.jpg')31emb_b = get_style_embedding('frame_b.jpg')32similarity = emb_a @ emb_b # cosine similarity (embeddings are L2-normalized)33print(f'Style similarity: {similarity:.4f}')34# > 0.8 = very similar style (likely same series/studio)35# 0.5-0.8 = same style family (e.g., both modern)36# 0.2-0.5 = different but adjacent styles (e.g., modern vs retro)37# < 0.2 = opposite ends of spectrum (e.g., flat vs modern)
Interpreting Embedding Distances
Cosine Similarity
Interpretation
> 0.8
Near-identical style (same series, same studio, same season)
0.5 – 0.8
Same style family (e.g., two modern AAA shows, or two retro productions)
0.2 – 0.5
Different style families but compatible (e.g., modern + painterly)
< 0.2
Opposite ends of style spectrum (e.g., flat vs modern digital)
The embedding captures how something is drawn — line weight, shading technique, color palette, compositing — not what is drawn. Scenes with completely different content (landscapes vs close-ups vs action sequences) from the same series will cluster together.
Split: 78,144 train / 9,744 val / 9,556 held-out OOD
Loss Function Innovation: Asymmetric Softmax (ASL)
Standard cross-entropy treats all mistakes equally. Anime style classification is imbalanced:
In-distribution: Most training images are clean, well-lit frames with clear style markers (easy to classify)
Out-of-distribution (OOD): Test images include ambiguous boundary cases, poor lighting, style blends (hard to classify)
Asymmetric Softmax solves this by:
Hard negatives (γ_neg = 4.0): Penalize false positives heavily → sharp decision boundaries on negatives
Soft positives (γ_pos = 1.0): Keep positive examples less strict → model learns to be confident without overfitting
Formula:p_t = (1 - p)^γ_neg * CE for negatives; p_t^γ_pos * CE for positives
Impact: +8.04pp over the cross-entropy baseline on the separate 131-image OOD experiment (89.38% CE → 97.42% ASL)
This single loss choice was more impactful than:
Merge experiments (best merge: 95.54% on that experiment, underperformed standalone ASL)
Post-hoc fine-tuning (specialization attempted but minimal divergence from baseline)
Different architectures (EfficientNet-B2 already optimal for this scale)
Training Pipeline
Base training: EfficientNet-B2 (ImageNet pretrained), ASL loss, batch-balanced sampling (upweight flat class 3×)
Optimizer: AdamW with 1e-3 initial LR, cosine annealing over 25 epochs
Validation: held-out OOD data; the model-card result above is reported on 459 images. The loss-comparison experiments below use a separate 131-image OOD split.
Best checkpoint: Epoch 9/25, saved based on OOD accuracy (not validation loss)
Why ASL over Alternative Losses?
Loss
Purpose
OOD Result
Notes
Cross-Entropy
Baseline
89.38%
Separate 131-image OOD experiment
ASL (γ_neg=4.0)
Hard negatives
97.42%
✓ Winner in the separate 131-image experiment
Focal Loss
Hard examples
95.54%
Same experiment; did not match ASL's specificity
Label Smoothing
Calibration
95.07%
Same experiment; hurt OOD performance on ambiguous cases
ASL's asymmetry perfectly matched the OOD challenge structure.
Limitations
Trained primarily on Japanese anime (TV series, films). May not generalize to:
❌ Western animation (different art direction traditions)
❌ Donghua (Chinese animation with distinct visual language)
❌ Manhwa (Korean webtoon styles)
Class-Specific Limitations
⚠️ Pencil class weak: 88.6% OOD accuracy (31/35). Limited training diversity and a subjective boundary with painterly. Its four errors were split across flat (2), retro (1), and painterly (1). Recommend a higher confidence threshold for pencil predictions.
⚠️ Painterly/pencil boundary: Subjective when styles blend (watercolor overlay on sketch lines, mixed-media). The reported confusion matrix contains 2 such cross-class errors out of 17 total errors.
⚠️ AI-generated art: Models trained on diffusion outputs (ComfyUI, Stable Diffusion) often misclassify between painterly and modern when they successfully mimic style.
⚠️ Flat class variability: Increased from 0 to 3 errors vs V5 due to larger training distribution mismatch.
What This Model is NOT
❌ Not a character design classifier — won't detect moe, chibi, bishounen, etc.
❌ Not a content classifier — sees how it's drawn, not what
❌ Not an era detector — a modern show using cel technique → retro (correct)
❌ Not a quality scorer — good and bad frames of the same style both classify identically
❌ Not an AI detector — AI art that successfully mimics a style gets classified by that style
Future Work (v6.1+)
Immediate Priorities (pencil class improvement)
The pencil class (88.6% OOD) is the main constraint on v6's overall performance. Paths forward:
Hard negative mining — Collect confident pencil misclassifications, especially near the painterly boundary. Retrain on these hard examples (20-50 images) to tighten the boundary.
Curriculum learning — Instead of fixed class weights, progressively increase pencil focus over epochs (0.5× → 1.0× → 3.0×), allowing the model to develop richer representations.
Synthetic pencil augmentation — Generate pencil-style images via style transfer or CLIP-guided diffusion to expand diversity.
Ensemble with V5 — Combine V6's 5-class precision with V5's 4-class robustness via voting or weighted logits to hedge pencil weakness.
Medium-term Improvements
Contrastive learning — Explicitly push pencil and painterly embeddings apart using contrastive loss on borderline examples.
OOD-aware training — If oracle OOD labels are available during training, use them in loss function to optimize for OOD rather than validation.
Multi-scale inference — Ensemble predictions at 440px and 512px (as V5 did) to capture different receptive fields.
Research Directions
Causal analysis — Which image features most influence pencil misclassifications? (Line density? Stroke boldness? Color saturation?)
Style interpolation — Measure how visual style evolves over a series' runtime using embeddings.
Synthetic dataset balancing — Use style embeddings to find and clone style-similar images for underrepresented classes (flat, pencil).
Citation
bibtex
1@misc{anime-style-classifier-v6,
2 title={Anime Style Classifier V6},
3 year={2026},
4 publisher={HuggingFace},
5 note={EfficientNet-B2 (7.7M) fine-tuned with Asymmetric Softmax loss for 5-class anime production style classification}
6}