Effacer les filtres
Effacer les filtres

Error when using predict DLblock in Simulink - Incorrect input size (#74.155.409)

4 vues (au cours des 30 derniers jours)
Hello, I am experiencing an issue when using the DL block predict in Simulink.
I plan to collect three scalars from sensors to concatenate them in a 1x3 vector to be fed as input in a pretrained feature regression NN, which is loaded from a .mat file. For sake of simplicity, in the simulink model I shared (please see the attached compressed folder), I replaced the sensors with three random number generators. Anyway, I receive the following error:
Error:Incorrect input size. The input data must have 3 columns.
Function 'Predict/MLFB' (#77.155.409), line 5, column 19:
"deep.blocks.internal.deepNetwork({in_1}, {size(in_1)}, {class(in_1)}, coder.cons"
I also tried a test: I collected the input in the workspace (please see the attached figure) to feed it in the NN (via Workspace), and I am able to collect a prediction with the following command:
preds=predict(NN,out.simout1.Data(1,:));
Therefore, I would think that there is something wrong in the size (or the expected size) of the input in my simulink model.
Could you please help me with it?
Many thanks in advance,
Giovanni

Réponse acceptée

Pavan Sahith
Pavan Sahith le 7 Fév 2024
Modifié(e) : Pavan Sahith le 7 Fév 2024
Hello Giovanni,
I understand that you are encountering an error related to the DL predict block input size in Simulink. The error indicates that the input data must have three columns.
I can see that you are using the 'Matrix Concatenate' block with 'vector' mode which could be causing this issue. When used in this mode, the output is a one-row or one-column matrix, potentially causing an error when fed into the 'Predict' block.
You can try the following steps to resolve the error:
  • Double-click on the 'Matrix Converter' block to access block parameters.
  • Adjust the number of inputs to 3 for your use case.
  • Change the mode to 'Multidimensional Array.'
  • Specify the concatenate dimension; I assume that it should be 2 in your case.
  • Click on 'Apply' and 'OK' to save the changes.
After making these adjustments, your model should run without encountering the specified error. For your convenience, I have attached an image after making the required changes.
If you want to know more about the Matrix Concatenate and DL Predict block, please refer to the following MathWorks documentation.
Hope this Helps!
  1 commentaire
Giovanni
Giovanni le 11 Fév 2024
Hello, Pavan, thank you very much for your answer and help.
I solved this issue by using the transpose block after the concatenation block.
Best regards,
Giovanni

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning with Simulink dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by