【问题标题】:How to monitor deep learning training如何监控深度学习训练
【发布时间】:2020-04-13 16:20:17
【问题描述】:

我想在培训发生时对其进行监控,我应该如何更改我的代码?我找到了她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));

【问题讨论】:

    标签: matlab deep-learning


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2018-01-09
      • 2019-10-20
      • 2023-02-01
      • 2019-11-30
      • 2021-05-05
      • 2020-03-24
      • 2020-11-10
      • 2019-12-30
      • 2022-08-15
      相关资源
      最近更新 更多