ViT-Base Elderly Emotion Recognition πŸ‘΅πŸ§“

Fine-tuned Vision Transformer (ViT-base-patch16-224) for recognizing emotional expressions specifically in senior citizens / elderly individuals.

Developed as part of the undergraduate thesis at Gunadarma University (Department of Informatics, 2025) by Felix Rafael under the supervision of Dr. Guntur Eka Saputra, S.T., M.M.S.I.


πŸ“Œ Model Overview

Property Details
Base Architecture Vision Transformer (google/vit-base-patch16-224-in21k)
Input Resolution 224 Γ— 224 pixels (RGB)
Number of Parameters ~86 Million
Target Population Elderly / Senior Citizens (Age 60+)
Target Classes 5 Emotions: Angry, Fear, Happy, Neutral, Sad
Evaluation Accuracy 92.00% on held-out elderly test set

Elderly facial expressions differ significantly from general-population benchmarks (e.g., FER2013 or AffectNet) due to physiological age factors such as skin laxity, dynamic wrinkles, and altered muscle mobility. This model was fine-tuned specifically to capture subtle elderly facial affect patterns.


πŸ“Š Benchmark & Performance Comparison

In extensive empirical benchmarks documented in the thesis, Vision Transformer (ViT) substantially outperformed classical Convolutional Neural Network architectures on elderly facial expressions:

Model Comparison on Elderly Emotion Dataset

Architecture Backbone / Pretrain Test Accuracy Macro F1 Performance Gap vs ViT
πŸ₯‡ ViT-base-patch16 (Ours) ImageNet-21k 92.00% 0.92 Baseline
πŸ₯ˆ ResNet-50 ImageNet-1k 59.00% 0.58 -33.00%
πŸ₯‰ DenseNet-121 ImageNet-1k 57.00% 0.56 -35.00%
4️⃣ EfficientNet-B0 ImageNet-1k 51.00% 0.49 -41.00%

Per-Class Detailed Metrics (ViT-base-patch16)

Emotion Precision Recall F1-Score
Happy 😊 1.00 1.00 1.00
Neutral 😐 0.88 1.00 0.94
Sad 😒 0.85 0.97 0.91
Fear 😨 0.90 0.90 0.90
Angry 😠 1.00 0.73 0.85
Macro Average 0.93 0.92 0.92

πŸ“‚ Training Data & Methodology

The dataset comprises a total of 1,004 curated elderly facial images (854 training, 150 independent held-out test):

  1. Primary Dataset: Direct observational recordings and guided expression sessions with senior citizen participants in Jakarta and Depok, Indonesia.
  2. Secondary Datasets: Carefully curated subset from UTKFace and All-Age-Faces (AAF) filtered strictly for subjects aged 60 and older.

Training Configuration

  • Optimizer: AdamW (lr=2e-5, weight decay 0.01)
  • Loss Function: CrossEntropyLoss
  • Data Augmentation: RandomHorizontalFlip, ColorJitter, RandomRotation (Β±10Β°), Normalized (mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]).

πŸ’» How to Use

import torch
from PIL import Image
from transformers import AutoModelForImageClassification
import torchvision.transforms as transforms

# 1. Load model
repo_id = "pelikrapael/vit-base-elderly-emotion-recognition"
model = AutoModelForImageClassification.from_pretrained(repo_id)
model.eval()

# 2. Preprocess input image
transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
])

image = Image.open("path_to_elderly_face.jpg").convert("RGB")
tensor = transform(image).unsqueeze(0)

# 3. Inference
class_names = ['Angry', 'Fear', 'Happy', 'Neutral', 'Sad']
with torch.no_grad():
    logits = model(tensor).logits
    probs = torch.softmax(logits, dim=-1)[0]
    pred_idx = torch.argmax(probs).item()

print(f"Predicted Emotion: {class_names[pred_idx]} ({probs[pred_idx]*100:.2f}%)")

πŸ™ Acknowledgments & Credits

Special gratitude and heartfelt appreciation are extended to:

  1. The Senior Citizen Participants who generously took part in the primary data collection and emotional recording sessions. Their voluntary contributions form the vital foundation of this research.
  2. Dr. Guntur Eka Saputra, S.T., M.M.S.I., as academic thesis advisor at Gunadarma University, for invaluable technical guidance and direction throughout the development of this project.
  3. Gunadarma University, Faculty of Industrial Technology, Department of Informatics.
  4. Curators and authors of the UTKFace (Zhang et al.) and All-Age-Faces (AAF) (Cheng et al.) datasets for making high-quality demographic visual data accessible to the scientific community.

πŸ“– Citation

If you use this model or refer to the research, please cite:

@misc{rafael2025elderlyemotion,
  author       = {Felix Rafael and Guntur Eka Saputra},
  title        = {Multimodal Elderly Emotion Detection System Using Convolutional Neural Network and Vision Transformer},
  year         = {2025},
  publisher    = {Gunadarma University},
  address      = {Jakarta, Indonesia},
  note         = {Undergraduate Thesis, Department of Informatics, Faculty of Industrial Technology}
}
Downloads last month
4
Safetensors
Model size
85.8M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Evaluation results