Downloads · 30 days
1
3% of all-time downloads
Mitchins/anime-frame-garbage-classifier-s
anime-frame-garbage-classifier-s 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.
Binary classification model for filtering objectively-bad frames (black, blurry, uniform-color, low-detail) in anime video preprocessing pipelines.
Downloads · 30 days
1
3% of all-time downloads
All-time downloads
38
Public
Repo size
19.9 MB
Likes
0
Public
Click a slice to open those files.
.bin19.9 MB · 100%
From the Hugging Face model README
Binary classification model for filtering objectively-bad frames (black, blurry, uniform-color, low-detail) in anime video preprocessing pipelines.
Without threshold (0.5):
With optimal threshold (0.7115):
import torch
import timm
from torchvision import transforms
from PIL import Image
# Load model
model = timm.create_model('mobilevit_s', 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.7115 # Use optimal threshold
Filters frames with:
MIT