Giter Site home page Giter Site logo

pneumonia-detection's Introduction

Pneumonia Diagnosis using X-ray

Introduction

The data is from Kaggle

There are two category in kaggle's data sets : Normal and Pneumonia

The data is split into a set of 3 folders : train, val and test

Images

App Screenshot

Data Exploration

  • The train folder totally have 5216 jpg files (Normal:1341,PNEUMONIA:3875)

  • The val folder totally have 16 jpg files (Normal:8,PNEUMONIA:8)

  • The test folder totally have 624 jpg files (Normal:234,PNEUMONIA:390)

Remark! Data sets for Normal & Pneumonia are imbalanced (about 1:3)

Data Augmentation

ImageDataGenerator(
        rotation_range=10,
        width_shift_range=0.2,
        height_shift_range=0.2,
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True,
        fill_mode='nearest')

Screenshots

If you are not getting the app just like the below picture, then change the streamlit theme

Normal

App Screenshot

Pneumonia

App Screenshot

Deployment

Deployed this project on AWS

http://13.233.229.207:8501/

Model Building

Here I used Xception

Xception Architecture

App Screenshot

This is a generic code if you want you can use any other model. All you have to do is replace Xception with your desired model name and last_conv_layer_name with that model's last convolution layer

IMAGE_SIZE=[224,224]
base_model=Xception(input_shape=IMAGE_SIZE + [3],weights='imagenet',include_top=False)

last_conv_layer_name = "block14_sepconv2_act"

for layer in base_model.layers[:-8]:
    layer.trainable=False

new_model = base_model.output
new_model = GlobalAveragePooling2D()(new_model)
new_model = Dense(2,activation='softmax')(new_model)

model=Model(base_model.input,new_model)

Model training

  • batch size = 64
  • optimizer = adam
  • loss = categorical_cross_entropy
  • epochs = 30
  • steps per epoch = 32

Results

Model Accuracy - 93%

App Screenshot

Classification Report

App Screenshot

ROC

App Screenshot

Run Locally

Clone the project

  git clone https://github.com/xx-CRAZINESS-xx/Pneumonia-Detection.git

Go to the project directory

  cd Pneumonia-Detection

Install dependencies

  pip install -r requirements.txt

Start the server

  streamlit run app.py

pneumonia-detection's People

Contributors

xx-craziness-xx avatar

Watchers

 avatar

Forkers

johnfelipe

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.