フィルターのクリア

Layer 'fc1': Invalid input data for fully connected layer. The input data must not have both spatial and temporal dimensions.

33 ビュー (過去 30 日間)
Mads
Mads 2022 年 12 月 1 日
回答済み: Sanjana 2023 年 6 月 5 日
My network:
Layers = [ ...
sequenceInputLayer([50,1,3],'Name','retina');
reluLayer('Name','relu1');
fullyConnectedLayer(400,'Name','fc1')
reluLayer('Name','relu2');
fullyConnectedLayer(200,'Name','fc2')
reluLayer('Name','relu3');
fullyConnectedLayer(100,'Name','fc3')
reluLayer('Name','relu4');
fullyConnectedLayer(64);
regressionLayer('Name','output')];
The first fully connected layers seems to think its input contains both spatial and temporal numbers:
[net,netinfo] = trainNetwork(trainInput,trainTarget,Layers,options);
Caused by:
Layer 'fc1': Invalid input data for fully connected layer. The input
data must not have both spatial and temporal dimensions.
Which is not true. It is only spatial and with three "spectral" instances per spatial point (50 in total)
How is MATLAB able to judge this?
How to fix it?

回答 (1 件)

Sanjana
Sanjana 2023 年 6 月 5 日
Hi Mads,
I understand that you are encountering some difficulties with using the "fully connected layer". The error message you encountered indicates that the input to a fully connected layer should be a 1D vector, rather than a matrix or grid. The purpose of a fully connected layer is to learn weights for each input feature and combine them to produce meaningful output.
One possible solution to solve this problem is to use a “flatten layer” before the fully connected layer, as the “flatten layer” flattens the input into a 1D vector. This allows the fully connected layer to receive the flattened input and perform its computations effectively.
Please refer to the following link, for further information on “flatten layer”,
Hope this helps!

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by