Layer 'fc1': Invalid input data for fully connected layer. The input data must not have both spatial and temporal dimensions.
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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?
0 Commenti
Risposte (1)
Sanjana
il 5 Giu 2023
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!
0 Commenti
Vedere anche
Categorie
Scopri di più su Image Data Workflows in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!