GPT-Image / code /run.sh
MaybeRichard's picture
Add training and evaluation code
3c366de verified
Raw
History Blame Contribute Delete
1.67 kB
#!/bin/bash
# ============ Dataset preparation (already done) ============
# Dry-run: print the split/clean plan for all 7 datasets without moving anything
python3 prepare_datasets.py
# Execute: physically reorganize into train/val/test/<label>/, write labels.csv, delete irrelevant files
python3 prepare_datasets.py --execute
# ============ Environment (conda env 'retfound', already created) ============
# Create env + install torch 2.5.1 cu121 + RETFound requirements (run once)
bash /tmp/env_setup.sh
# ============ Train + evaluate: 3 models x 7 datasets = 21 runs ============
# Print the 21-job plan and a sample command (no training)
/root/miniconda3/envs/retfound/bin/python run_all.py --dry_run
# Launch all 21 runs across 8 GPUs (each run: train then unified evaluate.py)
/root/miniconda3/envs/retfound/bin/python run_all.py
# Run a subset, e.g. only resnet+vit on idrid+adam
/root/miniconda3/envs/retfound/bin/python run_all.py --only_models resnet,vit --only_datasets idrid,adam
# Re-evaluate a single finished run (metrics.json + confusion_matrix/roc/pr png)
/root/miniconda3/envs/retfound/bin/python evaluate.py --run_dir ../results/idrid/retfound --class_names g0,g1,g2,g3,g4
# Build the cross-model/dataset summary table from all metrics.json
/root/miniconda3/envs/retfound/bin/python summarize.py
# Build the single-file HTML report (4 modules x datasets: table + bar chart + CM/ROC gallery) -> results/report.html
/root/miniconda3/envs/retfound/bin/python make_report.py
# Sample 20 real images per class per dataset and pack -> dataset_samples/ + dataset_samples.zip (original resolution)
/root/miniconda3/envs/retfound/bin/python sample_pack.py