This commit is contained in:
Craig
2025-04-12 10:28:50 +01:00
parent ae79a555d3
commit c3096f0664
3 changed files with 53 additions and 5 deletions

View File

@@ -0,0 +1,28 @@
"""
Base configuration dictionary for the project.
Contains default values for common hyperparameters and settings.
"""
base_config = {
# --- Data --- #
"data_root": "data/PennFudanPed", # Default dataset path
"output_dir": "outputs", # Base directory for logs, checkpoints, etc.
# --- Hardware --- #
"device": "cuda", # 'cuda' or 'cpu'
# --- Model --- #
"num_classes": 2, # Number of classes (including background)
# --- Training --- #
"batch_size": 2, # Training batch size
"num_epochs": 10, # Total number of training epochs
"seed": 42, # Random seed for reproducibility
# --- Optimizer --- #
"lr": 0.005, # Initial learning rate
"momentum": 0.9,
"weight_decay": 0.0005,
# --- LR Scheduler --- #
"lr_step_size": 3, # Step size for StepLR scheduler
"lr_gamma": 0.1, # Multiplicative factor for StepLR scheduler
# --- Logging & Checkpointing --- #
"log_freq": 10, # Log training progress every N batches
"checkpoint_freq": 1, # Save checkpoint every N epochs
}

View File

@@ -0,0 +1,23 @@
"""
Configuration for training Mask R-CNN on the Penn-Fudan dataset.
"""
from .base_config import base_config
config = base_config.copy()
# Override necessary settings from base_config
config.update(
{
"config_name": "pennfudan_maskrcnn_v1", # Unique name for this experiment run
"data_root": "data/PennFudanPed", # Explicitly set dataset root
"num_classes": 2, # Penn-Fudan has 1 class (pedestrian) + background
# Adjust other parameters as needed for this specific experiment, e.g.:
# 'batch_size': 4,
# 'num_epochs': 15,
# 'lr': 0.001,
}
)
# Ensure derived paths or settings are consistent if needed
# (Not strictly necessary with this simple structure)

View File

@@ -16,10 +16,7 @@ This list outlines the steps required to complete the Torchvision Finetuning pro
- [x] Install pre-commit hooks
- [x] Verify PyTorch GPU integration (`scripts/check_gpu.py`)
- [x] Create data download script (`scripts/download_data.sh`)
- [ ] Implement PennFudanDataset class (`utils/data_utils.py`)
- [ ] Implement model finetuning logic (`models/detection.py`)
- [ ] Implement training script (`train.py`)
- [ ] Implement evaluation script (`test.py`)
- [x] Implement configuration system (`configs/base_config.py`, `configs/pennfudan_maskrcnn_config.py`)
## Phase 2: Data Handling & Model
@@ -125,4 +122,4 @@ This list outlines the steps required to complete the Torchvision Finetuning pro
- [ ] Dependencies list
- [ ] (Optional) Results section
- [ ] Perform final code quality checks (`ruff format .`, `ruff check . --fix`).
- [ ] Ensure all pre-commit hooks pass.
- [ ] Ensure all pre-commit hooks pass.