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.txtAlternatively, you can create a conda environment using the following commands:
conda env create -f environment.yaml
conda activate tumor-segmentationOur 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 installThis 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 .envThis 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 or segmentation datasets, see the notebooks/classification_dataloader_example.ipynb and notebooks/segmentation_dataloader_example.ipynb, respectively.
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