Deep learning: how to labels data using a datastore?

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?

답변 (1개)

Ganapathi Subramanian R
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.

카테고리

도움말 센터File Exchange에서 AI for Signals에 대해 자세히 알아보기

질문:

2022년 8월 4일

답변:

2023년 10월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by