pytorch / tutorials

PyTorch tutorials.
https://pytorch.org/tutorials/
BSD 3-Clause "New" or "Revised" License
8.18k stars 4.05k forks source link

Clarify why there are 6 output channels #790

Closed jlin27 closed 4 years ago

jlin27 commented 4 years ago

In the Define the network section of the Neural Network tutorial, clarify why is it 6 outputs? Is it bias?

image

JonathanSum commented 4 years ago

Right, I remember what I was taught in deeplearn.ai's video on coursera. that 6 output is not the bias. When we are doing on CNN, like VGG for example, we have to decrease the size of the image and increase the size of the channel to extract the feature. VGG model uses these all the time. I hope we have more technical people come here to explain more because I think I am not quite right. However, if you want to see that video, I can post the link of it.

parmarsuraj99 commented 4 years ago

6 output channels are the numbers of filters or kernels which will be applied to the input image (of Height x Width x 1 dimensions), So We want out model to learn some different local relations between pixels (let's say in a region of 3x3) that are not obvious for us. So we want to increase the channels (filters/ kernels) and by applying 3x3 kernels, we decrease the Height and Width of further layers. That's what convolution layers do. We can expect that model might have learned enough local relations between the layers and after some layers these local (spatial) relation will be given to a bigger channel (i.e. 16 nn.Conv2d(6, 16, 3)) that can represent entire picture in a spatially squeezed but with more channels. Then Flattening and FullyConnectedNet or GlobalAveragePooling layers can be applied. This is a way of encoding image into a more learnable extracted format to do operations on it

Checkout these resources https://brohrer.github.io/how_convolutional_neural_networks_work.html

For Visualization https://www.cs.ryerson.ca/~aharley/vis/conv/flat.html image

boulabiar commented 4 years ago

Looks like a typo bug Next in the tutorial it's 5x5 https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html

Patch is here https://github.com/pytorch/tutorials/pull/859

jlin27 commented 4 years ago

Addressed in recipe