系统:GTX-960,带NVidia驱动程序365.10,32 GB,Lenovo PC 2013,i7 2013,Windows 10教育版。 Matlab 2016a中的测试代码基于CNN手册here
% Load the training data into memory
[xTrainImages, tTrain] = digittrain_dataset;
rng('default'); % random number generator seed
hiddenSize1 = 100;
autoenc1 = trainAutoencoder(xTrainImages,hiddenSize1, ...
'MaxEpochs',400, ...
'L2WeightRegularization',0.004, ...
'SparsityRegularization',4, ...
'SparsityProportion',0.15, ...
'ScaleData', false);
feat1 = encode(autoenc1,xTrainImages);
%% Second set of features
hiddenSize2 = 50;
autoenc2 = trainAutoencoder(feat1,hiddenSize2, ...
'MaxEpochs',100, ...
'L2WeightRegularization',0.002, ...
'SparsityRegularization',4, ...
'SparsityProportion',0.1, ...
'ScaleData', false);
feat2 = encode(autoenc2,feat1);
softnet = trainSoftmaxLayer(feat2,tTrain,...
'MaxEpochs',400, ...
'useGPU', 'yes',...
'showResources', 'yes');
softnet.trainFcn = 'trainscg'; % to avoid warning with GPU
view(autoenc2) % The Error comes from here!
在会话结束时给出的输出;否则,它似乎正确优化,但显然没有GPU,因为 OpenHardwareMonitor 应用程序表明GPU未使用(GPU风扇0 RPM,GPU核心值0.0-16.0%(更改),最大68%(不更改)
使用trainSoftmaxLayer时出错> iParseInputArguments(第61行)' useGPU' 不是公认的参数。有关有效名称 - 值对的列表 参数,请参阅此函数的文档。
代码更改
autoenc1 = trainAutoencoder(xTrainImages,hiddenSize1, ...
'MaxEpochs',400, ...
'L2WeightRegularization',0.004, ...
'SparsityRegularization',4, ...
'SparsityProportion',0.15, ...
'useGPU', 'yes',...
'ScaleData', false);
autoenc2 = trainAutoencoder(feat1,hiddenSize2, ...
'MaxEpochs',100, ...
'L2WeightRegularization',0.002, ...
'SparsityRegularization',4, ...
'SparsityProportion',0.1, ...
'useGPU', 'yes',...
'ScaleData', false);
softnet = trainSoftmaxLayer(feat2,tTrain,...
'MaxEpochs',400, ...
'showResources', 'yes');
输出
Error using Autoencoder.parseInputArguments (line 477)
'UseGPU' must be a logical value.
Error in trainAutoencoder (line 103)
paramsStruct = Autoencoder.parseInputArguments(varargin{:});
Error in bnn_image (line 17)
autoenc1 = trainAutoencoder(xTrainImages,hiddenSize1, ...
如何确认GTX-960在Windows 10中与Matlab 2016a的通信效果如何?
答案 0 :(得分:1)
trainSoftmaxLayer函数不接受useGPU作为输入(help document on trainSoftmaxLayer),而trainAutoencoder函数与正常列车函数(help document on trainAutoencoder)一起(help document on train)。您可以使用这些功能中的任何一个来解决问题吗?如果没有,你绝对需要使用Softmax,那么你需要自己编写代码 - 这不容易。