Downloads · 30 days
3
9% of all-time downloads
Mitchins/anime-frame-garbage-classifier-xs
anime-frame-garbage-classifier-xs is a image classification model from Mitchins. Use it when you need a label for an image. It is set up for timm. The card lists the license as mit.
Compact binary classification model for filtering objectively-bad frames in anime video preprocessing. Optimized for size with minimal accuracy loss.
Downloads · 30 days
3
9% of all-time downloads
All-time downloads
35
Public
Repo size
7.9 MB
Likes
0
Public
Click a slice to open those files.
.bin7.9 MB · 100%
From the Hugging Face model README
Compact binary classification model for filtering objectively-bad frames in anime video preprocessing. Optimized for size with minimal accuracy loss.
Without threshold (0.5):
With optimal threshold (0.6315):
import torch
import timm
from torchvision import transforms
from PIL import Image
# Load model
model = timm.create_model('mobilevit_xs', num_classes=2, pretrained=False)
model.load_state_dict(torch.load('pytorch_model.bin'))
model.eval()
# Prepare image
transform = transforms.Compose([
transforms.Resize((256, 256)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
])
img = transform(Image.open('frame.webp').convert('RGB')).unsqueeze(0).cuda()
# Predict
with torch.no_grad():
logits = model(img)
probs = torch.softmax(logits, dim=1)
garbage_prob = probs[0, 0].item() # Class 0 = garbage
# Decision
is_garbage = garbage_prob > 0.6315 # Use optimal threshold
Filters frames with:
MobileViT-XS is 60% smaller (7.6MB vs 20MB) with only 0.15pp F1 loss (93.72% vs 93.87%). Use for memory-constrained deployments.
MIT