BEiT Face Emotion Classifier – mehmet-3emin

This model is a fine-tuned version of microsoft/beit-base-patch16-224-pt22k-ft22k, optimized for facial emotion classification in static face images.

It was prepared and refined as part of a senior graduation project titled "Videodan Duygusallık Analizi" (Emotion Analysis from Video) at Mersin University (2025).

The goal of the model is to analyze facial expressions and classify them into seven basic emotions.

🧠 Model Architecture

  • Base: BEiT (Bidirectional Encoder representation from Image Transformers)
  • Patch size: 16x16
  • Input size: 224x224 RGB
  • Fine-tuned on: FER2013 dataset
  • Output: One of 7 emotion classes

🏷️ Classes

The model predicts one of the following emotions:

Label ID Emotion
0 Angry
1 Disgust
2 Fear
3 Happy
4 Neutral
5 Sad
6 Surprise

🧪 Example Usage

from transformers import BeitForImageClassification, AutoImageProcessor
from PIL import Image
import torch

model = BeitForImageClassification.from_pretrained("mehmet-3emin/beit-face-emotion")
processor = AutoImageProcessor.from_pretrained("mehmet-3emin/beit-face-emotion")

image = Image.open("your_face_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits
    predicted_label = logits.argmax(-1).item()

print(predicted_label)
Downloads last month
18
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support