Transposing matrices of a Dataset

2 ビュー (過去 30 日間)
Gianmarco Plutino
Gianmarco Plutino 2020 年 7 月 2 日
コメント済み: Bjorn Gustavsson 2020 年 7 月 2 日
Hello! I'm new of the comunity.
I imported a dataset containing the mat files where each of them represents a 3D matrix (43x512x210).
i need to transpose each of these matrices into matrices 210x512x43. The name I associated with the dataset is "imds" and the code to import it is:
digitDatasetPath = fullfile('C:\Users\User\Desktop\DB_BCI\DB');
imds = imageDatastore(digitDatasetPath, ...
'IncludeSubfolders',true,'FileExtension', '.mat','LabelSource','foldernames');
the files mat in the dataset are 120:
would anyone be able to help me? Thank you!

回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2020 年 7 月 2 日
Take a look at the help and documentation of the matlab-function permute.
HTH
  5 件のコメント
Gianmarco Plutino
Gianmarco Plutino 2020 年 7 月 2 日
Hello my friend,
i tried this solution:
for i=1:120
imds.Files{i,1}=permute(imds.Files{i,1},[3 2 1]);
end
and the command is executed without errors, but when i try to train the net it gives me the following error:
>> net = trainNetwork(imdsTrain,layers,options);
Error using trainNetwork (line 154)
The training images are of size 43x512x210 but the input layer expects images of size 210x512x43.
Caused by:
Error using nnet.internal.cnn.util.NetworkDataValidator/assertCorrectDataSizeForInputLayer (line 262)
The training images are of size 43x512x210 but the input layer expects images of size 210x512x43.
which makes me understand that the transformation of the matrices has not been successful.
Bjorn Gustavsson
Bjorn Gustavsson 2020 年 7 月 2 日
Check with:
size(imds.Files{i,1})
before and after the permutation.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by