Skip to content

Swizknife/Image-Classification-using-Deep-Learning

Repository files navigation

Image Classification using Deep Learning

This project implements an L-layer Deep Neural Network for binary image classification (Cat vs Non-Cat). The model is built completely from scratch using NumPy without using high-level deep learning frameworks like TensorFlow or PyTorch.


Project Overview

This project demonstrates:

  • Parameter initialization
  • Forward propagation
  • Cost computation
  • Backward propagation
  • Gradient descent optimization
  • Prediction on custom images

The architecture is inspired by deep learning concepts taught by Andrew Ng.


Model Architecture

The L-layer neural network follows this structure:

[LINEAR → RELU] × (L-1) → LINEAR → SIGMOID

Hidden layers use ReLU activation. The output layer uses Sigmoid activation for binary classification. Loss function used: Binary Cross-Entropy.


Prediction Flow (Custom Image Testing)

The model allows you to test your own image using the following steps:

Load Image ↓ Resize to (num_px, num_px) ↓ Convert to RGB ↓ Flatten into a vector ↓ Normalize pixel values (divide by 255) ↓ Forward propagation ↓ Prediction (0 = Non-Cat, 1 = Cat)


How Custom Prediction Works

  1. The image is loaded using PIL.
  2. It is resized to match the training input size.
  3. The image is converted into a NumPy array.
  4. The array is reshaped (flattened) into a column vector.
  5. Pixel values are normalized to the range 0–1.
  6. The trained model parameters are used to make a prediction.
  7. The predicted class is displayed along with the image.

Technologies Used

  • Python
  • NumPy
  • Matplotlib
  • Pillow (PIL)

How to Run the Project

  1. Clone the repository: git clone https://github.com/Swizknife/Image-Classification-using-Deep-Learning.git

  2. Open Jupyter Notebook: jupyter notebook

  3. Run all cells in the notebook.

  4. To test your own image, place an image named "image.png" inside the project folder and run the prediction cell.


Future Improvements

  • Extend to multi-class classification
  • Implement CNN architecture
  • Improve accuracy with better hyperparameter tuning
  • Deploy as a web application

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors