MATLAB Answers

cui
0

Why is the training set and the verification set label order different when training a deep network?

Asked by cui
on 8 May 2019
When training my network, the training set and the verification set are from different data, but the tag categories are the same, that is, the order is inconsistent. Is this a problem?
TrainClasses and ValClasses ,the categories are the same, only the order is inconsistent( use isequal function is false), as shown below
labels.png
...
TrainClasses = categories(labelsTrain)
ValClasses = categories(labels_val)
options = trainingOptions(...
...
'ValidationData',{sequencesValidation,labels_val}, ...
...
);
net = trainNetwork(X,labelsTrain,layers,options);
...
and then train the network,get a error,
Incorrect use of trainNetwork (line 165)
Training and validation responses must have the same categories. To view the categories of the responses, use the categories function.
Error myCNN2 (line 135)
[netLSTM,info] = trainNetwork(sequencesTrain,labelsTrain,layers,options);
the reason:
    Incorrect use of trainNetwork>iAssertClassNamesAreTheSame (line 413)
    Training and validation responses must have the same categories. To view the categories of the responses, use the categories function.
Do you need to sort the category tags before you can train, which sounds illogical? so I add "reordercats" function in built-in "trainNetwork"function ,it works,is right?
add.png

  0 Comments

Sign in to comment.

Products


Release

R2019a

0 Answers