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

3 vues (au cours des 30 derniers jours)
amir ali aljarrah
amir ali aljarrah le 28 Fév 2019
layers = [
imageInputLayer([width,height,channels]); %'DataAugmentation', 'none'); %'Normalization', 'none');
convolution2dLayer(2,16,'Padding',1)
batchNormalizationLayer
reluLayer
here add feature map
fullyConnectedLayer(12)
softmaxLayer
classificationLayer];

Réponses (1)

Shantanu Dixit
Shantanu Dixit le 21 Jan 2025
Modifié(e) : Shantanu Dixit le 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!

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by