Cats and Dogs Classification Using Keras

Overview

This project demonstrates a simple image classification task using the Keras deep learning library. The goal is to create a model that can accurately distinguish between images of cats and dogs. The dataset used for training and testing consists of labeled images of cats and dogs.

Prerequisites

Before running the code, ensure that you have the following dependencies installed:

Python (3.6 or higher) TensorFlow (2.x) Keras NumPy Matplotlib Jupyter Notebook (optional, for running the provided notebooks) You can install the required Python packages using the following command:

bash Copy code pip install tensorflow keras numpy matplotlib

Dataset

The dataset used for this project is not included in the repository due to its size. You can download the dataset from Kaggle's Dogs vs. Cats competition. After downloading, extract the contents and organize the files into the data directory in the following structure:

Directory Structure

The dataset used for this project should be organized into the following directory structure:

data/
|-- train/
|   |-- cat.0.jpg
|   |-- cat.1.jpg
|   |-- ...
|   |-- dog.0.jpg
|   |-- dog.1.jpg
|   |-- ...
|-- test/
|   |-- 1.jpg
|   |-- 2.jpg
|   |-- ...
|-- validation/
|   |-- cat.0.jpg
|   |-- cat.1.jpg
|   |-- ...
|   |-- dog.0.jpg
|   |-- dog.1.jpg
|   |-- ...

Usage

Data Preprocessing: Run the data_preprocessing.ipynb notebook to prepare the dataset for training.

Training the Model: Execute the train_model.ipynb notebook to train the image classification model. Adjust hyperparameters as needed.

Evaluation: After training, use the evaluate_model.ipynb notebook to evaluate the model's performance on the validation set.

Prediction: If you want to make predictions on new images, use the predict.ipynb notebook.

Model Architecture

The model architecture used in this project is a simple convolutional neural network (CNN) with the following layers:

Convolutional layer Max pooling layer Convolutional layer Max pooling layer Flatten layer Dense layer Output layer You can find the details of the architecture in the model.py file.

Results

The model achieves a certain accuracy on the validation set after training. The performance metrics and visualizations are available in the evaluate_model.ipynb notebook.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

hmb_pp

  • H.M. Mehedi Hasan (Badhon)
    • Associate Robotics Engineer at Next Solution Lab (NSL)

Acknowledgments

The dataset used in this project is from Kaggle's Dogs vs. Cats competition. Feel free to explore, modify, and extend the code to suit your needs. If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request. Happy coding!