Skip to content

This project is a machine learning application built from scratch to classify images of cats and dogs using a Convolutional Neural Network (CNN) model. The dataset includes thousands of images, which have been preprocessed and split into training and testing sets.

Notifications You must be signed in to change notification settings

ronnie-allen/Cat_-_Dog-Classsification-Model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cat vs Dog Classification Model

This is a deep learning project developed from scratch to classify images of cats and dogs using a Convolutional Neural Network (CNN). The goal is to train a model that can take an image as input and accurately predict whether it's a cat or a dog.

Features

  • Built using TensorFlow and Keras
  • Trained on a dataset of 10,000+ images
  • Includes scripts for training and prediction
  • Supports image input via OpenCV
  • Model saved in HDF5 (.h5) format for reuse
  • Visualization of test images and predictions using Matplotlib

Project Structure

  • Dataset/
    • train/
    • test/
  • dog_cat_model.h5
  • cat-dog-classification.py
  • train_model.py

Requirements

This project was built and tested on an Ubuntu environment.

Key Python Libraries

  • tensorflow==2.19.0
  • keras==3.9.2
  • opencv-python==4.11.0.86
  • matplotlib==3.10.1
  • numpy==2.1.3
  • h5py
  • protobuf
  • absl-py
  • and more...

All required packages are listed in the requirements list in your environment.

How to Use

  1. Train the model using the train_model.py script.
  2. Save the trained model as dog_cat_model.h5.
  3. Use predict.py to load the saved model and predict new images.
  4. Ensure that test images are correctly placed and accessible.

Output

The model returns either:

  • "Cat" if the image is classified as a cat
  • "Dog" if the image is classified as a dog

A visual output of the prediction image will also be displayed using Matplotlib.

Notes

  • Make sure you deactivate your virtual environment using deactivate before pushing to GitHub (do not push the venv folder).
  • Ensure image paths are valid and images are readable before running prediction.

Made with ❤️ By Ronnie Allen.

About

This project is a machine learning application built from scratch to classify images of cats and dogs using a Convolutional Neural Network (CNN) model. The dataset includes thousands of images, which have been preprocessed and split into training and testing sets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published