Googlenet迁移学习中的Nan问题(验证丢失和小批丢失)

17ビュ(過去30日間)
我试图使用Googlenet在数据集(图像)上转移学习,有三个类作为输出。我使用相同的脚本,已经成功地使用ResNet50之前。由于两个网络共享相同的输入层(224 224 3),我认为使用谷歌网络在相同的数据集上进行另一个测试会很容易。无论是使用Deep Network Designer还是通过脚本编辑原始Googlenet(替换最后一层)都有助于避免同样的错误,即:
第一次迭代后,小批损失和验证损失都转移到NAN。
我想我错过了一些东西,因为这对我来说没有意义。
我附上了脚本和显示Nan的输出屏幕截图。
augmenter = imageDataAugmenter(...
“RandRotation”15 [0]);
Path = fullfile(“C: \”“大J”“我的经验”“培训”);
imd = imageDatastore(路径,“IncludeSubfolder”,真的,“LabelSource”“Foldernames”);
inputSize = (224 - 224);
洛桑国际管理发展学院。ReadFcn = @(loc)imresize(imread(loc),inputSize);
[TrainDataStore,ValDataStore] = splitEachLabel(imds,0.8,“随机”);
Traindatasource = augmentedImageSource([224 224],TrainDataStore,“DataAugmentation”、增压器);
% %
网= googlenet;
lgraph = layerGraph(net);
lgraph = removeLayers(lgraph, {“loss3-classifier”“概率”“输出”});
图(“单位”“归一化”“位置”,[0.1 0.1 0.8 0.8]);plot(lgraph);
newLayers = [
fullyConnectedLayer (3“名字”“fc-3”“WeightLearnRateFactor”, 20岁,“BiasLearnRateFactor”, 20)增加FC层的学习因子,加快学习速度
softmaxLayer (“名字”“softmax”
classificationLayer (“名字”“classoutput”));
lgraph = addLayers(lgraph,newLayers);
图(“单位”“归一化”“位置”,[0.1 0.1 0.8 0.8]);plot(lgraph);
lgraph = connectLayers(“pool5-drop_7x7_s1”“fc-3”);
图(“单位”“归一化”“位置”,[0.1 0.1 0.8 0.8]);plot(lgraph);
% %
选项= trainingOptions(“个”...
“ExecutionEnvironment”“图形”...
“InitialLearnRate”, 0.01,...
“L2Regularization”, 0.0001,...
“MaxEpochs”15岁的...
“MiniBatchSize”32岁的...
“动量”, 0.9,...
“洗牌”“一次”...
“详细”, 1...
“VerboseFrequency”, 50岁,...
“ValidationData”ValDataStore,...
“ValidationFrequency”, 50岁,...
“ValidationPatience”正,...
“阴谋”“训练进步”);
% %
net = trainNetwork(训练数据源,lgraph,选项);
% %
G_net_test =净;
保存(“G_net_test.mat”“G_net_test”);
error.jpg

採用された回答

凯撒
凯撒 2019 年 8 月 9 日
感谢Matlab支持团队,问题是学金宝app习率。一旦我把它从0.01改为0.001,它就像预期的那样通过了

その他の回答(0件)

カテゴリ

了解更多深度学习工具箱帮助中心而且文件交换

社区寻宝

在MATLAB Central中找到宝藏,并发现社区如何帮助您!

开始狩猎!

翻译的