Skip to content

Pneumonia Detection Using Various Neural Networks Architecture and using Transfer Learning on VGG16 as Pretrained Model

License

Notifications You must be signed in to change notification settings

ctrl-gaurav/Pneumonia-Detection

Repository files navigation


Logo

Pneumonia Detection

Pneumonia Detection Using Various Neural Networks Architecture and using Transfer Learning on VGG16 as Pretrained Model
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

About The Project

Pneumonia Detection Using Various Neural Networks Architecture and using Transfer Learning on VGG16 as Pretrained Model

Pneumonia is an infection that inflames the air sacs in one or both lungs. The air sacs may fill with fluid or pus (purulent material), causing cough with phlegm or pus, fever, chills, and difficulty breathing. A variety of organisms, including bacteria, viruses and fungi, can cause pneumonia.

The project is about diagnosing pneumonia from XRay images of lungs of a person using self laid convolutional neural network and tranfer learning via inceptionV3 and VGG16.

Using Various Neural Network Architecture

Model 1

Architecture :

  • ReLU Activation
  • adam optimzer

Model 1 Accuracy
Model 1 Loss

Model 2

New architecture with improving the previous architecture

  • ReLU Activation
  • SGD optimzer
  • Dropout + Batch Normalization

Model 2 Accuracy
Model 2 Loss

Model 3

3 Hidden Layers

  • ReLU Activation
  • RMSprop optimzer
  • Dropout
  • Model Architecture: 784-512-364-128-10

Model 3 Accuracy
Model 3 Loss

Conclusion


Here are the results of our three models :
Model Architecture Training Accuracy Test Accuracy
Model 1 2:1 Arcitecture without using Batch Normalization and Dropout 95.48% 91.67%
Model 2 4:2 Achitecture using Batch Normalization and Dropout 93.58% 87.98%
Model 3 3:1 Convolutional layer 94.74% 91.67%

Transfer Learning VGG 16 and VGG 19 using Keras

VGG16 Accuracy
VGG16 Loss

Conclusion


Here are the results of Transfer Learning :
Model Architecture Training Accuracy Test Accuracy
VGG 16 Epoch = 2 Batch size = 10 95.24% 90.87%

Built With

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

You will need:

  • Python
  • Tensorflow
  • scikit-learn
  • Flask

Installation

  1. Make sure you have python3 setup on your system
  2. Clone the repo
git clone https://github.com/ctrl-gaurav/Pneumonia-Detection.git
  1. Install requirements
pip install -r requirements.txt
  1. Download Pre-Trained Weights
  2. Run app.py
python app.py

Train Your Own Model

If you want to train your own model

Procedure

  1. Make sure you have python3 setup on your system
  2. Clone the repo
git clone https://github.com/ctrl-gaurav/Pneumonia-Detection.git
  1. Install requirements
pip install -r requirements.txt
  1. Read Documentation and see which model architecture you want to use or fit best for your model.
  2. Set Parameters according to your dataset then :
  3. Run model_2_1_architecture.py
python model_2_1_architecture.py
  1. Run model_3_1_architecture.py
python model_3_1_architecture.py
  1. Run model_4_2_architecture.py
python model_4_2_architecture.py
  1. Your Trained Model is automatically saved in models folder
  2. Change Your model name in app.py and then test your model
  3. Run app.py
python app.py

Product Screenshots

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

To add your contributions to this project follow these steps :

  1. Fork the Project
  2. Create your improvements Branch (git checkout -b improvements/myimprovements)
  3. Commit your Changes (git commit -m 'Done some Improvements')
  4. Push to the Branch (git push origin improvements/myimprovements)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact