1. Home
  2. Explore
  3. Computer Science
  4. Neural Networks Overview

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Neural Networks Overview

Speaker 1Speaker 2

Neural Networks Overview

5:31
0:00-5:31
  1. Hope

    Last time we talked about two-layer neural networks where the hidden layer learned features and the output layer did classification. Today we're going deeper—literally—by adding more hidden layers. And we'll focus on one very successful way to do that: convolutional neural networks, or CNNs.

  2. Corey

    So why are CNNs so special? There's definitely been a lot of hype around deep learning recently. What kicked it off?

  3. Hope

    A big moment was the ImageNet challenge in 2012. AlexNet, a deep CNN with about eight layers, crushed the competition. Before that, the best methods were getting over 20% error. AlexNet dropped that dramatically, and by 2015, the winner had over 100 layers. It really changed the field.

  4. Corey

    But weren't neural networks around for decades? What made CNNs finally take off?

  5. Hope

    You're right—the ideas weren't new. There was the neocognitron in 1980, and Yann LeCun used CNNs for digit recognition in 1989. What changed was computation—GPUs were perfect for the matrix operations—and we had way more labeled data from sources like Mechanical Turk.

  6. Corey

    Alright, so how do we even feed an image into a neural network? We have pixels—how do we turn that into our usual x1, x2, ...?

  7. Hope

    We can flatten the image into a vector. For a grayscale image, each pixel becomes a feature. But if we feed that into a fully connected layer, we lose all spatial structure: it treats pixel 1 and pixel 100 as completely independent.

  8. Corey

    And that's bad because we know that in images, nearby pixels are related. Like, a stop sign is made of pixels that are all together, not scattered across the picture.

  9. Hope

    Exactly. And we also want translation invariance—a stop sign in the corner should be recognized the same as one in the middle. A fully connected layer has to relearn the pattern at every location. So we need a layer that builds in these properties.

  10. Corey

    That's where convolution comes in, right? How does that work?

  11. Hope

    Let's start with a 1D example. Imagine a signal like a time series. A filter is just a small set of weights—say three numbers—that we slide across the signal, taking dot products. Each dot product gives us a new value. That's a convolution.

  12. Corey

    So we're reusing the same small filter across the whole signal. That already sounds more efficient. But what about the edges? If you start at the beginning, you can't center the filter on the first pixel.

  13. Hope

    Right, that's where padding comes in. We add zeros around the edges so the filter can be applied everywhere, and the output can stay the same size as the input. Then we often pass the result through an activation function like ReLU, which zeros out negative values.

  14. Corey

    And besides the filter weights, there's also a bias term, right? Like in logistic regression.

  15. Hope

    Yes. For each filter we have a set of weights and a bias. You compute the dot product plus the bias, then apply the activation. And the beautiful thing is how few parameters we need.

  16. Corey

    Let's compare that to a fully connected layer. Say I have 10 input pixels and I want 10 outputs. With a filter of size 3 plus bias, that's just 4 parameters. But if I used a fully connected layer, how many would I have?

  17. Hope

    For 10 inputs and 10 outputs, each output needs a weight for every input plus a bias, so 11 parameters per output, times 10 outputs, gives 110. That's a huge difference! Convolution forces weight sharing, which is great when the same pattern can appear anywhere.

  18. Corey

    Okay, that makes sense for 1D. But real images are 2D. How does convolution work there?

  19. Hope

    Pretty much the same, but now the filter is a 2D patch, like 3x3. We slide it over the image, multiplying corresponding pixel values and summing. For example, a filter with -1 on the border and +1 in the centre acts like a dot detector—it lights up when a pixel is surrounded by zeros.

  20. Corey

    So filters detect simple patterns like edges or dots. But in practice, we use many different filters, right? That gives us multiple output images.

  21. Hope

    Exactly. Each filter produces a channel, and stacking them gives a 3D tensor. Even grayscale images become 3D once we apply multiple filters—so depth appears both from color channels and from the filter bank.

  22. Corey

    And after convolution, we normally do some pooling. What's that about?

  23. Hope

    Max pooling looks at small regions and takes the maximum value. It tells you whether something was detected in that region, and it reduces the spatial size. You can also use stride to skip pixels—so instead of sliding one step at a time, you move three steps, which further downsamples the image. Importantly, pooling has no learnable parameters.

  24. Corey

    So a typical CNN stacks these: convolution + ReLU, then max pooling, then another convolution + ReLU, then pooling, and so on. Then at the end, we flatten and use a fully connected layer for classification.

  25. Hope

    Yes. The early layers detect simple patterns, deeper layers combine them into more complex features, and the final fully connected layer uses those features to make a prediction. It's all learned end-to-end.

  26. Corey

    And how do we learn all those filter weights? Is it still gradient descent and backpropagation?

  27. Hope

    Exactly the same principle. We define a loss, compute gradients, and update weights. The only difference is that because filters are shared across the image, the gradient for a weight involves summing over all positions. For example, with a 1D filter of size 3, the derivative of a pre-activation with respect to weight w3 is just the corresponding input pixel x3 at that position. So backpropagation handles it naturally, just with a bit more bookkeeping.

  28. Corey

    So we've gone from simple linear models to two-layer nets, and now to deep CNNs. It's a really powerful framework, especially for images.

  29. Hope

    Absolutely. That's all for today. Next time we'll build on these ideas. Enjoy the rest of your week!

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent