Predict function returns concatenation error for a two-input Deep Neural Network
조회 수: 2 (최근 30일)
이전 댓글 표시
I was successfully able to train the Two-Input Neural Network with a combined arrayDataStore with an image and a set of features.
I use a concatenation layer in my network to combined the two-input to give a single output. I was able to train successfully and also use the validation data, however when I try to predict using the arrayDataStore I get the following error:
Error using matlab.internal.math.cnn.MLFusedNetwork/predict
Arrays are not compatible for concatenation on specified axis.
I am not sure if the datastore is the issue or the somehow the concatenation layer is giving trouble when predicting.
The code and network image are attached
Layers for the Network:
Data store code:
Thank you
댓글 수: 0
답변 (1개)
Ben
2023년 3월 16일
The "Format" functionLayer is re-labelling the input as "CSSB", and the inputs are "CB", so it's going to make the batch dimension into a spatial dimension and you won't be able to concatenate that as the Fc_conv output has scalar spatial dimensions in DAGNetwork.
You could either change the format in the functionLayer to "CBSS" or move the functionLayer to the other branch and use the function @(x) dlarray(squeeze(x),"CB") to get rid of the scalar S dimensions - then you'd need to concatenate on dimension 1 rather than 3.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!