Code Monkey home page Code Monkey logo

x-ray-classification's Introduction

X-ray-classification

Exploiting transfer learning methods to try and classify X-ray chest Images into normal(healthy) vs abnormal(sick)

we will see the performance of transfer learning using the official pre-trained model offered by Google (INCEPTION-RESNET-V2 MODEL), which can be found in TensorFlow’s model library

In this little/first try we will be retraining the last layer of inception v2 of google to classify the images using adam optimizer and learning rate decay

Sample dataset

Requirements

python 3 tensorflow = 1.0.1 matplotlib lxml

Training Specification

model used : INCEPTION-RESNET-V2

learning rate : 0.0001 with a decay factor of 0.7 each 2 epochs

batch size : 16

number of epochs : 30

Results on test set

Streaming Accuracy : 68.70 %

Recall : coming soon

Precision : coming soon

Sample Predictions

Getting started

get the data :

In the data folder (cd data/) :

1 - Use python get_data.py to download scrapped image data from openi.nlm.nih.gov. It has a large base of Xray,MRI, CT scan images publically available.Specifically Chest Xray Images have been scraped.The images will be downloaded and saved in images/ and the labels in data_new.json (it might take a while)

Some info about the dataset :

  Total number of Images : 7469
  The classes with most occurence in the dataset:

  		 ('normal', 2696)
  		 ('No Indexing', 172)
  		 ('Lung/hypoinflation', 88)
  		 ('Thoracic Vertebrae/degenerative/mild', 55)
  		 ('Thoracic Vertebrae/degenerative', 44)
  		 ('Spine/degenerative/mild', 36)
  		 ('Spine/degenerative', 35)
  		 ('Spondylosis/thoracic vertebrae', 33)
  		 ('Granulomatous Disease', 32)
  		 ('Cardiomegaly/mild', 32)

2 - Use python gen_data.py to sort labels into Normal/Abnormal classes, generate full path to coresponding Images and write them to data.txt

number of normal chest Images(healthy people) 2696:
number of abnormal chest Images(sick people) 4773:

3 - Use python convert_to_tf_records.py to generate tf records of the data.

training & evaluation:

Download the Pre-trained inception model in here and unzip it in ckpt/ folder.

Use python train.py to start the training !(trained model will be saved in logs/)

Use python evaluate.py to run evaluation using the model saved in logs/(metric : streaming accuracy over all mini batches)

References

Xvision

tensorflow.slim

tuto.transfer learning

x-ray-classification's People

Contributors

obendidi avatar breinoso avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.