Downloads · 30 days
21
4% of all-time downloads
Dc-4nderson/vit-emotion-classifier
vit-emotion-classifier is a image classification model from Dc-4nderson. Use it when you need a label for an image. It is set up for transformers. The card lists the license as mit.
This is a lightweight Vision Transformer (ViT) model fine-tuned to classify emotions from facial images using a custom dataset of school-aged individuals. It supports 8 emotional categories and is designed to work wel…
Downloads · 30 days
21
4% of all-time downloads
All-time downloads
598
Public
Parameters
85.8M
343 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors343 MB · 100%
From the Hugging Face model README
This is a lightweight Vision Transformer (ViT) model fine-tuned to classify emotions from facial images using a custom dataset of school-aged individuals. It supports 8 emotional categories and is designed to work well on small datasets and limited compute.
The model predicts one of the following emotional states:
| Label ID | Emotion |
|---|---|
| 0 | anxious-fearful |
| 1 | bored |
| 2 | confused |
| 3 | discouraged |
| 4 | frustrated |
| 5 | neutral |
| 6 | positive |
| 7 | suprised |
ViTForImageClassificationvit-small-patch16-224Dc-4nderson/feelings_classfication_datasetconfig.json)from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
import torch
# Load model + processor
processor = AutoImageProcessor.from_pretrained("Dc-4nderson/vit-emotion-classifier")
model = AutoModelForImageClassification.from_pretrained("Dc-4nderson/vit-emotion-classifier")
# Load image and preprocess
image = Image.open("your_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
# Run inference
with torch.no_grad():
outputs = model(**inputs)
pred = torch.argmax(outputs.logits, dim=1).item()
label = model.config.id2label[str(pred)]
print("🧠 Predicted Emotion:", label)