Datasets:
Formats:
parquet
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
fer2013
facial-expression-recognition
emotion-recognition
emotion-detection
computer-vision
deep-learning
License:
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -27,59 +27,6 @@ size_categories:
|
|
| 27 |
language:
|
| 28 |
- en
|
| 29 |
pretty_name: "FER2013 Enhanced: Advanced Facial Expression Recognition Dataset"
|
| 30 |
-
dataset_info:
|
| 31 |
-
features:
|
| 32 |
-
- name: sample_id
|
| 33 |
-
dtype: string
|
| 34 |
-
- name: image
|
| 35 |
-
dtype:
|
| 36 |
-
_type: Array2D
|
| 37 |
-
shape: [48, 48]
|
| 38 |
-
dtype: uint8
|
| 39 |
-
- name: emotion
|
| 40 |
-
dtype:
|
| 41 |
-
_type: ClassLabel
|
| 42 |
-
names: ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral']
|
| 43 |
-
- name: emotion_name
|
| 44 |
-
dtype: string
|
| 45 |
-
- name: pixels
|
| 46 |
-
dtype: string
|
| 47 |
-
- name: usage
|
| 48 |
-
dtype: string
|
| 49 |
-
- name: quality_score
|
| 50 |
-
dtype: float32
|
| 51 |
-
- name: brightness
|
| 52 |
-
dtype: float32
|
| 53 |
-
- name: contrast
|
| 54 |
-
dtype: float32
|
| 55 |
-
- name: sample_weight
|
| 56 |
-
dtype: float32
|
| 57 |
-
- name: pixel_mean
|
| 58 |
-
dtype: float32
|
| 59 |
-
- name: pixel_std
|
| 60 |
-
dtype: float32
|
| 61 |
-
- name: pixel_min
|
| 62 |
-
dtype: uint8
|
| 63 |
-
- name: pixel_max
|
| 64 |
-
dtype: uint8
|
| 65 |
-
- name: edge_score
|
| 66 |
-
dtype: float32
|
| 67 |
-
- name: focus_score
|
| 68 |
-
dtype: float32
|
| 69 |
-
- name: brightness_score
|
| 70 |
-
dtype: float32
|
| 71 |
-
splits:
|
| 72 |
-
- name: train
|
| 73 |
-
num_bytes: 15000000
|
| 74 |
-
num_examples: 25117
|
| 75 |
-
- name: validation
|
| 76 |
-
num_bytes: 3200000
|
| 77 |
-
num_examples: 5380
|
| 78 |
-
- name: test
|
| 79 |
-
num_bytes: 3200000
|
| 80 |
-
num_examples: 5390
|
| 81 |
-
download_size: 80000000
|
| 82 |
-
dataset_size: 21400000
|
| 83 |
viewer: true
|
| 84 |
---
|
| 85 |
|
|
@@ -122,7 +69,6 @@ viewer: true
|
|
| 122 |
| Surprise | 4,002 | 11.2% |
|
| 123 |
| Neutral | 6,198 | 17.3% |
|
| 124 |
|
| 125 |
-
|
| 126 |
## ๐ง Quick Start
|
| 127 |
|
| 128 |
### Installation and Loading
|
|
@@ -172,68 +118,160 @@ print(f"Brightness: {sample['brightness']:.1f}")
|
|
| 172 |
print(f"Contrast: {sample['contrast']:.1f}")
|
| 173 |
```
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
Each sample includes the original FER2013 data plus these enhancements:
|
| 178 |
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
'brightness_score': 0.789, # Brightness balance
|
| 193 |
-
'pixel_mean': 127.5, # Pixel statistics
|
| 194 |
-
'pixel_std': 45.2,
|
| 195 |
-
'pixel_min': 0,
|
| 196 |
-
'pixel_max': 255
|
| 197 |
-
}
|
| 198 |
-
```
|
| 199 |
|
| 200 |
### Emotion Labels
|
| 201 |
|
| 202 |
-
- 0:
|
| 203 |
-
- 1:
|
| 204 |
-
- 2:
|
| 205 |
-
- 3:
|
| 206 |
-
- 4:
|
| 207 |
-
- 5:
|
| 208 |
-
- 6:
|
| 209 |
|
| 210 |
-
##
|
| 211 |
|
| 212 |
### Quality Score Components
|
| 213 |
|
| 214 |
-
Each image receives a comprehensive quality assessment:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
-
|
| 217 |
-
- Sobel gradient magnitude calculation
|
| 218 |
-
- Measures facial feature clarity and definition
|
| 219 |
-
- Higher scores indicate clearer facial boundaries
|
| 220 |
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
|
| 226 |
-
|
| 227 |
-
- Laplacian variance calculation
|
| 228 |
-
- Detects blur and image sharpness
|
| 229 |
-
- Critical for fine-grained emotion detection
|
| 230 |
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
|
|
|
|
|
|
| 235 |
|
| 236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
|
| 238 |
If you use FER2013 Enhanced in your research, please cite:
|
| 239 |
|
|
@@ -245,11 +283,34 @@ If you use FER2013 Enhanced in your research, please cite:
|
|
| 245 |
publisher={Hugging Face},
|
| 246 |
url={https://huggingface.co/datasets/abhilash88/fer2013-enhanced}
|
| 247 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
```
|
| 249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
## ๐ License
|
| 251 |
|
| 252 |
-
This enhanced dataset is released under the **MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
---
|
| 255 |
|
|
@@ -257,4 +318,4 @@ This enhanced dataset is released under the **MIT License**.
|
|
| 257 |
|
| 258 |
*Start with `pip install datasets` and `from datasets import load_dataset`*
|
| 259 |
|
| 260 |
-
*Last updated:
|
|
|
|
| 27 |
language:
|
| 28 |
- en
|
| 29 |
pretty_name: "FER2013 Enhanced: Advanced Facial Expression Recognition Dataset"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
viewer: true
|
| 31 |
---
|
| 32 |
|
|
|
|
| 69 |
| Surprise | 4,002 | 11.2% |
|
| 70 |
| Neutral | 6,198 | 17.3% |
|
| 71 |
|
|
|
|
| 72 |
## ๐ง Quick Start
|
| 73 |
|
| 74 |
### Installation and Loading
|
|
|
|
| 118 |
print(f"Contrast: {sample['contrast']:.1f}")
|
| 119 |
```
|
| 120 |
|
| 121 |
+
## ๐ฌ Enhanced Features
|
| 122 |
|
| 123 |
Each sample includes the original FER2013 data plus these enhancements:
|
| 124 |
|
| 125 |
+
- **`sample_id`**: Unique identifier for each sample
|
| 126 |
+
- **`emotion`**: Emotion label (0-6)
|
| 127 |
+
- **`emotion_name`**: Human-readable emotion name
|
| 128 |
+
- **`image`**: 48ร48 grayscale image array
|
| 129 |
+
- **`pixels`**: Original pixel string format
|
| 130 |
+
- **`quality_score`**: AI-computed quality assessment (0-1)
|
| 131 |
+
- **`brightness`**: Average pixel brightness (0-255)
|
| 132 |
+
- **`contrast`**: Pixel standard deviation
|
| 133 |
+
- **`sample_weight`**: Class balancing weight
|
| 134 |
+
- **`edge_score`**: Edge content measure
|
| 135 |
+
- **`focus_score`**: Image sharpness assessment
|
| 136 |
+
- **`brightness_score`**: Brightness balance score
|
| 137 |
+
- **Pixel Statistics**: `pixel_mean`, `pixel_std`, `pixel_min`, `pixel_max`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
### Emotion Labels
|
| 140 |
|
| 141 |
+
- **0: Angry** - Expressions of anger, frustration, irritation
|
| 142 |
+
- **1: Disgust** - Expressions of disgust, revulsion, distaste
|
| 143 |
+
- **2: Fear** - Expressions of fear, anxiety, worry
|
| 144 |
+
- **3: Happy** - Expressions of happiness, joy, contentment
|
| 145 |
+
- **4: Sad** - Expressions of sadness, sorrow, melancholy
|
| 146 |
+
- **5: Surprise** - Expressions of surprise, astonishment, shock
|
| 147 |
+
- **6: Neutral** - Neutral expressions, no clear emotion
|
| 148 |
|
| 149 |
+
## ๐ Quality Assessment
|
| 150 |
|
| 151 |
### Quality Score Components
|
| 152 |
|
| 153 |
+
Each image receives a comprehensive quality assessment based on:
|
| 154 |
+
|
| 155 |
+
1. **Edge Content Analysis (30% weight)** - Facial feature clarity and definition
|
| 156 |
+
2. **Contrast Evaluation (30% weight)** - Visual distinction and dynamic range
|
| 157 |
+
3. **Focus/Sharpness Measurement (25% weight)** - Image blur detection
|
| 158 |
+
4. **Brightness Balance (15% weight)** - Optimal illumination assessment
|
| 159 |
+
|
| 160 |
+
### Quality-Based Usage
|
| 161 |
+
|
| 162 |
+
```python
|
| 163 |
+
# Filter by quality thresholds
|
| 164 |
+
high_quality = dataset["train"].filter(lambda x: x["quality_score"] > 0.7)
|
| 165 |
+
medium_quality = dataset["train"].filter(lambda x: x["quality_score"] > 0.4)
|
| 166 |
+
|
| 167 |
+
print(f"High quality samples: {len(high_quality):,}")
|
| 168 |
+
print(f"Medium+ quality samples: {len(medium_quality):,}")
|
| 169 |
+
|
| 170 |
+
# Progressive training approach
|
| 171 |
+
stage1_data = dataset["train"].filter(lambda x: x["quality_score"] > 0.8) # Excellent
|
| 172 |
+
stage2_data = dataset["train"].filter(lambda x: x["quality_score"] > 0.5) # Good+
|
| 173 |
+
stage3_data = dataset["train"] # All samples
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
## ๐ Framework Integration
|
| 177 |
+
|
| 178 |
+
### PyTorch
|
| 179 |
+
|
| 180 |
+
```python
|
| 181 |
+
import torch
|
| 182 |
+
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
|
| 183 |
+
from torchvision import transforms
|
| 184 |
+
from PIL import Image
|
| 185 |
+
|
| 186 |
+
class FER2013Dataset(Dataset):
|
| 187 |
+
def __init__(self, hf_dataset, transform=None, min_quality=0.0):
|
| 188 |
+
self.data = hf_dataset.filter(lambda x: x["quality_score"] >= min_quality)
|
| 189 |
+
self.transform = transform
|
| 190 |
+
|
| 191 |
+
def __len__(self):
|
| 192 |
+
return len(self.data)
|
| 193 |
+
|
| 194 |
+
def __getitem__(self, idx):
|
| 195 |
+
sample = self.data[idx]
|
| 196 |
+
image = Image.fromarray(sample["image"], mode='L')
|
| 197 |
+
|
| 198 |
+
if self.transform:
|
| 199 |
+
image = self.transform(image)
|
| 200 |
+
|
| 201 |
+
return {
|
| 202 |
+
"image": image,
|
| 203 |
+
"emotion": torch.tensor(sample["emotion"], dtype=torch.long),
|
| 204 |
+
"quality": torch.tensor(sample["quality_score"], dtype=torch.float),
|
| 205 |
+
"weight": torch.tensor(sample["sample_weight"], dtype=torch.float)
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
# Usage with quality filtering and weighted sampling
|
| 209 |
+
transform = transforms.Compose([
|
| 210 |
+
transforms.ToTensor(),
|
| 211 |
+
transforms.Normalize(mean=[0.5], std=[0.5])
|
| 212 |
+
])
|
| 213 |
+
|
| 214 |
+
dataset = FER2013Dataset(train_data, transform=transform, min_quality=0.3)
|
| 215 |
+
weights = [sample["sample_weight"] for sample in dataset.data]
|
| 216 |
+
sampler = WeightedRandomSampler(weights, len(weights))
|
| 217 |
+
loader = DataLoader(dataset, batch_size=32, sampler=sampler)
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
### TensorFlow
|
| 221 |
+
|
| 222 |
+
```python
|
| 223 |
+
import tensorflow as tf
|
| 224 |
+
import numpy as np
|
| 225 |
+
|
| 226 |
+
def create_tf_dataset(hf_dataset, batch_size=32, min_quality=0.0):
|
| 227 |
+
# Filter by quality
|
| 228 |
+
filtered_data = hf_dataset.filter(lambda x: x["quality_score"] >= min_quality)
|
| 229 |
+
|
| 230 |
+
# Convert to TensorFlow format
|
| 231 |
+
images = np.array([sample["image"] for sample in filtered_data])
|
| 232 |
+
labels = np.array([sample["emotion"] for sample in filtered_data])
|
| 233 |
+
weights = np.array([sample["sample_weight"] for sample in filtered_data])
|
| 234 |
+
|
| 235 |
+
# Normalize images
|
| 236 |
+
images = images.astype(np.float32) / 255.0
|
| 237 |
+
images = np.expand_dims(images, axis=-1) # Add channel dimension
|
| 238 |
+
|
| 239 |
+
# Create dataset
|
| 240 |
+
dataset = tf.data.Dataset.from_tensor_slices((images, labels, weights))
|
| 241 |
+
dataset = dataset.batch(batch_size).prefetch(tf.data.AUTOTUNE)
|
| 242 |
+
|
| 243 |
+
return dataset
|
| 244 |
+
|
| 245 |
+
# Usage
|
| 246 |
+
train_tf_dataset = create_tf_dataset(train_data, batch_size=64, min_quality=0.4)
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
## ๐ Performance Benchmarks
|
| 250 |
|
| 251 |
+
Models trained on FER2013 Enhanced typically achieve:
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
+
- **Overall Accuracy**: 68-75% (vs 65-70% on original FER2013)
|
| 254 |
+
- **Quality-Weighted Accuracy**: 72-78% (emphasizing high-quality samples)
|
| 255 |
+
- **Training Efficiency**: 15-25% faster convergence due to quality filtering
|
| 256 |
+
- **Better Generalization**: More robust performance across quality ranges
|
| 257 |
|
| 258 |
+
## ๐ฌ Research Applications
|
|
|
|
|
|
|
|
|
|
| 259 |
|
| 260 |
+
### Academic Use Cases
|
| 261 |
+
- Emotion recognition algorithm development
|
| 262 |
+
- Computer vision model benchmarking
|
| 263 |
+
- Quality assessment method validation
|
| 264 |
+
- Human-computer interaction studies
|
| 265 |
+
- Affective computing research
|
| 266 |
|
| 267 |
+
### Industry Applications
|
| 268 |
+
- Customer experience analytics
|
| 269 |
+
- Mental health monitoring
|
| 270 |
+
- Educational technology
|
| 271 |
+
- Automotive safety systems
|
| 272 |
+
- Gaming and entertainment
|
| 273 |
+
|
| 274 |
+
## ๐ Citation
|
| 275 |
|
| 276 |
If you use FER2013 Enhanced in your research, please cite:
|
| 277 |
|
|
|
|
| 283 |
publisher={Hugging Face},
|
| 284 |
url={https://huggingface.co/datasets/abhilash88/fer2013-enhanced}
|
| 285 |
}
|
| 286 |
+
|
| 287 |
+
@inproceedings{goodfellow2013challenges,
|
| 288 |
+
title={Challenges in representation learning: A report on three machine learning contests},
|
| 289 |
+
author={Goodfellow, Ian J and Erhan, Dumitru and Carrier, Pierre Luc and Courville, Aaron and Mehri, Soroush and Raiko, Tapani and others},
|
| 290 |
+
booktitle={Neural Information Processing Systems Workshop},
|
| 291 |
+
year={2013}
|
| 292 |
+
}
|
| 293 |
```
|
| 294 |
|
| 295 |
+
## ๐ก๏ธ Ethical Considerations
|
| 296 |
+
|
| 297 |
+
- **Data Source**: Based on publicly available FER2013 dataset
|
| 298 |
+
- **Privacy**: No personally identifiable information included
|
| 299 |
+
- **Bias**: Consider cultural differences in emotion expression
|
| 300 |
+
- **Usage**: Recommended for research and educational purposes
|
| 301 |
+
- **Commercial Use**: Verify compliance with local privacy regulations
|
| 302 |
+
|
| 303 |
## ๐ License
|
| 304 |
|
| 305 |
+
This enhanced dataset is released under the **MIT License**, ensuring compatibility with the original FER2013 dataset licensing terms.
|
| 306 |
+
|
| 307 |
+
## ๐ Related Resources
|
| 308 |
+
|
| 309 |
+
- [Original FER2013 Paper](https://arxiv.org/abs/1307.0414)
|
| 310 |
+
- [AffectNet Dataset](https://paperswithcode.com/dataset/affectnet)
|
| 311 |
+
- [RAF-DB Dataset](https://paperswithcode.com/dataset/raf-db)
|
| 312 |
+
- [PyTorch Documentation](https://pytorch.org/docs/)
|
| 313 |
+
- [TensorFlow Documentation](https://tensorflow.org/api_docs)
|
| 314 |
|
| 315 |
---
|
| 316 |
|
|
|
|
| 318 |
|
| 319 |
*Start with `pip install datasets` and `from datasets import load_dataset`*
|
| 320 |
|
| 321 |
+
*Last updated: January 2025*
|