TensorBoard
ONNX
English
File size: 2,067 Bytes
9522d5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
language:
- en
base_model:
- WinKawaks/vit-tiny-patch16-224
datasets:
- deanngkl/ferplus-7cls
- deanngkl/raf-db-7emotions
- deanngkl/affectnet_no_contempt
metrics:
- accuracy
---

# Vision Transformer for Facial Expression Classifier

A deep learning project that fine-tunes a Vision Transformer (ViT-Tiny) model for 7-class facial emotion classification using cleaned versions of FER+, AffectNet, and RAF-DB datasets.

## πŸ“Œ Project Highlights

- πŸ” 7-class emotion classification: `['anger', 'disgust', 'fear', 'happiness', 'neutral', 'sadness', 'surprise']`
- 🧠 Model: ViT-Tiny (`timm` implementation)
- 🎯 Achieved 82% validation accuracy on a blended hold-out set (8 377 images)
- πŸ“š Cleaned & uploaded datasets to Hugging Face Datasets
- πŸ§ͺ Integrated CutMix, cosine decay scheduler, and AMP for training

---

## πŸ“¦ Datasets

| Dataset     | Link                                                                 | Notes                          |
|-------------|----------------------------------------------------------------------|--------------------------------|
| FER+        | [Hugging Face](https://huggingface.co/datasets/deanngkl/ferplus-7cls)         | Filtered to 7 basic emotions   |
| AffectNet   | [Hugging Face](https://huggingface.co/datasets/deanngkl/affectnet_no_contempt) | Removed 'contempt' class       |
| RAF-DB      | [Hugging Face](https://huggingface.co/datasets/deanngkl/raf-db-7emotions)      | Added proper emotion labels    |

The total amount of datasets

```html
Loaded 75398 training samples from 3 sources
Loaded 8377 validation samples from 3 sources
Training-set distribution:
  0: 0 : 9738
  1: 1 : 3385
  2: 2 : 4313
  3: 3 : 18315
  4: 4 : 20987
  5: 5 : 9289
  6: 6 : 9371
Emotion batch torch.Size([64, 3, 224, 224])
```

---

πŸ™‹β€β™‚οΈ Author
### Dean Ng Kwan Lung
Blog        : [Portfolio](https://kwanlung.github.io/)  
LinkedIn    : [LinkedIn](https://www.linkedin.com/in/deanng00/)  
GitHub      : [GitHub](https://github.com/kwanlung)  
Email       : kwanlung123@gmail.com