Neural Network in ST Edge AI Developer Cloud Error Shape and shape map lengths must be the same
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I would like to test the ST Edge AI Developer Cloud with a neural network that I trained using MATLAB.
My architecture is the following:
layers = [
sequenceInputLayer(1, 'Name', 'input')
convolution1dLayer(8, 10, 'Padding', 'same', 'Name', 'conv1')
batchNormalizationLayer('Name', 'batchnorm1')
reluLayer('Name', 'relu1')
gruLayer(32, 'OutputMode', 'sequence', 'Name', 'gru1')
fullyConnectedLayer(1, 'Name', 'output')
];
When I load my model into the STM tool, I get the following error: TOOL ERROR: Shape and shape map lengths must be the same: [96] vs. (CH_IN, CH). I wondered if it was due to an error on my part in the network structure.
Thank you in advance,
Silvia
0 Commenti
Risposta accettata
Subhajyoti
il 22 Ott 2024
Modificato: Subhajyoti
il 22 Ott 2024
Hi @Silvia
The error you are encountering, “TOOL ERROR: Shape and shape map lengths must be the same: [96] vs. (CH_IN, CH)” indicates a mismatch between the input and expected shapes in the STM tool, which is generally sensitive to input dimensions and layer compatibility.
Here, in the following implementation, I have used a random sequence of length 96 (since the error mentioned 96) as synthetic data point to test the layer compatibility in the architecture.
% Define your layers in the dlnetwork format
layers = [
sequenceInputLayer(1, 'Name', 'input')
convolution1dLayer(8, 10, 'Padding', 'same', 'Name', 'conv1')
batchNormalizationLayer('Name', 'batchnorm1')
reluLayer('Name', 'relu1')
gruLayer(32, 'OutputMode', 'sequence', 'Name', 'gru1')
fullyConnectedLayer(1, 'Name', 'output')
]
% Create the dlnetwork object
net = dlnetwork(layerGraph(layers));
% Sample input data point: Sequence of length 96 with 1 feature
sequenceLength = 96;
inputData = rand(sequenceLength, 1); % Random sequence with 96 time steps and 1 feature
% Convert input to a dlarray with the format 'CBT' (Channel, Batch, Time)
dlInputData = dlarray(inputData', 'CBT');
% Make prediction using the dlnetwork object
predictedOutput = predict(net, dlInputData)
The above code output indicates that the input and output shapes work correctly. Hence, the error might be arising due to incorrect model input size.
You can refer to the following MathWorks documentation links to learn more about ‘Deep Learning Networks Architectures’ in MATLAB:
Più risposte (0)
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!