Workshop for Cat/Dog Classification using CNN

Prerequisites for the workshop

  • Download the dataset from the [dogs-vs-cats]

  • Extract the same in the same folder

  • Open and start working on the cnn-cat-dog-dl-ws.ipynb

  • For google colab - run the below command in the cell after creating the shortcut

from google.colab import drive
drive.mount('/content/drive')
!ls "/content/drive/My Drive/cat-dog"
!cp -r  "/content/drive/My Drive/cat-dog" "/content/"

Notebook

  • Add the code from the given reference and run the cell.

  • If the code already exists, please run the code and move to the next cell.

Import all needed packages and declare constants

Create dataframe with the files.

A screen shot of a computer code Description automatically generated

Check the details of the data.

A black rectangular object with a black stripe Description automatically generated

Check the categories of the classification.

A screenshot of a computer Description automatically generated

Display the image.

A person and a dog kissing Description automatically generated

Add Convolution details to the model with other hidden layers

A screen shot of a computer program Description automatically generated

A screenshot of a computer program Description automatically generated

Add callbacks for early stopping and learning rate optimization

A screenshot of a computer program Description automatically generated

Create train and test data

A screenshot of a computer screen Description automatically generated

Check the validation data

A screenshot of a computer screen Description automatically generated

Create dataframe of images with twists and turn for train data.

A screenshot of a computer program Description automatically generated

Create dataframe of images with twists and turn for validation data.

A screenshot of a computer program Description automatically generated

Display all the twists and turned images

A screenshot of a computer screen Description automatically generated

Train the model using fit command

A screenshot of a computer program Description automatically generated

Save the weights

A screenshot of a computer Description automatically generated

Display the accuracy graph

A screen shot of a computer screen Description automatically generated

Create dataframe of images with twists and turn for test data.

A screenshot of a computer program Description automatically generated

Prepare the data to display the name in the visualisation

A screen shot of a computer program Description automatically generated

A screenshot of a computer screen Description automatically generated

Print the result with prediction and image

A collage of a dog and a cat Description automatically generated

Save the prediction result in csv

A computer code on a black background Description automatically generated