rasmusbergpalm / DeepLearnToolbox

Matlab/Octave toolbox for deep learning. Includes Deep Belief Nets, Stacked Autoencoders, Convolutional Neural Nets, Convolutional Autoencoders and vanilla Neural Nets. Each method has examples to get you started.
BSD 2-Clause "Simplified" License
3.8k stars 2.28k forks source link

combine the cnn and nn model into the true convolutional neural network? #146

Open Chuanhai opened 9 years ago

Chuanhai commented 9 years ago

I noticed that the cnn model only contains convolutional and subsampling layers, but no fully connected layers which are included in your nn model. Why do not you combine them into one cnn model which supports convolutional layers, subsampling layers, and fully connected layers? I think these three parts are necessary for a real cnn model. Thanks!

tambetm commented 9 years ago

You can achieve fully connected layer using convolutional layer with filter size equal to input. For example if last convolutional/subsampling layer outputs 10x10 matrix, then you should add another convolutional layer with kernelsize=10 and outputmaps=. Then each filter is applied to input only once and resulting nodes are connected to all input node - therefore it's fully connected layer.

Chuanhai commented 9 years ago

Yeah, I can get one fully connected layer according to what you said. But the problem is when I use convolutional layers to get more fully connected layers, the program crashed.It seems like that your code does not provide two consecutive convolutional layers based on my test. Thanks.

tambetm commented 9 years ago

Sorry, I hadn't tried it myself, I just assumed it would work. Did you use 1x1 size for the second fully connected layer? Anyway, you are on your own here.

Chuanhai commented 9 years ago

Yes, I used 1x1 size for the second fully connected layer. But the program crashed. Thanks.

2015-07-03 6:09 GMT-05:00 tambetm notifications@github.com:

Sorry, I hadn't tried it myself, I just assumed it would work. Did you use 1x1 size for the second fully connected layer? Anyway, you are on your own here.

— Reply to this email directly or view it on GitHub https://github.com/rasmusbergpalm/DeepLearnToolbox/issues/146#issuecomment-118317083 .

rccheung commented 9 years ago

Have you tried adding in another sub-sampling layer before adding another 1x1 convolutional layer? I suppose if you have the 1x1 convolutional layer before this the sub-sampling layer won't do anything, i.e. it will simply pass all the convolutional maps unchanged to the next layer.

shay86 commented 7 years ago

I built a project using (Merge, merge) layer once, and use share layer in another to combine two CNN's. The problem I can't find any documentation that explains how merge or share layer works like convolution or max-pooling layers. I will be grateful if anyone can direct me or suggest some paper to me ???