Deep Learning Healthcare


Deep Learning in Healthcare

Machine Learning has been used in Healthcare for some time now. Today, Deep Learning can be used to help Physicians diagnose injury and ailments.  There are many different types of technology working together to enable deep learning.  This includes imaging sytems, scanners, iot devices, big data storage and much more.  Its difficult to understand all the pieces.  I thought I would put together a “Toy” example and show you basically how an image recognition system based on TensorFlow – Python would learn an image set and provide a score on a new image.

Please Note: Production Diagnostic systems are very complex and follow compliance rules and scientific rigor.  This example is a “Toy” example and should not be used or considered a true Diagnostic Tool.  It should be used as an example only. Have fun.

The following are example Use Cases for Machine Learning – Deep Learning in Healthcare:

  • Perscription Drug Development – Efficacy
  • Prescription Drug – Food Interactions
  • Prescription Drug – Overuse | Misuse
  • DRG Diagnostic Procedure to Diagnosis
  • Provider Network – Specialist Locator
  • Raw – Alternate Materials Logistics
  • Health Monitoring – Diagnosis | Prevention
  • And… Much more

Creating Example Environment

For this example, You will need a basic understanding of Docker, Git and Python.  You can start by reviewing this important TensorFlow Tutorial.  This will give you an basic understanding of TensorFlow, Inception and how to train and score a new image.  The actual Git repository with the Docker file and TensorFlow files are located HERE.  Finally, The images I used for this “Toy” example can be found HERE.

At this point; You should have reviewed the tutorial, downloaded and created a Docker environment on your Host Computer. Also, You should have downloaded my example images to a staging area on the same Host with Docker. Make sure to review the in my image Git repository to understand the directory structure.

Building the Example

In my example, I created a tf directory and downloaded the git there:

mkdir tf
cd tf
git clone
cd ../tf/tensorflow_image_classifier/
# inspect new repository
bash-3.2$ cat Dockerfile
FROM tensorflow/tensorflow:0.9.0-devel
# build the Docker Image
bash-3.2$ Docker build .
# create test directory
mkdir tf_files
cd tf_files
# download - copy over image files and unzip - see image test file git for directory structure.
cp diagnose.tar healthdiag.tar ../tf_files/
# create docker container based on image created from Docker build .
docker run -it -v ../tf_files/:/tf_files/ tensorflow/tensorflow:0.9.0-devel
# Note: Docker may complain about your relative path - just place your complete path
# docker will run up the container
root@9e5a509b4637:~# ls /tf_files/
# You should see your healthdiag and diagnose files that you downloaded from my git image repository
# Next, cd into tensorflow and git the tensorflow repos into the newly created docker container
cd /tensorflow
git pull

Train Tensor Flow – Inception

Make sure to review the Tensor Flow tutorial.  We are going to train inception to understand the images we have in the /tf_files/healthdiag directory and create labels for those files.

python tensorflow/examples/image_retraining/
--how_many_training_steps 500
--image_dir /tf_files/healthdiag/

This should take some time. Just let your computer grind through this sample data. Note: when your (re) – training a model that contains hundreds, thousands and more images – you will need a Big Data Solution.  You need a solution that will stage files in a data lake and a job processing system to run your machine learning programs in parallel. Finally, Aggregate all the results.

If you need help, Please email: or call us and we can help you understand the requirements of this environment.

Moving on:

# ctrl-D to exit Docker and then: - This will download the example from tutorial
curl -L > $HOME/tf_files/
# Finally, let's diagnose some images - 1st is the image on the left from graphic above
python /tf_files/ /tf_files/diagnose/leg005.jpg
brokenleg (score = 0.91144)
healthyleg (score = 0.08856)
# 2nd is the image on the right
python /tf_files/ /tf_files/diagnose/leg009.jpg
healthyleg (score = 0.76665)
brokenleg (score = 0.23335)
# I have included the following - give them all a try.
root@9e5a509b4637:~# ls /tf_files/diagnose
leg001.jpg leg002.jpg leg003.png leg004.jpg leg005.jpg leg006.jpg leg009.jpg leg010.jpg

If you’re feeling adventurous; download your own set of images and retrain the model. If you really want to understand what is going on behind the scenes. You will need to deep dive Python, Tensor Flow and Deep Learning. There is allot to these systems but it is understandable. My goal was to show you how simple it can be to build an example system that actually produces exciting results.

At Blueskymetrics, We help customers build metrics in the cloud.  These are Cloud Data Warehouse solutions that include Big Data and RDBMS like Oracle, SQL Server, Redshift, Aurora and others.  We love data mining. Our solutions focus on Data Science and Machine learning. If you need help migrating your data warehouse to the cloud and/or evolving your data platform solution; Please send me an email or give us a call.
If you’re starting a new project or you need help with your existing data solution- Please Contact US.
Email: – Phone: 765.325.8373 ( call / text ).

Stay Informed: Please Contact US | Subscribe to our Blog Updates or If you would like more information.

Subscribe : Blueskymetrics Blog

* indicates required,  Managed By Mail-chimp – Please check your Spam Folder and Confirm Subscription.