Cats vs Dogs —Your second end-to-end CNN Classifier in 5 minutes

Cats vs Dogs —Your second end-to-end CNN Classifier in 5 minutes

Cats vs Dogs —Your second end-to-end CNN Classifier in 5 minutes. In this article, we will be focusing on 3 different models and ways of achieving higher accuracy. Cool? Let’s get started.

Second Classifier?!

Does that sound weird? So, this is my second blog in the series of DIY CNN models. You can check the first classifier here. In case you haven't read my previous article, I would highly recommend doing so since I’ll be building on top of it. The format of this blog will remain exactly the same. I’ll give you a Colab file, which you have to run (no ifs no buts) before proceeding further.

So here you go — Just Run it! 🏃‍♀️

Yes, I know it will take some time to run. Till then, feel free to read this. The reason I always want you to run it before going forward is — it makes you feel more attached to the problem statement at hand and tends to give better insight. So more bucks for the bang!

Cat person OR dog person?

The Cats vs Dogs dataset is something not packaged with Keras. It was made available by Kaggle as part of a computer-vision competition back in 2013. They were able to achieve 95% accuracy back then. Pretty cool, eh?

In this article, we will be focusing on 3 different models and ways of achieving higher accuracy. Cool? Let’s get started.

Model 1 — Basic Model

Result: ~74% Accuracy

This is exactly similar to our previous classification model. There are some changes based on the nature of the problem though. Lets briefly discuss the same.

Data Preprocessing

You have images, but models work on matrices! Right! So, this a step that will be needed in almost all CNN-based models. Most of these things were discussed in the last article, so not covering them again. So:

1. Load the images

2. Decode the JPEG content to an RGB grid of pixels.

3. Resize the image to 150*150 pixels (to reduce the size of it).

4. Rescale the pixel values (between 0 to 255) to the interval (0, 1] interval

Keras ImageDataGenerator

Usually, I don't go into implementation logic, but this one needs a special mention. The above section might look like a lot of work, right?! But, this beautiful construct of Keras really helps you in getting your work done.

It works on Python generators. If you arent familiar with it would highly recommend doing so. In simpler words, the Generator is a special kind of iterator that works lazily. Unlike lists, these do not store their content in memory but yields them when needed. So, these are iterators that don’t block your memory but use it when needed. Amazing stuff, right?

data-science deep-learning artificial-intelligence machine-learning neural-networks

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Deep Learning 101 —  Neural Networks Explained

The past few decades have witnessed a massive boom in the penetration as well as the power of computation, and amidst this information.

Most popular Data Science and Machine Learning courses — July 2020

Most popular Data Science and Machine Learning courses — August 2020. This list was last updated in August 2020 — and will be updated regularly so as to keep it relevant

Cheat Sheets for AI, Neural Networks, Machine Learning, Deep Learning & Big Data

Cheat Sheets for AI, Neural Networks, Machine Learning, Deep Learning & Big Data

Artificial Neural Networks — Recurrent Neural Networks

Artificial Neural Networks — Recurrent Neural Networks. Remembering the history and predicting the future with neural networks. A intuition behind Recurrent neural networks.

Fundamentals of Neural Network in Machine Learning

Fundamentals of Neural Network in Machine Learning. What is a Neuron? What is the Activation Function? How do Neural Network Works? How do Neural Networks Learn?