Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in cnnbp.m while using CNN #156

Open
AviiGupta opened this issue Sep 29, 2015 · 1 comment
Open

Error in cnnbp.m while using CNN #156

AviiGupta opened this issue Sep 29, 2015 · 1 comment

Comments

@AviiGupta
Copy link

There is an error in cnnbp.m file, which said that

////////////////////////////////////////////////
“Undefined function ‘expand’ for input arguments of type ‘double’.”
in the following line:

net.layers{l}.d{j} = net.layers{l}.a{j} .* (1 – net.layers{l}.a{j}) .* (expand(net.layers{l + 1}.d{j}, [net.layers{l + 1}.scale net.layers{l + 1}.scale 1]) / net.layers{l + 1}.scale ^ 2);

//////////////////////////////////////////////

Please let me know if I am making any error in parameter selection that may have resulted in this issue. The details of the parameter along with data set are as follows -

  1. dim(train_x) = 29x29x131072
  2. dim(train_y) = 4x1x131072

similarly test data sets.

Now, number of layers = 5 as per default in the test_example_CNN. With kernel size = 3 in both layer 2 & 4. Scale factor is set to be 3 in layer 3 and 7(just for trial purposes) in layer 5.

opts.alpha = 1
opts.batchsize = 64
opts.numepochs = 1

@scoard
Copy link

scoard commented Nov 14, 2019

you shou add a function to do this, the purpose of the matrix expansion.
/////////////////////////////////////////////////////////////////////////////////////////////////

function expand_bp = expand_cnn(x,y)
expand_bp = zeros(size(x,1)*y(1),size(x,2)*y(2),size(x,3)*y(3)); %
test_column = zeros(size(x,1)*y(1),size(x,2)*y(2),size(x,3));;% column operation
test_row = zeros(size(x,1)*y(1),size(x,2),size(x,3)); % row operation
row_row = y(1);
column_column = y(2);
heigh_heigh = y(3);
for n =1: size(x,3)
% row operation
for row = 1:size(x,1)
while row_row>0
test_row(y(1)*row-(row_row-1),:,n) = x(row,:,n);
row_row = row_row-1;
end
row_row = y(1);
end
% column operation
for column = 1:size(x,2)
while column_column>0
test_column(:,(y(2)*column-(column_column-1)),n) = test_row(:,column,n);
column_column = column_column-1;
end
column_column = y(2);
end
% third dimension
while heigh_heigh>0
expand_bp(:,:,y(3)*n-(heigh_heigh-1)) = test_column(:,:,n);
heigh_heigh = heigh_heigh-1;
end
heigh_heigh = y(3);
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants