Step-by-step instructions to reproduce the training and evaluation environment for this project.
- Python 3.10 or later
- pip (or conda)
- CUDA-capable GPU recommended (the code also supports Apple MPS and CPU fallback)
git clone <repository-url>
cd Assignment3Using venv:
python -m venv .venv
source .venv/bin/activateOr using conda:
conda create -n col780-a3 python=3.10 -y
conda activate col780-a3pip install -r requirements.txtThis installs the following packages:
| Package | Purpose |
|---|---|
torch, torchvision |
Model training and pretrained weights |
timm |
DeiT-3 Small pretrained backbone |
numpy, pandas |
Data handling |
opencv-python |
Image I/O |
scikit-learn |
Evaluation metrics (F1, AUC, Accuracy) |
wandb |
Experiment tracking |
tqdm |
Progress bars |
Training logs are synced to W&B. Authenticate before your first run:
wandb loginIf you prefer to run without W&B, set the environment variable:
export WANDB_MODE=disabledPlace the assignment dataset under data/A3_Dataset/ so that the directory structure looks like:
data/
└── A3_Dataset/
├── train.csv
├── validation.csv
├── test.csv
└── <image files>
The dataset is not included in this repository. Obtain it from the course distribution.
Run a quick test to confirm the environment and data loading work correctly:
python -c "from data.load_data import CropData; ds = CropData('data/A3_Dataset', 'data/A3_Dataset/train.csv'); print(f'Dataset loaded: {len(ds)} samples')"If this prints the sample count without errors, the environment is ready.
If evaluating with the author's trained weights, download them from the link provided in the report and place the .pth files in the project root or a checkpoints/ directory.
| Device | Support | Notes |
|---|---|---|
| NVIDIA GPU (CUDA) | Full | Recommended for training |
| Apple Silicon (MPS) | Full | Automatically detected |
| CPU | Full | Functional but significantly slower |
Device selection is handled automatically by engine/trainer.py.