3D convolutional auto encoder

2 visualizaciones (últimos 30 días)
Juuso Korhonen
Juuso Korhonen el 29 de Mzo. de 2021
I try to define a 3D convolutional auto encoder, but when trying to train my training error just stays the same. Here is my structure:
layers = [
image3dInputLayer([120 160 120 1], 'Name', 'Input', 'Normalization',"none") %??
convolution3dLayer([3 3 3], 10, 'Name', 'conv1', "Padding", "same", 'Stride', [1 1 1])
reluLayer('Name', 'relu1')
maxPooling3dLayer([2 2 2], "Stride", [2 2 2], "Name", 'max1')
convolution3dLayer([3 3 3], 10, 'Name', 'conv2', "Padding", "same", 'Stride', [1 1 1])
reluLayer('Name', 'relu2')
maxPooling3dLayer([2 2 2], "Stride", [2 2 2], "Name", 'max2')
convolution3dLayer([3 3 3], 10, 'Name', 'conv3', "Padding", "same", 'Stride', [1 1 1])
reluLayer('Name', 'relu3')
maxPooling3dLayer([2 2 2], "Stride", [2 2 2], "Name", 'max3')
dropoutLayer(0.5, "Name", 'drop')
convolution3dLayer([3 3 3], 10, 'Name', 'conv4', "Padding", "same", 'Stride', [1 1 1])
reluLayer('Name', 'relu4')
resize3dLayer("OutputSize",[30 40 30], 'Method', "nearest", 'Name','up1')
convolution3dLayer([3 3 3], 10, 'Name', 'conv5', "Padding", "same", 'Stride', [1 1 1])
reluLayer('Name', 'relu5')
resize3dLayer("OutputSize",[60 80 60], 'Method',"nearest", 'Name','up2')
convolution3dLayer([3 3 3], 10, 'Name', 'conv6', "Padding", "same", 'Stride', [1 1 1])
reluLayer('Name', 'relu6')
convolution3dLayer([1 1 1], 1, 'Name', 'concatenation', "Padding", "same", 'Stride', [1 1 1])
resize3dLayer("OutputSize",[120 160 120], 'Method', "nearest", 'Name','up31') %??
sigmoidLayer('Name', 'sigmoid') %??
regressionLayer('Name', 'reglayer')
];
lgraph = layerGraph(layers);
Especially I would like to know if the combining of the final feature maps is done correctly with the last convolution3dLayer, since I couldn't find a suitable layer for it in 3D. Also, if the use of sigmoid before the output is suitable? If I use normal reluLayer, the training error just goes to Inf.
I do the training the following way:
imdsTrain = transform(imdsTrain, @resize2AE,'IncludeInfo',true);
[net, info] = trainNetwork(imdsTrain, lgraph, options);
% Where the resize2AE function is
function [dataOut,info] = resize2AE(data,info)
numRows = size(data,1);
dataOut = cell(numRows,2);
% since ReadSize is expected to be >1, data comes in cell form containing
% multiple images
for idx = 1:numRows
% get the image out of the datacell
D = data{idx,1};
D = single(D);
D = imresize3(D, [120, 160, 120]);
D = normalize(D, 'range'); % normalize to [0,1] range
dataOut(idx,:) = {D,D}; % This is supposed to work for AE!!!!!!!
end
end
Can you spot some errors?

Respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by