This repo prepares emotion-regression datasets and trains two baselines:
- ResNet18 regressor (PyTorch) — numeric regression baseline.
- Qwen2.5-VL-7B-Instruct + LoRA (SFT) — vision-language model fine-tuned to output a single numeric rating.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtconda create -n emo-qwen python=3.10 -y
conda activate emo-qwen
pip install -r requirements.txtSome datasets/models may require accepting terms or having access on Hugging Face.
huggingface-cli loginParquet files and images are NOT stored in this Git repository.
They are downloaded from Hugging Face and may be gated (requires login + access approval).
If you already have the Parquet files locally (e.g. from a previous run), you can skip the download step and go straight to processing.
Make sure these files exist (or update PARQUET_PATHS in scripts/make_processed.py):
data/IAPS/train.parquetdata/LAIGAI/train.parquetdata/NAPS/train.parquet
Then build processed splits + extracted images:
python scripts/make_processed.pypython download_data/download_all.pyCreates:
data/processed/train.jsonldata/processed/val.jsonldata/processed/test.jsonldata/processed/images/
python scripts/make_processed.pyCreates:
data/qwen_sft/train.jsonldata/qwen_sft/val.jsonldata/qwen_sft/test.jsonldata/qwen_sft/stats.json
python scripts/make_qwen_sft_dataset.pyTrain:
python scripts/baseline/train.pyEvaluate:
python scripts/baseline/evaluate.pyInfer (single image):
python scripts/baseline/infer.pyOutputs:
runs/baseline_resnet18/
Note: Qwen LoRA training/inference expects a CUDA GPU by default (DEVICE="cuda" in scripts).
python scripts/download_qwen.pypython scripts/train_qwen.pyCreates:
runs/qwen_lora/test_metrics.csvruns/qwen_lora/test_metrics.jsonruns/qwen_lora/test_predictions.csv(per-record: filename/source/emotion/true/pred)
python scripts/evaluate_qwen.pyCreates:
runs/qwen_ratings.csv(one row per image: filename + 5 emotion columns)
python scripts/rate_images.pyCreates:
runs/qwen_lora/prediction.json
python scripts/infer_qwen.pyOutputs:
runs/qwen_lora/adapter/(LoRA adapter)runs/qwen_lora/train_log.jsonruns/qwen_lora/val_metrics.jsonTrained LoRA adapter is included inruns/qwen_lora/adapter.
This repo includes a small sample (one image + expected format) to demonstrate the I/O format without shipping the full dataset:
data/sample_input/data/sample_output/
Use scripts/infer_qwen.py or scripts/baseline/infer.py to run a single-image demo.