Machine Learning, AI

Cat vs. Dog AI Classifier

Project URL: https://colab.research.google.com/drive/1FVuhVa5wUVTAxHoF_o8hNUNfwk3CAKJx?usp=sharing

This project aims to build a neural network model to distinguish between cats and dogs in images, using the TensorFlow and Keras deep learning frameworks within Google Colab. Libraries Used: The following libraries were utilized for various aspects of the project:

  • TensorFlow and Keras: To build and train the neural network model.
  • OpenCV: For image preprocessing, including resizing and converting images.
  • NumPy: For handling arrays and numerical data manipulation.
  • scikit-learn: To split the dataset into training and validation sets.
  • Matplotlib: For visualizing the data and training progress.
  • TQDM: For creating progress bars during data loading and processing.
Data Handling: Images of cats and dogs were loaded and processed. Data augmentation techniques were applied to improve model generalization. The dataset was split into training and validation sets using train_test_split from scikit-learn. Model Architecture: A sequential neural network model was designed, incorporating convolutional layers (Conv2D), pooling layers (MaxPooling2D), and dense layers for feature extraction and classification. The model was compiled using the binary cross-entropy loss function since the task involves a binary classification—either cat or dog. The Adam optimizer was used to ensure efficient convergence.
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
Challenges and Insights: While training the model, it became evident that distinguishing between cats and dogs can be tricky, especially when the images contain similar textures (like fur) or backgrounds. Some false positives occurred when the model misclassified objects like other furry animals or even objects with fur-like patterns as either a cat or dog. Visualization: Throughout the project, I visualized both the data and model's performance. For example, the image plot demonstrates the variation in the dataset, showing both cats and dogs in different environments.