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.
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.
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.
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)
- The image is loaded using PIL.
- It is resized to match the training input size.
- The image is converted into a NumPy array.
- The array is reshaped (flattened) into a column vector.
- Pixel values are normalized to the range 0–1.
- The trained model parameters are used to make a prediction.
- The predicted class is displayed along with the image.
- Python
- NumPy
- Matplotlib
- Pillow (PIL)
-
Clone the repository: git clone https://github.com/Swizknife/Image-Classification-using-Deep-Learning.git
-
Open Jupyter Notebook: jupyter notebook
-
Run all cells in the notebook.
-
To test your own image, place an image named "image.png" inside the project folder and run the prediction cell.
- Extend to multi-class classification
- Implement CNN architecture
- Improve accuracy with better hyperparameter tuning
- Deploy as a web application