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

8 ビュー (過去 30 日間)
amir ali aljarrah
amir ali aljarrah 2019 年 2 月 28 日
編集済み: Shantanu Dixit 2025 年 1 月 21 日 9:57
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 日 9:56
編集済み: Shantanu Dixit 2025 年 1 月 21 日 9:57
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 Center および File ExchangeGet Started with Deep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by