A tumor growth in an enclosed environment such as the cranium can be very problematic due to the limited space available inside, which normally causes an increase in the internal cranial pressure. Whether they are beningn or malign, they can cause serious health issues.
The following project takes care of identifying if in a given brain MRI scan picture there is a tumor growth using 2 Deep Learning CNN models. If a model doesn't achieve a 99.90% confidence (threshold), runs a secondary diagnostic with the other model, and if this doesn't reach the threshold either or a different tumor type is identified, an specialist is contacted automatically via email.
User can also select both models at the same time, so the program will run a double diagnostic even if the first model reaches threshold. It will also email a specialist if neither of them reaches that threshold or tthey don't identify the same tumor type.
The models were trained using MRI brain scans of 3 different types of central nervous system tumors: glioma, meningioma and pituitary.
Models training details can be found in the homonymous page.
New models can be generated via models notebook. You can run the data creation cell inside to download and extract the dataset and work from there if you didn't use the setup.py script.
Alternatively, if you just want to use the app with the already trained models, follow the steps below.
- Program is now a multipage app.
- Web browser tab now shows the active page and a brain icon. Default theme set in app/.streamlit/config.toml
- Additional resources in different pages allow a clearer read.
- BTS model selection and enable email notifications actioned in sidebar.
- If the models don't identify the same tumor type, a brain specialist will be contacted, even if the confidence level is above threshold.
- Email setup can be easily done via the app/config/email_config.py script (no need to modify the main app).
- Email notifications feature the model used and the threshold of each. Also, they don't agree on the tumor type, the email displays the diagnosis of each model.
- Updated app pictures to show the new app at work.
1- Clone repo into desired folder:
git clone https://github.com/jcjv86/final-bootcamp-project
2- Create venv environment inside the cloned repo folder:
python3 -m venv ./venv
3- Activate environment:
source ./venv/bin/activate
4- Run setup.py to install required libraries, configure venv user and download and unpack the dataset and models (around 1GB download in total):
python setup.py
5- Move into app folder:
cd app
6- Run app:
streamlit run Home.py
Edit 'email_config.py' script on the app/config folder:
- Set the email_sender (email from where the notification is sent)
- Set the email_password (recommended to configure an app password)
- Set the email_receiver (email that will receive the notification)
If you use a different server than gmail you would have to configure the smtp server too:
- Edit the SMTP server address
- Edit the SMTP server port
It is not necessary to set up the email account as the program still works without it, in this case I recommend you to unclick the "Activate email notifications" option so you don't see the error.
2- BTS and TRL model successful
3- BTS and TRL model run a second diagnostic
4- BTS and TRL model don't reach the threshold: email to specialist
5- Both models selected, none reaches threshold, email to specialist
5- Different tumor types identified
6- Different tumor types identified, threshold also not reached
2- Different tumor types identified
3- Worst case scenario: threshold not reached, different tumor types identified
Asociación Española Contra el Cáncer
European Association for Cancer Research