This work aims to identify the location of brain tumors in MRI images through the use of object-detection.
These are personal contributions and continuations of a group project for CS4100. You can find the project report here.
The datasets used in this project are available on Kaggle:
Find the data exploration for this dataset here.
Directly predict the coordinates of the ground truth bounding box (center of the box and its width, height).
Benefit: simple and naive approach
Drawbacks: relies on the assumption that there is exactly 1 tumor bounding box per image
Pre-define anchors boxes of various sizes and aspect ratios. For each anchor box, make a classification prediction (is there an object in this anchor?) and a regression prediction (how to make the anchor box overlay the true object bounding box).
Benefits: can handle cases when there are no tumors or many tumors in a single image
Drawbacks: more difficult to train due to spacity of the labels; more complicated model architecture.
Install the necessary Python packages using the requirements.txt file:
pip install -r requirements.txtAlternatively, you can create a conda environment using the following commands:
conda env create -f environment.yaml
conda activate brain_tumor_detection_envFollow the instructions to set up your Kaggle API credentials. You can find the Kaggle API authentication instructions in the Kaggle API Documentation.
Refer to the notebooks/downloading_datasets.ipynb notebook for step-by-step instructions on using the Kaggle API to download the datasets required for this project. The datasets will be downloaded to the ./datasets folder, which is configured to be ignored by git.
Navigate to the main function in src.training.train_single_object_detection and edit the training_configs.
TrainingConfig Arguments:
- dataset_root_dir
- device
- batch_size
- learning_rate
- num_epochs
- optimizer ("Adam" or "SGD")
- image_size
- pretrained_backbone (True or False)
- efficient_net_version: ("b0", ... "b7")
- predictor_hidden_dims (e.g. [[64, 16])
- augmentations: ("rotation", "reflection", and/or "crop")
To run the specified experiment you can use...
python -m src.training.train_single_object_detectionExperimental Configs:
{
"batch_size": 16,
"learning_rate": 0.001,
"num_epochs": 100,
"device": "mps",
"dataset_root_dir": "./datasets",
"augmentations": ["rotation", "reflection", "crop"],
"optimizer": "Adam",
"image_size": 256,
"pretrained_backbone": true,
"efficient_net_version": "b4",
"predictor_hidden_dims": [64, 16],
"save_dir_path": "./experiments/24-05-31-01-09",
"git commit id": "ff97464a381f489a97e7730756a276446a4a03ac"
}Experimental Results:
{
"best_val_iou": 0.6572,
"best_epoch": 67,
"test_iou": 0.6420
}Example Test Predictions:








