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/"
-
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
![](./media/image1.png)
Create dataframe with the files.
![A screen shot of a computer code Description automatically generated](./media/image2.png)
Check the details of the data.
![A black rectangular object with a black stripe Description automatically generated](./media/image3.png)
Check the categories of the classification.
![A screenshot of a computer Description automatically generated](./media/image4.png)
![A person and a dog kissing Description automatically generated](./media/image5.png)
Add Convolution details to the model with other hidden layers
![A screen shot of a computer program Description automatically generated](./media/image6.png)
![A screenshot of a computer program Description automatically generated](./media/image7.png)
Add callbacks for early stopping and learning rate optimization
![A screenshot of a computer program Description automatically generated](./media/image8.png)
Create train and test data
![A screenshot of a computer screen Description automatically generated](./media/image9.png)
Check the validation data
![A screenshot of a computer screen Description automatically generated](./media/image10.png)
Create dataframe of images with twists and turn for train data.
![A screenshot of a computer program Description automatically generated](./media/image11.png)
Create dataframe of images with twists and turn for validation data.
![A screenshot of a computer program Description automatically generated](./media/image12.png)
Display all the twists and turned images
![A screenshot of a computer screen Description automatically generated](./media/image13.png)
Train the model using fit command
![A screenshot of a computer program Description automatically generated](./media/image14.png)
![A screenshot of a computer Description automatically generated](./media/image15.png)
Display the accuracy graph
![A screen shot of a computer screen Description automatically generated](./media/image16.png)
Create dataframe of images with twists and turn for test data.
![A screenshot of a computer program Description automatically generated](./media/image17.png)
Prepare the data to display the name in the visualisation
![A screen shot of a computer program Description automatically generated](./media/image18.png)
![A screenshot of a computer screen Description automatically generated](./media/image19.png)
Print the result with prediction and image
![A collage of a dog and a cat Description automatically generated](./media/image20.png)
Save the prediction result in csv
![A computer code on a black background Description automatically generated](./media/image21.png)