Deep learning: how to labels data using a datastore?
11 次查看(过去 30 天)
显示 更早的评论
Hello,
I have some data (close to 500 *.mat files, size 3620x1, corresponding to measured signals) which are classified into two folders. Folder names represent the status of the data. I would like to perfom some deep learning on it: to do this, I tried to create a datastore using fileDatastore, but I don't know how to label all data with the folder name. Is it any possibility?
I know I can add 'LabelSource' using imageDatastore, but the Deep Network Designer did not work with such a datastore with *.mat files inside... Is anybody faced this issue?
0 个评论
回答(1 个)
Ganapathi Subramanian R
2023-10-4
Hi Arnaud,
I understand that you are working on Deep Learning project and have an issue in labelling data using a datastore. Please provide the ‘FileExtensions’ and ‘ReadFcn’ Name-Value pairs in the ‘imageDatastore’ function to specify that the files are ‘.mat’ files and provide a custom function that can extract the matrix from each MAT-file.
dataPath = fullfile('data');
imds = imageDatastore(dataPath, ...
'IncludeSubfolders',true,'LabelSource','foldernames','FileExtensions',{'.mat'},'ReadFcn',@my_read_fcn);
function res = my_read_fcn(f)
s = load(f);
res = s.NameOfMatrixVariable;
end
Please refer the below documentation for further information regarding ‘imageDatastore’ function.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!