|
a |
|
b/combinedDeepLearningActiveContour/functions/DLN.m |
|
|
1 |
% this function takes the image, and optimized parameters of the deep |
|
|
2 |
% learning network and outputs a mask |
|
|
3 |
|
|
|
4 |
function y=DLN(I,parameters,inputSize,hiddenSizeL1,hiddenSizeL2,outputSize,netconfig) |
|
|
5 |
% I : image to be masked |
|
|
6 |
% parameters: the learned/optimized parameters |
|
|
7 |
% inputSize : the visible size |
|
|
8 |
% hiddenSizeL1 and L2: the size for layer 1 and 2 |
|
|
9 |
% outputSize |
|
|
10 |
% netconfig |
|
|
11 |
|
|
|
12 |
patchsize=sqrt(inputSize); |
|
|
13 |
test_input=sampleIMAGES(I,patchsize); |
|
|
14 |
|
|
|
15 |
stackedAEOptTheta=parameters; |
|
|
16 |
|
|
|
17 |
[pred_y] = stackedAEPredict(stackedAEOptTheta, inputSize, hiddenSizeL1, ... |
|
|
18 |
outputSize, netconfig, test_input); |
|
|
19 |
|
|
|
20 |
% mask output |
|
|
21 |
y=reshape(pred_y,patchsize,patchsize,[]); |
|
|
22 |
|
|
|
23 |
scale=size(I,1)/patchsize; |
|
|
24 |
y=imresize(y,scale); |
|
|
25 |
|
|
|
26 |
end |