This project implements a CNN-based image classification model to distinguish between cats and dogs using TensorFlow and TensorFlow Datasets (TFDS).
This project explores the fundamentals of computer vision and deep learning by building a model to classify images as cats or dogs. The model leverages the power of CNNs to extract features from images and perform classification tasks.
- Utilizes TFDS for efficient access to a labeled dataset of cat and dog images.
- Implements ImageDataGenerator for data augmentation:
- Rotates images for viewpoint variation.
- Shifts images horizontally and vertically for robustness.
- Applies random shearing for distortion tolerance.
- Zooms in and out for scale invariance.
- Performs horizontal flips to increase data diversity.
- Constructs a CNN model in Keras with sequential layers:
- Convolutional layers (Conv2D) to extract features from the images.
- MaxPooling layers (MaxPool2D) for downsampling and reducing computational cost.
- Employs Flatten and Dense layers for classification:
- Flattens the extracted features into a one-dimensional vector.
- Uses Dense layers with activation functions for classification.
- Integrates Dropout layers for regularization to prevent overfitting.
- Splits the dataset into training and validation sets.
- Trains the model on the training data.
- Evaluates the model's performance on the validation set.
- TensorFlow (tensorflow)
- TensorFlow Datasets (tensorflow_datasets)
- Pandas (pandas)
- NumPy (numpy)
- Matplotlib (matplotlib.pyplot)
- Keras (keras from TensorFlow)
- Clone this repository.
- Install the required libraries (pip install <library_name> for each library).
- Download the cat and dog image dataset (refer to the dataset documentation for download instructions).
- Update the file paths in the code to point to your downloaded dataset location.
- Run the Python script (main.py or equivalent).
We welcome contributions to this project! Feel free to submit pull requests with improvements or extensions to the model or functionalities.
