diff --git a/configs/base_config.py b/configs/base_config.py index e69de29..d990232 100644 --- a/configs/base_config.py +++ b/configs/base_config.py @@ -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 +} diff --git a/configs/pennfudan_maskrcnn_config.py b/configs/pennfudan_maskrcnn_config.py new file mode 100644 index 0000000..a3fc51d --- /dev/null +++ b/configs/pennfudan_maskrcnn_config.py @@ -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) diff --git a/todo.md b/todo.md index ea653c6..cf98bb7 100644 --- a/todo.md +++ b/todo.md @@ -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. \ No newline at end of file +- [ ] Ensure all pre-commit hooks pass. \ No newline at end of file