Getting error in training residual network on CIFAR100 data

3 次查看(过去 30 天)
Hi everyone. I followed example from https://www.mathworks.com/help/deeplearning/ug/train-residual-network-for-image-classification.html to train residual network on CIFAR100 dataset. But I keep getting this error:
Error using trainNetwork (line 184)
Invalid validation data. Labels must not contain undefined values.
Error in Residual_Network_cifar100 (line 154)
trainedNet = trainNetwork(augimdsTrain,lgraph,options);
When I check the content of YValidation, it contain list of categorical labels like this:
As you can see from the attached image, there is undefined categorical label, which I believe it caused the error, but I do not know how to fix it. Please anyone help me. Thanks in advance.

回答(1 个)

Jayanti
Jayanti 2025-4-4
Hi suzwani,
The error is due to presence of undefined values in the labels. Find undefined values in your data using “isundefined” function.
undefinedLabels = isundefined(YValidation);
“isundefined” function returns a logical array that indicates which elements are undefined values. You can remove any samples with undefined labels from the validation set using the logical array.
For more information refer to the below documentation link on “isundefined”:

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by