MLearning.ai
Published in

MLearning.ai

Building a Web Application to detect Breast Cancer in Ultrasound images

A friendly guide to easily do Object Detection on medical images

Photo by Priscilla Du Preez on Unsplash

Table of Contents:

Requirements:

Create a New Project on Datature’s platform. GIF by Author.
Source

Part 1: Training Model on ultrasound images

1. Upload and Annotate images

1.1 Upload Images. Illustration by Author.
filename,xmin,ymin,width,height,label
benign (1).png,288,134,51,26,benign
benign (10).png,24,67,209,197,benign
benign (11).png,367,132,72,38,benign
benign (12).png,343,178,78,44,benign
benign (13).png,182,107,355,198,benign
benign (14).png,511,149,111,54,benign
1.2 Upload Annotations. Illustration by Author.
Visualize annotated images and Manually Annotation. GIF by Author.

2. Create Workflow

Create Workflow. Illustration by Author.
Run Training. Illustration by Author.

3. Visualize Model Performance

Model metrics and Advanced Evaluation. GIF by Author.
Example of Advanced Evaluation. Illustration by Author.

4. Download Tensorflow Artifact

Export Artifact. GIF by Author.

Run the predict script.py

Screenshot on Github Repository.
Project Structure. Illustration by Author.
cd model_architecture
python predict.py --input "../input" --output "../output" --width 640 --height 640 --threshold 0.7 --model "../saved_model" --label "../label_map.pbtxt"
Model loaded, took 6.812467813491821 seconds...
Predicting for ../input/malignant (90).png...
Predicting for ../input/benign (53).png...
Saving predicted images to ../output/benign (53).png...
Predicting for ../input/benign (51).png...
Saving predicted images to ../output/benign (51).png...
Predicting for ../input/malignant (71).png...
Predicting for ../input/benign (52).png...
Predicting for ../input/malignant (111).png...
Saving predicted images to ../output/malignant (111).png...
Example of Benign prediction. Illustration by Author.
Example of Malignant Prediction. Illustration by Author.

Part 2: Build Web Application with Streamlit

Web Application. GIF by Author.

Final thoughts:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eugenia Anello

Research fellow in Interpretable Anomaly Detection | Top 1500 Writer on Medium | Love to share Data Science articles| https://www.linkedin.com/in/eugenia-anello