How can I resolve Error in trainNetwork function saying Predictors must be a cell array of sequences ?

3 次查看(过去 30 天)
Hello All,
I have a data set containing images where X (predictor) is 131 * 2000 * 40 * 2000 matrix and Y(response) is a 131*1 categorical array .
where 131 is the number of videos , 2000 is the number of image sequences inside each video , 40 is the height of a single image , 2000 is the width of a single image ,
where Y is the label for each one of the 131 videos.
I am using LSTM network for the training with a layer containing 'OutputMode','sequence' then another layer containing 'OutputMode','last'.I have 4 classes for the classification. The Sequence input layer has size of 2000 which is the max number of images in sequence inside a video.
I read the function description below: "trainedNet = trainNetwork(sequences,Y,layers,options) trains an LSTM or BiLSTM network for classification and regression problems. sequences is a cell array containing sequence or time series predictors and Y contains the responses. For classification problems, Y is a categorical vector or a cell array of categorical sequences. For regression problems, Y is a matrix of targets or a cell array of numeric sequences."
My Question:
How can I convert "X" which is 4-D Matrix in proper way to be a cell array containing sequence taking into consideration that I have sequence of images ie. sequence of matrices not arrays or convert "X" to time series predictors Giving examples using matlab code.
Also , For predictors in my case , Is it correct to have just a categorical array converted from string class using categorical() function or shall I need to convert it to cell array of categorical sequences? if yes , how can I do that with matlab code example?
finally , Is it correct in my net layers to have input size of layers with size 2000 and to have one LSTM output as 'sequence' then another one with output 'last'?
Thank you for support.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

标签

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by