Skip to content

Dnsflr/PneumoniaDetectionCNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Classification with CNN Feature Extraction and Logistic Regression

This project demonstrates an approach to image classification using a pre-trained Convolutional Neural Network (CNN) for feature extraction, followed by a Logistic Regression model for final classification. This method leverages the power of transfer learning to achieve good performance with potentially less training data compared to training a CNN from scratch.

The core idea is to utilize a pre-trained CNN (specifically VGG16 in this case) as a fixed feature extractor. The features generated by the CNN are then fed into a simpler, trainable model like Logistic Regression for the classification task.

Table of Contents

Project Overview

The project involves the following key steps:

  1. Data Preparation: Loading and preprocessing image data.
  2. Transfer Learning with VGG16: Utilizing a pre-trained VGG16 model (without its top classification layer) to extract features from the images.
  3. Feature Extraction: Passing the image data through the VGG16 base model to obtain a set of high-level features for each image.
  4. Logistic Regression Classification: Training a Logistic Regression model on the extracted features to perform the final classification.
  5. Model Evaluation: Assessing the performance of the combined model using various metrics.

Features

  • Transfer Learning: Efficiently leverages knowledge from a large pre-trained model (VGG16).
  • Feature Extraction: Uses the CNN as a powerful feature extractor, reducing the need for extensive manual feature engineering.
  • Logistic Regression: Employs a simple yet effective classifier for the final prediction stage.
  • Clear Workflow: The Jupyter notebook provides a step-by-step demonstration of the entire process.

Technologies Used

  • Python 3.x
  • TensorFlow / Keras
  • Scikit-learn
  • NumPy
  • Matplotlib
  • Seaborn
  • Jupyter Notebook

Getting Started

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

Prerequisites

Ensure you have Python 3.x installed. You can download it from python.org.

Installation

  1. Clone the repository:
    git clone [https://github.com/your-username/your-repository-name.git](https://github.com/your-username/your-repository-name.git)
    cd your-repository-name
  2. Install the required packages:
    pip install -r requirements.txt
    (Note: You might need to create a requirements.txt file based on the imports in CNN_Detection.ipynb) A basic requirements.txt might look like this:
    tensorflow
    keras
    scikit-learn
    numpy
    matplotlib
    seaborn
    jupyter
    

Usage

  1. Open the Jupyter notebook:
    jupyter notebook CNN_Detection.ipynb
  2. Run all cells in the notebook to execute the entire workflow, from data loading to model evaluation.

Project Structure

├── CNN_Detection.ipynb ├── data/ │ └── (Your image dataset goes here, e.g., train/, test/, validation/) ├── README.md ├── requirements.txt └── (any other supporting files or directories)

  • CNN_Detection.ipynb: The main Jupyter notebook containing all the code for data loading, model training, and evaluation.
  • data/: This directory should contain your image dataset, organized into appropriate subdirectories (e.g., train, test, validation) with subfolders for each class.

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors