Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Cats or Dogs? CNN Image Classification

ExamplePot

Overview

This is a Convolutional Neural Network (CNN) model developed for educational purposes using TensorFlow and Keras to create, train, and evaluate deep neural networks. The model is designed to classify images of cats and dogs, leveraging a dataset provided by TensorFlow.

Dataset

The dataset consists of 2000 images of cats and dogs for training and 1000 images for validation, organized into separate directories for each purpose. Before training, the images are resized to 160x160 pixels. Color values in the images are normalized to a range between 0 and 1.

You can see more about the dataset by clicking here.

Or just download it here.

Model Architecture

The CNN model consists of several layers:

  1. Rescaling Layer: Rescales the input images to the desired size.
  2. Convolutional Layers: Convolutional layers with ReLU activation functions to introduce non-linearity.
  3. MaxPooling Layers: Downsamples the feature maps generated by the convolutional layers.
  4. Flatten Layer: Flattens the output of the convolutional layers into a 1-dimensional array.
  5. Dense Layers: Fully connected layers with ReLU activation functions.
  6. Output Layer: A single node with a sigmoid activation function for binary classification (0 for cat, 1 for dog).

Training

The model is trained using the Adam optimizer with binary cross-entropy loss. Training occurs over 20 epochs with a batch size of 32.

Usage

To use the model, you can either download the model and load it in your code using the following command:

model = tf.keras.models.load_model('path/to/model')

Alternatively, you can create a copy of the ImageClassification.ipynb notebook and run/manipulate the entire code (including training).

Results

After training, the model's performance can be evaluated by visualizing predictions on a test dataset. The plot_dataset_predictions function generates a visualization of 9 predictions as images, comparing them with their ground truth labels.

What's Next?

This model is still under development. The next steps involve evaluating the quality of the generated model by applying metrics to our validation dataset. After analyzing the performance and accuracy of the model training, I will need to address any related issues found. For example, to find a way to prevent overfitting.

Additionally, I plan to apply transfer learning to this model, leveraging pre-trained models in TensorFlow for similar training tasks.

Dependencies

  • TensorFlow
  • Matplotlib

Author

Felipe Becker

About

Cats or Dogs? This is a Convolutional Neural Network (CNN) model developed for educational purposes using TensorFlow and Keras to create, train, and evaluate deep neural networks. The model is designed to classify images of cats and dogs, leveraging a dataset provided by TensorFlow.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages