필터 지우기
필터 지우기

How to arrange convolutional layer for 3D RGB Images

조회 수: 3 (최근 30일)
Rahmawati Rahmawati
Rahmawati Rahmawati 2021년 5월 14일
답변: Srivardhan Gadila 2021년 5월 24일
Dear fellows,
Currently I am tryinying to build encoder decoder layer for 3D RGB input, the objective is to maintain the image size of the output equal to the input. Image input size is 224x224x3. I tried to arrange the convolutional layer following by relu and max pooling layer. However, I continously get error saying that : Dimensions of arrays being concatenated are not consistent. Is there any hints how to do it correctly?
Thanks
  댓글 수: 2
Srivardhan Gadila
Srivardhan Gadila 2021년 5월 21일
@Rahmawati Rahmawati, can you provide the code you have implemented with the exact error message that is displayed in the command window.
Rahmawati Rahmawati
Rahmawati Rahmawati 2021년 5월 21일
@Srivardhan Gadila I have solved the problem above by changing the filter size with 3x3 before the output of regression layer. Currently I am trying to implement flattening/reshape from CNN to LSTM but still getting error.
Here is the code:
encodingLayers = [ ...
convolution2dLayer(3,16,'Padding','same'), ...
reluLayer, ...
maxPooling2dLayer(2,'Padding','same','Stride',2)];, ...
decodingLayers = [ ...
createUpsampleTransponseConvLayer(2,16), ...
reluLayer, ...
convolution2dLayer(3,3,'Padding','same'), ...
sequenceFoldingLayer('Name','fold')
convolution2dLayer(filterSize,numFilters,'Name','conv')
batchNormalizationLayer('Name','bn')
reluLayer('Name','relu')
sequenceUnfoldingLayer('Name','unfold')
flattenLayer('Name','flatten')
lstmLayer(numHiddenUnits,'OutputMode','last','Name','lstm')
fullyConnectedLayer(numClasses, 'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classification')];

댓글을 달려면 로그인하십시오.

채택된 답변

Srivardhan Gadila
Srivardhan Gadila 2021년 5월 24일
The reason for the error "Dimensions of arrays being concatenated are not consistent." is because of the inconsistent use of the "..." operator while creating the decodingLayers array. To resolve the issue either use the operator after every layer in the decodingLayers array or completely remove it. Do it similarly for the encodingLayers array as well.
decodingLayers = [
createUpsampleTransponseConvLayer(2,16)
reluLayer
convolution2dLayer(3,3,'Padding','same')
sequenceFoldingLayer('Name','fold')
convolution2dLayer(3,18,'Name','conv')
batchNormalizationLayer('Name','bn')
reluLayer('Name','relu')
sequenceUnfoldingLayer('Name','unfold')
flattenLayer('Name','flatten')
lstmLayer(numHiddenUnits,'OutputMode','last','Name','lstm')
fullyConnectedLayer(numClasses, 'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classification')];
Once you have resolved the current issue, you can check for other issues with your network/ layers using the analyzeNetwork function.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by