如何监控深度学习培训



我想在训练发生时监视它,我应该如何为此更改代码?我找到了一些解释她https://se.mathworks.com/help/deeplearning/ug/monitor-deep-learning-training-progress.html但我无法申请,有人能帮忙吗?


[trainingSet,testSet] = splitEachLabel(imds,0.3,'randomize');
imageSize = net.Layers(1).InputSize; 
augmentedTrainingSet = augmentedImageDatastore(imageSize,...
trainingSet,'ColorPreprocessing','gray2rgb'); 
augmentedTestSet = augmentedImageDatastore(imageSize,...
testSet,'ColorPreprocessing','gray2rgb');
w1 = net.Layers(2).Weights;
w1 = mat2gray(w1); 
featureLayer = 'fc1000'; 
trainingFeatures = activations(net,augmentedTrainingSet,...
featureLayer,'MiniBatchSize',32,'OutputAs','columns');
trainingLables = trainingSet.Labels;
classifier=fitcecoc(trainingFeatures,...
trainingLables,'Learner','Linear','Coding','onevsall','ObservationsIn','columns');
testFeature = activations(net,augmentedTestSet,...
featureLayer,'MiniBatchSize',32,'OutputAs','columns');
predictLabels = predict(classifier, testFeature,'ObservationsIn','columns');
testLables = testSet.Labels; 
confMat = confusionmat(testLables , predictLabels);
confMat = bsxfun(@rdivide , confMat , sum(confMat,2));
mean(diag(confMat));

我认为这只能使用trainNetwork函数(net = trainNetwork(XTrain,YTrain,layers,options)(实现,不幸的是fitcedoc中没有提供此选项。因此,您可以将训练数据和网络层以及选项发送到trainNetwork,为您绘制训练进度图。请注意,为了绘制进度,您还应该将"培训进度"指定为选项中的"绘图"值,如以下代码中的最后一行所示,例如:

options = trainingOptions('sgdm', ...
'MaxEpochs',8, ...
'ValidationData',{XValidation,YValidation}, ...
'ValidationFrequency',30, ...
'Verbose',false, ...
'Plots','training-progress');

相关内容

  • 没有找到相关文章