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

3 Ansichten (letzte 30 Tage)
amir ali aljarrah
amir ali aljarrah am 28 Feb. 2019
Bearbeitet: Shantanu Dixit am 21 Jan. 2025
layers = [
imageInputLayer([width,height,channels]); %'DataAugmentation', 'none'); %'Normalization', 'none');
convolution2dLayer(2,16,'Padding',1)
batchNormalizationLayer
reluLayer
here add feature map
fullyConnectedLayer(12)
softmaxLayer
classificationLayer];

Antworten (1)

Shantanu Dixit
Shantanu Dixit am 21 Jan. 2025
Bearbeitet: Shantanu Dixit am 21 Jan. 2025
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!

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by