The datasets used in this project are available on Kaggle:
- Brain Tumor Image Dataset: Semantic Segmentation
- Brain Tumor MRI Dataset
- Brain MRI Segmentation Dataset
Install the necessary Python packages using the requirements.txt file:
pip install -r requirements.txt
Alternatively, you can create a conda environment using the following commands:
conda env create -f environment.yaml
conda activate ai_project_env
Our project uses pre-commit hooks to ensure the cleanliness and consistency of Jupyter notebooks by automatically stripping outputs before they are committed. This step helps maintain a clean git history and minimizes "diff noise."
After installing the project dependencies, activate the pre-commit hooks by running the following command:
pre-commit install
This command sets up the hooks based on our project's .pre-commit-config.yaml configuration and needs to be run only once.
This current hook cleans the Jupyter notebooks before they are committed.
To create a base configuration for the project, run the following command:
cp config/env_local.env .env
This will create a .env
file in the root dir of the project. However, to actually run training and testing scripts, you will need to fill in the values in the .env
file.
Follow 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.
For an example of how to load the classification dataset, see the notebooks/dataloader_example.ipynb
notebook. This notebook demonstrates how to use the TumorClassificationDataset
class to load either the Training or Testing split from the Tumor Classification Dataset.
- Logistic Regression - see
notebooks/logistic_regression.ipynb
- CNN - see
notebooks/cnn_classification.ipynb
- ResNet (binary) - see
notebooks/resnet.ipynb
- ResNet (multi) - see
notebooks/resnet_multi.ipynb
See src/scripts/train_segmentation.py
for logic related to running segmentation experiments. For more info run the following from the root directory to see available training configurations:
python -m src.scripts.train_segmentation --help
Navigate to the main
function in src.scripts.train_object_detection.py
and edit the training_configs
.
To run the specified experiment you can use...
python -m src.scripts.train_object_detection