GithubHelp home page GithubHelp logo

0xpranjal / pneumonia-detection-using-deep-learning Goto Github PK

View Code? Open in Web Editor NEW
30.0 2.0 15.0 1.16 GB

Making a binary classifier to detect pneumonia using chest x-rays images.

License: MIT License

Jupyter Notebook 100.00%
pneumonia-detection pneumonia-classification pneumoniac-xray pneumonia-classifier kaggle-dataset transfer-learning resnet vgg16 vgg16-model inception

pneumonia-detection-using-deep-learning's Introduction

Pneumonia Detection using Deep Learning

Problem Statement

Build a binary classifier to detect pneumonia using chest x-rays.

Pneumonia

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. Chest X-ray, blood tests, and culture of the sputum may help confirm the diagnosis. The disease may be classified by where it was acquired, such as community- or hospital-acquired or healthcare-associated pneumonia.

Dataset description

The dataset is organized into 3 folders (train, test, val) and contains subfolders for each image category (Pneumonia/Normal). There are 5,863 X-Ray images (JPEG) and 2 categories (Pneumonia/Normal). Chest X-ray images (anterior-posterior) were selected from retrospective cohorts of pediatric patients of one to five years old from Guangzhou Women and Children’s Medical Center, Guangzhou. All chest X-ray imaging was performed as part of patients’ routine clinical care. For the analysis of chest x-ray images, all chest radiographs were initially screened for quality control by removing all low quality or unreadable scans. The diagnoses for the images were then graded by two expert physicians before being cleared for training the AI system. In order to account for any grading errors, the evaluation set was also checked by a third expert.

Model used :

Here is a small comparison of all the models tested in the project:

  • Convolutional Neural Network

624/624 [==============================] - 11s 18ms/step
Loss of the model is -  0.30433156475042683
624/624 [==============================] - 10s 15ms/step
Accuracy of the model is -  91.98718070983887 %

  • Convolutional Neural Network(Different approach) :

624/624 [==============================] - 30s 49ms/step
Test Accuracy: 68.91%
652/652 [==============================] - 338s 518ms/step
Train Accuracy: 66.33%
  • DenseNet :

624/624 [==============================] - 132s 211ms/step
Test Accuracy: 87.18%
652/652 [==============================] - 622s 954ms/step
Train Accuracy: 86.22%
  • VGG16 :

624/624 [==============================] - 226s 363ms/step
Test Accuracy: 66.19%
652/652 [==============================] - 1608s 2s/step
Train Accuracy: 82.63%
  • ResNet :

624/624 [==============================] - 101s 162ms/step
Test Accuracy: 73.40%
652/652 [==============================] - 651s 999ms/step
Train Accuracy: 88.92%
  • InceptionNet :

624/624 [==============================] - 41s 66ms/step
Test Accuracy: 76.76%
652/652 [==============================] - 295s 453ms/step
Train Accuracy: 91.26%

pneumonia-detection-using-deep-learning's People

Contributors

0xpranjal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pneumonia-detection-using-deep-learning's Issues

ResNet architecture throws an error


TypeError Traceback (most recent call last)
in
11 BatchNormalization(),
12 Dropout(0.3),
---> 13 Dense(1,activation="sigmoid")
14 ])
15

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/sequential.py in init(self, layers, name)
114 tf_utils.assert_no_legacy_layers(layers)
115 for layer in layers:
--> 116 self.add(layer)
117
118 @Property

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/sequential.py in add(self, layer)
159 raise TypeError('The added layer must be '
160 'an instance of class Layer. '
--> 161 'Found: ' + str(layer))
162
163 tf_utils.assert_no_legacy_layers([layer])

TypeError: The added layer must be an instance of class Layer. Found: <keras.engine.training.Model object at 0x7f927a019410>

VGG16 CNN model throws an error


TypeError Traceback (most recent call last)
in
11 BatchNormalization(),
12 Dropout(0.3),
---> 13 Dense(1,activation="sigmoid")
14 ])

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/sequential.py in init(self, layers, name)
114 tf_utils.assert_no_legacy_layers(layers)
115 for layer in layers:
--> 116 self.add(layer)
117
118 @Property

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/sequential.py in add(self, layer)
159 raise TypeError('The added layer must be '
160 'an instance of class Layer. '
--> 161 'Found: ' + str(layer))
162
163 tf_utils.assert_no_legacy_layers([layer])

TypeError: The added layer must be an instance of class Layer. Found: <keras.engine.training.Model object at 0x7f92af7cfa90>

InceptionNet network throws an error


TypeError Traceback (most recent call last)
in
11 BatchNormalization(),
12 Dropout(0.3),
---> 13 Dense(1,activation="sigmoid")
14 ])
15

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/sequential.py in init(self, layers, name)
114 tf_utils.assert_no_legacy_layers(layers)
115 for layer in layers:
--> 116 self.add(layer)
117
118 @Property

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/sequential.py in add(self, layer)
159 raise TypeError('The added layer must be '
160 'an instance of class Layer. '
--> 161 'Found: ' + str(layer))
162
163 tf_utils.assert_no_legacy_layers([layer])

TypeError: The added layer must be an instance of class Layer. Found: <keras.engine.training.Model object at 0x7f9314c9e850>

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.