5

I am new to Data Science and CNN.

My understanding of CNN is that:

  • An image's pixel data is convoluted over with filters which extract features like edges and their position.

  • This creates filter maps.

  • Then we apply max pooling which will down sample the data.

  • Then we feed this data to a neural network which learns to classify.

Now I know I can do things with convolution like blurring or get edges from image.

But lets say I am trying to make a "Hotdog or not" app, how do I make my filters? What will the matrix be?

Lakshay Dulani
  • 265
  • 2
  • 6

2 Answers2

7

First of all, feature maps are the output of the convolution after an activation function (e.g. ReLU or sigmoid) is applied, not the matrix that the image is convolved with. Usually, this is called a filter.

The magical thing about CNNs is that we don't know what the filters should look like for any given problem. The CNN works out what each filter should look like automatically. This is done through the backpropagation procedure. Without getting heavy into the math of it all, essentially every time a training example (or a batch of examples) goes through the network, the values inside each filter get updated by some small amount. This small amount is determined using the derivatives of a loss function. As each step of the training procedure is completed, the values inside each filter (if all goes well!) slowly converge towards a value that minimises the loss function, thereby producing the best quality predictions.

For more information on the math, I encourage you to read the chapter on backprop in the free online book Neural Networks and Deep Learning, available here.

A more simple explanation is also provided here

Shrijit Basak
  • 267
  • 1
  • 8
timleathart
  • 3,940
  • 21
  • 35
  • thanks for your answer.. yes u r right those are filters not feature maps.. i have edited my question.. but if i understand correctly, the last stage NN will adjust its weights using backpropagation.. are you saying the backpropagation adjusts the first step's filter as well? – Lakshay Dulani Oct 08 '18 at 03:53
  • Yes, exactly. There are usually several filters and each filter has several values in the matrix. All of these values, as well as the NN weights, are called parameters and are all updated using backpropagation on the loss function. – timleathart Oct 08 '18 at 04:58
  • brooo i always get my mind blown by neural networks...like first I thought, you had to GIVE it filters or something but now that I know that they figure that too by themselves, like the guy who made this is a literal legend – random_hooman Aug 03 '22 at 17:26
0

We need to choose filter size from hyperparameters tuning. It is always based on your problem what kind of features you are trying to extract. Sometimes 33,55 or 9*9 is appropriate and it always based on what kind of problem we are solving. we can Initialize filter value with random 1 and 0 in a matrix. The filter value are learnt during training (i.e. during backpropagation). Hence, the individual values of the filters are often called the weights of a CNN.

Soumya
  • 101
  • 1