Giter Site home page Giter Site logo

anna-dang / mod04-computer_vision_cnn Goto Github PK

View Code? Open in Web Editor NEW
5.0 0.0 3.0 18.13 MB

Computer vision classification using Convolutional Neural Networks (CNN) trained on Google Colaboratory GPU virtual machine.

Home Page: https://towardsdatascience.com/downloading-kaggle-datasets-directly-into-google-colab-c8f0f407d73a

Jupyter Notebook 100.00%
colab-notebook cnn-for-visual-recognition tensorflow gpu-computing

mod04-computer_vision_cnn's Introduction

Flatiron Data Science Program

Module 4 Project - Neural Networks

December 15th, 2020


Computer Vision

X-Ray Image Classification

xrays


Overview

Objective: Build a model that can classify whether a patient has pneumonia, given a chest x-ray image.

Repository Contents:

- images : images for display through this analysis
- project_4_notebook.ipynb : Google Colab notebook containing full analysis/modeling
- README.md : project summary and contents
- Mod04_presentation.pdf : presentation slides with comments

Data

xrays

"Chest X-ray images (anterior-posterior) were provided from pediatric patients of Guangzhou Women and Children’s Medical Center, Guangzhou, China. The diagnoses for the images were then graded by two expert physicians before being cleared for training the AI system."

In the above images, some opacity can be observed in the bottom row of pneumonia lungs. This is due to the X-ray picking up the fluid filled air sacs due to the infection.

Sources: original study source, data download source/Kaggle competition

Classifier

Full analysis: Colab Notebook

For this project I wanted to optimize the model to arrive at as few fasle predictions as possible. False positives could be costly in resources for the provider and patient, or result in unnecessary treatment. False negatives could allow illness to be missed and treatment delayed. Thus I selected accuracy and the AUC (area under the ROC curve) as target metrics for a balanced model, for both penalize false predictions.

The final model was trained on images with the following preprocessing:

- Images were resized to 124 x 124 pixels, with 3 RGB color channels
- Pixel values were normalized to a 0-1 scale
- To prepare the model to discern noise, four data augmentations were used: rotation, vertical/horizontal shifting, and zoom
- The imbalanced data set (75% pnemonia vs. 25% normal X-rays) was corrected by applying class weights

The final model arcitecture was a convolutional neural network (CNN) with 3 convolution blocks (convolution, drop out, pool).

confusion

Resulting in performances scores of:

- Accuracy - 89.77%
- Recall - 94 %
- Precision - 82 %
- AUC - 0.88

classification report

confusion

ROC/AUC

Reccomendations

- Continue collecting labeled images to progressively train the model.
- Store image data at 128 x 128 to conserve storage memory (this is up to a 10% reduction in original image size).
- Use the model to improve efficiency of Xray review.

Future Work

This is a supervised learning task and thus performance is based on the quality of the dataset used.

- Collect more labeled images or continue data augmentation to increase the quantity of images in the training set.
- Try transfer learning - use an established x-ray classifier and build model on top of that.
- Progressively resize the model input image size to find the smallest possible input size without sacrificing performance.

Thank you for viewing my project!

Please review the full analysis in the Colab Notebook or view my presentation slideshow.

mod04-computer_vision_cnn's People

Contributors

anna-dang avatar davidbraslow avatar

Stargazers

 avatar  avatar  avatar  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.