how can i add feature map to the CNN before fullyConnectedLayer ?

조회 수: 3 (최근 30일)
amir ali aljarrah
amir ali aljarrah 2019년 2월 28일
편집: Shantanu Dixit 2025년 1월 21일
layers = [
imageInputLayer([width,height,channels]); %'DataAugmentation', 'none'); %'Normalization', 'none');
convolution2dLayer(2,16,'Padding',1)
batchNormalizationLayer
reluLayer
here add feature map
fullyConnectedLayer(12)
softmaxLayer
classificationLayer];

답변 (1개)

Shantanu Dixit
Shantanu Dixit 2025년 1월 21일
편집: Shantanu Dixit 2025년 1월 21일
Hi Amir,
To add a feature map in a neural network you can typically add more convolutional layers, which are responsible for detecting features in an image. In the context of your MATLAB code, you can add additional "convolution2dLayer" followed by "batchNormalizationLayer" and "reluLayer" to expand the feature map. Here's how you can modify your code:
% example height width and channels
width = 28;
height = 28;
channels = 1;
%% To calculate the output size of each layer, you can use the formula:
%% output feature size = floor( (Input size + 2*(padding) - filter size) / stride) + 1
%% layer = convolution2dLayer(filterSize,numFilters,Name=Value)
layers = [
imageInputLayer([width, height, channels])
convolution2dLayer(2, 16, 'Padding', 1)
batchNormalizationLayer
reluLayer
convolution2dLayer(3, 32, 'Padding', 1)
batchNormalizationLayer
reluLayer
convolution2dLayer(3, 64, 'Padding', 1)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(12)
softmaxLayer
];
Additionally you can refer to the following MathWorks documentation for more information:
Hope this helps!

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by