Question regarding designing a CNN structure

4 ビュー (過去 30 日間)
Saugata Bose
Saugata Bose 2019 年 4 月 8 日
編集済み: Javid Hamdard 2021 年 5 月 14 日
Dear
I am trying to design a CNN structure for a specific image input size. The structure I have tried to follow(just for my practice) is following:
imS = [1 23];
layers = [
imageInputLayer(imS)
convolution2dLayer(1,4,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(1,8,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(1,16,'Padding','same')
batchNormalizationLayer
reluLayer
dropoutLayer(0.25)
fullyConnectedLayer(10)
softmaxLayer
classificationLayer]
But during run time, the structure fails. And the following error is displaying:
Invalid network.
Layer 5: Input size mismatch. Size of input to this layer is different from the expected input size.
Inputs to this layer:
from layer 4 (1×17×4 output)
Would you please highlight how to design a structure in this regard. My feelings is that I need to change the number of filters of the cnn according to the image size. Is there any thumb of rule/any general idea available to design a cnn structure based on the image size?
thanks,
  1 件のコメント
Javid Hamdard
Javid Hamdard 2021 年 5 月 14 日
編集済み: Javid Hamdard 2021 年 5 月 14 日
Check your input image size, and also your image input layer size it should to be same.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by