首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何监控深度学习训练

如何监控深度学习训练
EN

Stack Overflow用户
提问于 2020-04-13 08:15:03
回答 1查看 131关注 0票数 0

我想在训练发生的时候监控它,我应该如何修改我的代码?我找到了一些解释,她的https://se.mathworks.com/help/deeplearning/ug/monitor-deep-learning-training-progress.html,但我不能应用它,谁能帮帮忙吗?

代码语言:javascript
复制
[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));
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-13 16:20:17

我认为只有使用trainNetwork函数(net = trainNetwork(XTrain,YTrain,layers,options))才能做到这一点,不幸的是,fitcecoc中没有提供此选项。因此,您可以将训练数据和网络层以及选项发送到trainNetwork,以便为您绘制训练进度。请注意,为了绘制进度图,您还应该在选项中指定'training- progress‘作为'Plots’值,如以下代码中的最后一行所示:

代码语言:javascript
复制
options = trainingOptions('sgdm', ...
    'MaxEpochs',8, ...
    'ValidationData',{XValidation,YValidation}, ...
    'ValidationFrequency',30, ...
    'Verbose',false, ...
    'Plots','training-progress');
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61179879

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档