A Vision Graph Neural Network (ViG) implementation for SAR (Synthetic Aperture Radar) image classification.
You MUST use Python 3.11. Create a virtual environment:
# Create virtual environment with Python 3.11
py -3.11 -m venv venv311
# Activate it
venv311\Scripts\activate
# Install PyTorch with CUDA 12.1
python -m pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
# Install timm version 0.5.4 (IMPORTANT: NOT the version in requirements.txt)
python -m pip install timm==0.5.4
# Install other dependencies
python -m pip install PyYAML torchprofileYour data/ folder should contain:
data/
├── train/
│ └── class0/
│ ├── image1.jpg
│ └── image2.jpg
└── val/
└── class0/
├── image1.jpg
└── image2.jpg
python main.py --config configs/patch_eval.yamlPrint the command that would be run, without executing it:
python main.py --config configs/patch_eval.yaml --dry-runrun_mode in the YAML selects behavior:
run_mode |
Effect |
|---|---|
train |
Training only (--train-only, --skip-val) |
train_eval |
Train and run validation each epoch |
eval |
Validation / test only (--evaluate) |
python train.py data/ --model vig_ti_224_gelu -b 2 --num-classes 1 --epochs 5 --workers 0python train.py <DATA_PATH> [OPTIONS]
Required:
DATA_PATH Path to data folder (contains train/ and val/)
--model MODEL Model architecture (default: resnet101)
-b, --batch-size N Batch size (MUST SET: default 32 will error)
--num-classes N Number of classes (MUST SET: default 1000 will error)
Optional:
--epochs N Number of epochs (default: 200)
--lr LR Learning rate (default: 0.01)
--opt OPTIMIZER Optimizer: sgd, adam, adamw, etc. (default: sgd)
--workers N Number of data loading workers (default: 4, use 0 for Windows)
--output PATH Output directory for checkpoints (default: ./output)REM Navigate to project
cd C:\Users\ThanhNam\Desktop\Grad-Class\CS675\Group-Project\SARViG
REM Activate environment
venv311\Scripts\activate
REM Patch eval from YAML (adjust path to your config)
python main.py --config configs\patch_eval.yaml
REM Or run training manually (after you add more training images!)
python train.py data/ --model vig_ti_224_gelu -b 4 --num-classes 1 --epochs 10 --workers 0