trainNetwork: Cell labels with file/signal data stores

조회 수: 3 (최근 30일)
Christopher McCausland
Christopher McCausland 2023년 1월 7일
댓글: Shivam Malviya 2023년 1월 13일
Hi,
I have a datastore which consists of ~1000 files.
Each file is c*2 cell array, where c represents a number of events of intrest in the recorded data. The first colum of the cell array is a 9*12001 double of 9 features and the second column is a 1*1 categorical label for these events. (I will attach some sample data). This format seems to be suggested in Datastores for Deep Learning - MATLAB & Simulink - MathWorks Switzerland.
However, when I attempt to use the data to train a network in this format I get the following error;
Error using trainNetwork (line 184)
Invalid training data. For image, sequence-to-label, and feature classification tasks, responses
must be categorical.
I am asuiming this is because of the 1*1 categorical for each cell; however this is what seems to be suggested in Datastores for Deep Learning - MATLAB & Simulink - MathWorks Switzerland.
How can I get this data to read into the trainNetwork() function with either a signaldatastore() or filedatastore()?
Kind regards,
Christopher
  댓글 수: 3
Christopher McCausland
Christopher McCausland 2023년 1월 12일
Hi Shivam,
I was able to solve the issue with a custom read function. If anyone reads this in the furture there were two issues;
  1. Using the regular @load function via a handle loads the c*2 cell format in as a struct. This should have been expected, based on the behavour of the regular load command; however as the deep learning toolbox is expecting a cell array I was expecting it to bring in my data as a cell array. Writting a custom load function to bring in the prepocessed data is a soloution.
  2. Number of categories, I have 36 labels, however not all are present in the data. The number of lables should match the total number of catigories avaliable in the categorical. Which in my case was 36. It's a good idea to remove any redundant categories too.
Kind Regards,
Christopher
Shivam Malviya
Shivam Malviya 2023년 1월 13일
Glad to know the issue is resolved!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Custom Training Loops에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by