Error using trainNetwork: Operands to the || and && operators must be convertible to logical scalar values. Solution?

3 visualizzazioni (ultimi 30 giorni)
Hey folks,
When attempting to train a CNN I am presented with the following errors;
Error using trainNetwork (line 150)
Operands to the || and && operators must be convertible to logical scalar values.
Error in trainVGGnet (line 58)
trainedNet = trainNetwork(data, categorical(labels), layers, options);
Caused by:
Operands to the || and && operators must be convertible to logical scalar values.
I can confirm that this worked when training using the VGG16 pretrained network, however changing to the Inception V3 network gives these errors. Nothing has changed in the code, except for the inclusion of a different .prototxt file for Caffe, and changing the network to InceptionV3. Is there more to be done before changing to another pretrained network?
Here is the code that comes prior to the call to trainNetwork.
[trainindex, valindex, testindex] = dividerand(size(data, 4), 0.6, 0.2, 0.2);
val_data = data(:,:,:,valindex);
val_labels = labels(valindex);
test_data = data(:,:,:,testindex);
test_labels = labels(testindex);
data = data(:,:,:,trainindex);
labels = labels(trainindex);
options = trainingOptions('sgdm', 'MaxEpochs', 5, ...
'MiniBatchSize', 4, ...
'L2Regularization', 0.0005, ...
'ValidationData', {val_data, categorical(val_labels)}, ...
'ValidationFrequency', 250, ...
'InitialLearnRate', 0.01, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropFactor',0.1, ...
'LearnRateDropPeriod', 40, ...
'
Plots', 'training-progress');
Any help would be appreciated.

Risposte (0)

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by