trainNetwork in MATLAB after several iterations gives error: Array dimensions being concatenated are inconsistent?

3 次查看(过去 30 天)
I am currently working on several CNNs for regression. After several iterations (btw 1500-3000 something) of training a similar architecture as V-net by Miletari et.al and a less deep multi-input CNN architecture the training stops due to the error below.
Error using trainNetwork
Dimensions of arrays being concatenated are not consistent.
Error in net
[net,info] = trainNetwork(ds,lgraph,options);
Caused by:
Error using cat
Dimensions of arrays being concatenated are not consistent
The function
analyzeNetwork(lgraph)
shows no warnings or errors.
Did anyone experience the same issue and could tackle the reason for the issue?

采纳的回答

Srivardhan Gadila
Srivardhan Gadila 2021-4-14
As per my knowledge, when using datastores and batchSize greater than 1 all the training samples should be of same size. The trainNetwork function combines multiple training samples of batchSize together and gives it to the network. If the those samples are not having the same size then you will be getting the above mentioned error.
Try checking if all the trianing samples are of the same size by using read on the datastore.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by