File size: 2,395 Bytes
362c87c
 
 
 
 
 
5866a87
 
 
 
 
362c87c
 
 
 
5866a87
362c87c
32132bd
5866a87
 
 
 
 
 
 
 
362c87c
5866a87
 
362c87c
736c913
 
 
 
 
 
 
 
 
362c87c
 
 
 
 
b684f27
362c87c
 
 
5866a87
362c87c
b684f27
736c913
362c87c
5866a87
362c87c
5866a87
 
362c87c
5866a87
362c87c
5866a87
362c87c
5866a87
 
736c913
b684f27
362c87c
 
 
 
 
5866a87
362c87c
 
b684f27
 
 
 
 
 
5866a87
 
 
 
 
362c87c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
# Doc / guide: https://huggingface.co/docs/hub/model-cards
{}
---

# 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:

| Hyperparameter          | Value      |
|-------------------------|------------|
| Train Batch Size        | 32         |
| Eval Batch Size         | 64         |
| Learning Rate           | 2e-4       |
| Gradient Accumulation   | 2          |
| LR Scheduler            | Linear     |
| Warmup Ratio            | 0.04       |
| Num Epochs              | 10         |








## 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](https://mlco2.github.io/impact#compute)  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