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.78k stars 2.28k forks source link

Confusion in variable names #171

Open Addhi86 opened 7 years ago

Addhi86 commented 7 years ago

Hello,

I have started learning about the deep learning, I have downloaded this toolbox. To understand about the CNN I have started with the 'test_example_CNN' I am confused about these variables train_x, test_x, train_y, test_y why it is with 'x' and 'y' Also what is cnnsetup?

wajihullahbaig commented 7 years ago

Those are the very basic things my friend. You need to go through the understanding the mnist dataset. You can find the dataset under 'data' folder. The dataset is divided into training and testing sets. Training sets have images and labels, testing sets have images only for which a label is predicted. Hope this helps. If you are comfortable with python, You can find a python translation of the code here. https://github.com/wajihullahbaig/DeepNeuralNetworks

Addhi86 commented 7 years ago

Thanks Wajihullah baig, Yes, you are right it was the basic query. i am more comfortable with MATLAB. some other things which I want to know is: 1) struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer I have confusion in understanding what is meant by 'outputmaps'? 'kernelsize' 5 mean the filter size is 5x5.

2) struct('type', 's', 'scale', 2) %sub sampling layer This sub sampling layer with the size 2x2? is it possible to add ReLu layer?

3) What is opt.alpha?

4) In the test_example_CNN if i add more convolution and sub sampling layer I got an error. what is the reason?

cnn.layers = {
    struct('type', 'i') %input layer
    struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer
    struct('type', 's', 'scale', 2) %sub sampling layer
    struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer
    struct('type', 's', 'scale', 2) %sub sampling layer
    struct('type', 'c', 'outputmaps', 18, 'kernelsize', 5) %convolution layer
    struct('type', 's', 'scale', 2) %subsampling layer
};

Error: Array dimensions must match for binary array op.

Error in cnnbp (line 32) z = z + convn(net.layers{l + 1}.d{j}, rot180(net.layers{l + 1}.k{i}{j}), 'full');

Error in cnntrain (line 17) net = cnnbp(net, batch_y);

Error in test_example_CNN (line 31) cnn = cnntrain(cnn, train_x, train_y, opts);

wajihullahbaig commented 7 years ago

You should first understand the concepts of convolutional networks. Its too lengthy to explain here. Once you grasp the ideas, you will note that it is easy to follow code or write your own. I suggest you read about them from link/blogs/videos by andrej karpathy.

Addhi86 commented 7 years ago

Thanks I will check that.. Is it too lengthy to give answer of each question?

wajihullahbaig commented 7 years ago

You can add any sorts of layers - Just make sure you dont break the code. A ReLU is a good idea. I am note sure why you are getting array dimension errors, possibly your data that is being convolved with a filter is some how mismatched in terms of dimensions. You should check if convn() function parameters accepted.