Error using trainNetwork VALUESET must be the same class as DATA.

Hi. I'm trying to train a U-Net and the error that i'm getting is:
Error using trainNetwork
VALUESET must be the same class as DATA.
Caused by:
Error using ReadFcn @customReadFcn for file:
C:\Users\New User\OneDrive - ump.edu.my\Desktop\NewLabelOriginal\c0002s0002t01_lesionsmooth_115.mat
Error using categorical
VALUESET must be the same class as DATA.
Error in customReadFcn (line 7)
data = categorical(labels, [0, 1], {'Background', 'Tumor'});
I have attached the codes in this question.
Could someone lend a hand in troubleshooting this error?ubleshooting this error? Thank you for your time.

댓글 수: 3

We need c0002s0002t01_lesionsmooth_115.mat for testing -- as outside observers we cannot assume that c0002s0002t01_lesionsmooth_115.mat has the same class() of data as c0001s0004t01_lesionsmooth_1.mat does.
Thank you for your time. I have attached this file in this reply.
Actually I have 38912 files in the folder. c0002s0002t01_lesionsmooth_115.mat is one of the files. But i cant upload all due to the limitation of the system.
May I know how can I do to fix this?
Thank you for your time.

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

 채택된 답변

Walter Roberson
Walter Roberson 2023년 5월 16일
이동: Walter Roberson 2023년 5월 16일
load c0002s0002t01_lesionsmooth_115.mat
whos
Name Size Bytes Class Attributes ans 1x59 118 char cmdout 1x33 66 char imLesion 192x192 36972 categorical
The information in the file is already categorical, but your custom read function is trying to use
categorical(labels, [0, 1], {'Background', 'Tumor'})
which would be under the assumption that labels is numeric and that numeric 0 is to be associated with 'Background' and numeric 1 is to be associated with 'Tumor'
uc = unique(imLesion)
uc = categorical
0
double(uc)
ans = 1
Your existing imLesion array is categorical with category named 0 -- not category with value 0.
data = categorical(imLesion == '1', [0 1], {'Background', 'Tumor'});
data(1:3,1:3)
ans = 3×3 categorical array
Background Background Background Background Background Background Background Background Background

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Data Workflows에 대해 자세히 알아보기

질문:

2023년 5월 16일

댓글:

2023년 5월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by