Convolutional Neural Networks (CNNs)

CS 212, AI Programming 1

Contents

[TOC]

When we tried to assign weights to a perceptron that classified happy and sad faces, we discovered that the perceptron (or an ANN) had difficulty with:

CNNs resolves these problems and more using a convolution operation. This operation involves sliding a filter (called a kernel) over the input data and performing pixel-wise multiplication followed by a sum. This process helps in extracting features from the input.

Here is a simplified description of the process (provided by MS Copilot):

Think of an image as a large field of different colored flowers. Now, suppose you want to identify patterns or features in this field, like areas of certain colors or color combinations.

The convolution operation is like using a small magnifying glass to look at one small area of the field at a time.

As you move the magnifying glass across the field (or the image), you’re focusing on one small area at a time. For each area, you’re asking, “What’s interesting here?” The answer could be “a lot of red flowers,” “mostly blue flowers,” “a mix of red and blue flowers,” and so on. These are the “features” that the filter is learning to recognize.

The interesting thing is, you use the same magnifying glass (the same filter) to look at the entire field. This means you’re looking for the same kind of features everywhere in the image. This is what gives CNNs their power: they can recognize the same features no matter where they appear in the image.

In summary, the convolution operation in a CNN is like using a magnifying glass to systematically scan across an image, looking for interesting features one small area at a time.

History of CNN Development

Convolutional Neural Networks (CNNs) were first developed and used in the 1980s. The foundational work was done by Kunihiko Fukushima and Yann LeCun.

Yann LeCun, in 1989, proposed a neural network architecture known as LeNet-5. This was the first successful implementation of a network that utilized the backpropagation algorithm for training, which is a standard method for training CNNs today. LeNet-5 was used for digit recognition tasks.

The significant breakthrough in the field of CNNs came in 2012 with the development of AlexNet by Alex Krizhevsky. AlexNet significantly outperformed previous image recognition algorithms and won the 2012 ImageNet contest with 85% accuracy.

Using TensorFlow for Image Recognition

TensorFlow makes building CNNs highly accessible, through its high-level API, Keras. Instead of writing complex mathematical equations for matrix multiplications and convolutions from scratch, a developer can build a CNN in TensorFlow using a few lines of code by stacking prebuilt blocks:

Reference

Articles and Tutorials

Interactive Web Pages

CNN Explainer


Creative Commons License AI Programming 1 lecture notes by Brian Bird, written in 2024, revised in , are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Note: GPT-4 and GPT-4o were used to draft parts of these notes, July 2024.