Logo Lanfrica

nthelma/msc-fer-african-face

Type de record:

project
Créateur:
nth
Hôte:
The primary goal is to determine whether the choice of architecture (CNN vs. VLM) influences emotion recognition accuracy on African faces and whether this is affected by the demographic composition of the training data. # msc-fer-african-face The primary goal is to determine whether the choice of architecture (CNN vs. VLM) influences emotion recognition accuracy on African faces and whether this is affected by the demographic composition of the training data. ## Setup ### 1. Create and Activate Virtual Environment ```bash # Create virtual environment python -m venv venv # Activate virtual environment # Windows: venv\Scripts\activate # Mac/Linux: source venv/bin/activate ``` ### 2. Install Dependencies ```bash pip install torch torchvision transformers matplotlib scikit-learn pandas numpy Pillow tqdm ``` ## Data Structure The project expects the following data directory structure: ``` data/ ├── train/ # Training data │ ├── Angry/ │ ├── Disgusted/ │ ├── Fearful/ │ ├── Happy/ │ ├── Neutral/ │ ├── Sad/ │ └── Surprised/ └── test/ # Test data ├── Angry/ ├── Disgusted/ ├── Fearful/ ├── Happy/ ├── Neutral/ ├── Sad/ └── Surprised/ ``` ## Training ### Train ResNet50 Model Train a fine-tuned ResNet50 model for facial emotion recognition: ```bash python src/train_resnet50.py ``` **Features:** - Uses pre-trained ResNet50 architecture - Input image size: 224×224 - Batch size: 32 - Data augmentation: random horizontal flips for training - GPU/CPU automatic detection - Outputs training metrics and model checkpoints ### Train CLIP Model Train a CLIP-based model with a trainable classifier head: ```bash python src/train_clip.py ``` **Features:** - Uses OpenAI's CLIP (Vision Transformer ViT-B/32) - Freezes the CLIP encoder; only trains the classifier head - 7 emotion classes - Number of epochs: 10 - Learning rate: 0.001 - Batch size: 32 - GPU/CPU automatic detection ## Evaluation ### Evaluate ResNet50 Model Evaluate the trained ResNet50 model on test data: ```bash python src/evaluate_resnet50.py ``` **Output:** - Accuracy score - F1 score - Classification report - Confusion matrix visualization ### Evaluate ResNet50 (Detailed) Generate detail …