This project focuses on the automated segmentation of brain tumors from MRI scans using deep learning techniques. The model is built on the U-Net++ architecture, implemented in PyTorch, and enhanced with various advanced techniques to improve accuracy and robustness. The ultimate goal is to aid in the diagnosis and treatment planning for brain tumor patients.
- Programming Languages: Python
- Deep Learning Frameworks: PyTorch, Segmentation Models (segmentation-models-pytorch)
- Web Frameworks: FastAPI, Streamlit
- Data Processing: NumPy, pandas, scikit-learn
- Image Processing: PIL, OpenCV
- Visualization: Matplotlib
- Model Tracking: MLFlow
- Containerization: Docker
The dataset used for this project is publicly available and is not owned by me. It contains MRI scans and corresponding masks for brain tumors. The dataset, created by Mateusz Buda, can be accessed on Kaggle's LGG MRI Segmentation dataset: https://www.kaggle.com/datasets/mateuszbuda/lgg-mri-segmentation
- Creator: Mateusz Buda
- Title: LGG MRI Segmentation
- Source: Kaggle
- License: CC BY-NC-SA 4.0
- Clone this repository: git clone https://github.com/AryehRotberg/Brain-MRI-Images-Segmentation.git
- Create and activate a virtual environment:
- python -m venv venv
- source venv/bin/activate # On Windows use
venv\Scripts\activate
- Install the required packages: pip install -r requirements.txt
-
Train the model: python -m src.pipelines.training_pipeline --raw_data_path data/raw --images_path data/images --masked_images data/masked_images --model_path models/production/model.pth --sorted_data_available ""
-
Evaluate the model: python -m src.pipelines.evaluation_pipeline --images_path data/images --masked_images data/masked_images --model_path models/production/unetplusplus_resnet34.pth
-
Run Streamlit website: streamlit run src/app/streamlit_app.py
-
Run the web interface locally:
- uvicorn src.app.api:app --host 0.0.0.0 --port 8000; Access the web interface at http://0.0.0.0:8000/; Alternatively, you can access the FastAPI page at http://0.0.0.0:8000/docs/
Docker Setup:
- Build the Docker image: docker build -t brain-mri-images-segmentation .
- Run the Docker container: docker run -p 8000:8000 brain-mri-images-segmentation
-
Hugging Face Deployment
- The project is also deployed on Hugging Face Spaces for easy access and testing. You can try out the model directly on Hugging Face: https://huggingface.co/spaces/AryehRotberg/Brain-MRI-Images-Segmentation-HF; API access: https://aryehrotberg-brain-mri-images-segmentation-hf.hf.space/predict
Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.
