Emotion Detection and Transfer Project
-
Download AffectNet from huggingface and place under
emodetectionfolder.code example for downloading dataset from huggingface:
from datasets import load_dataset
dataset = load_dataset('chitradrishti/AffectNet', split='train')
dataset.to_csv('output.csv') #optional: save dataset as csv file with image paths
- Run the following command to split the AffectNet into Train and test sets:
cd emodetection
python split_dataset.py
- Environment setup: tested with python3.10 + pytorch 2.1.0 + cuda 12.1
- Download pre-trained EfficientNet checkpoint from here and place under the
checkpointsfolder. - modify any necessary hyper-pameter and run:
bash train.sh
- Use test split of Affetnet dataset
- Environment setup: tested with python3.10 + pytorch 2.1.0 + cuda 12.1
- Use stable-diffusion-v1-5 model from huggingface
- modify any necessary hyper-pameter and run:
python image_generator.py --base_path <YOUR DATA DIR> --emotion_mapping_path <YOUR EMOTION MAPPING FILE> --output_dir <YOUR GENERATED IMAGES DIR>