Skip to content

olipat/SARViG

Repository files navigation

SARViG - SAR Vision Graph Neural Network

A Vision Graph Neural Network (ViG) implementation for SAR (Synthetic Aperture Radar) image classification.

Setup Instructions

1. Environment Setup (Python 3.11 REQUIRED)

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 torchprofile

2. Dataset Structure

Your data/ folder should contain:

data/
├── train/
│   └── class0/
│       ├── image1.jpg
│       └── image2.jpg
└── val/
    └── class0/
        ├── image1.jpg
        └── image2.jpg

3. Run with a YAML config

python main.py --config configs/patch_eval.yaml

Print the command that would be run, without executing it:

python main.py --config configs/patch_eval.yaml --dry-run

run_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)

4. Run Training (manual train.py)

python train.py data/ --model vig_ti_224_gelu -b 2 --num-classes 1 --epochs 5 --workers 0

5. Key Parameters

python 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)

Quick Start (Copy-Paste)

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages