Skip to content

Latest commit

 

History

History
121 lines (80 loc) · 2.48 KB

File metadata and controls

121 lines (80 loc) · 2.48 KB

Environment Setup

Step-by-step instructions to reproduce the training and evaluation environment for this project.


Prerequisites

  • Python 3.10 or later
  • pip (or conda)
  • CUDA-capable GPU recommended (the code also supports Apple MPS and CPU fallback)

1. Clone the Repository

git clone <repository-url>
cd Assignment3

2. Create a Virtual Environment

Using venv:

python -m venv .venv
source .venv/bin/activate

Or using conda:

conda create -n col780-a3 python=3.10 -y
conda activate col780-a3

3. Install Dependencies

pip install -r requirements.txt

This 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

4. Configure Weights & Biases

Training logs are synced to W&B. Authenticate before your first run:

wandb login

If you prefer to run without W&B, set the environment variable:

export WANDB_MODE=disabled

5. Prepare the Dataset

Place 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.


6. Verify the Setup

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.


7. Download Pretrained Checkpoints (Optional)

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.


Hardware Notes

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.