Code Monkey home page Code Monkey logo

pneumonia-classification's Introduction

Pneumonia Classification

This is a Python script for classifying chest X-ray images to detect pneumonia using trained Deep Learning model. It is built using Streamlit and Keras.

Getting Started

To run this script, follow the steps below:

  1. Install the required dependencies by running the following command: pip install streamlit keras Pillow

kotlin Copy code

  1. Download the trained model and class labels files and place them in the model directory:
  • [pneumonia_classifier.h5] (trained Keras model)
  • [labels.txt] (list of class labels)
  1. Run the script by executing the following command:
streamlit run app.py

Usage

  1. The script will launch a Streamlit app.

  2. Upload an image of a chest X-ray using the file uploader.

  3. The app will display the uploaded image and classify it using the trained model.

  4. The predicted class and confidence score will be shown below the image.

Requirements

- numpy==1.23.5
- streamlit==1.22.0
- Pillow==9.5.0
- keras==2.12.0
- tensorflow==2.12.0

Acknowledgments

utils.py

Utility Functions

This Python module provides utility functions used in the main.py script for classifying chest X-ray images.

Functions

set_background(image_file)

This function sets the background of a Streamlit app to the specified image.

  • image_file (str): The path to the image file to be used as the background.

classify(image, model, class_names)

This function takes an image, a trained machine learning model, and a list of class names, and returns the predicted class and confidence score of the image.

  • image (PIL.Image.Image): An image to be classified.
  • model (tensorflow.keras.Model): A trained machine learning model for image classification.
  • class_names (list): A list of class names corresponding to the classes that the model can predict.

Returns a tuple of the predicted class name and the confidence score for that prediction.

Output

classification

pneumonia-classification's People

Contributors

its-kind-of avatar

Stargazers

 avatar

Watchers

Kostas Georgiou 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.