Layer 'fc1': Invalid input data for fully connected layer. The input data must not have both spatial and temporal dimensions.
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Sanjana
el 5 de Jun. de 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 comentarios
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!