CoolFace
Modelpublic

HardlyHumans/Facial-expression-detection

sourceHugging Faceupdated 2y agoView on Hugging Face
3likes584downloads
Model Card

Facial-Expression-Recognition

This model is a fine-tuned version of google/vit-base-patch16-224-in21k on the FER 2013 and AffectNet dataset datasets. It achieves the following results on the evaluation set: Accuracy - 0.922 Loss - 0.213

Model Description

The vit-face-expression model is a Vision Transformer fine-tuned for the task of facial emotion recognition.

It is trained on the FER2013and AffectNet datasets, which consist of facial images categorized into eight different emotions: -anger -contempt -sad -happy -neutral -disgust -fear -surprise

Model Details

The model has been fine-tuned using the following hyperparameters:

HyperparameterValue
Train Batch Size32
Eval Batch Size64
Learning Rate2e-4
Gradient Accumulation2
LR SchedulerLinear
Warmup Ratio0.04
Num Epochs10

How to Get Started with the Model

Example usage:

python
from transformers import AutoImageProcessor, AutoModelForImageClassification, pipeline

pipe = pipeline("image-classification", model="HardlyHumans/Facial-expression-detection")

processor = AutoImageProcessor.from_pretrained("HardlyHumans/Facial-expression-detection")
model = AutoModelForImageClassification.from_pretrained("HardlyHumans/Facial-expression-detection")

labels = model.config.id2label

outputs = model(**inputs)

logits = outputs.logits
predicted_class_idx = logits.argmax(-1).item()
predicted_label = labels[predicted_class_idx]

Environmental Impact

The net estimated CO2 emission using the Machine Learning Impact calculator scale is around 8.82kg of CO2.

  • —Developed by: Hardly Humans club, IIT Dharwad
  • —Model type: Vision transformer
  • —License: MIT
  • —Finetuned from model: google/vit-base-patch16-224-in21k
  • —Hardware Type: T4
  • —Hours used: 8+27
  • —Cloud Provider: Google collabotary service
  • —Compute Region: South asia-1
  • —Carbon Emitted: 8.82

Model Architecture and Objective