我正在尝试在Matlab中使用深层神经网络。但是,我得到一个错误:使用trainNetwork时出错(第165行)X和Y中的观察数不同。
以下是我当前的实现方式:
size(XX) % ans = 120000 36
size(YY) % ans = 120000 24
%% Train a Deep Neural Network
layers = [
imageInputLayer([1 36]); % Input is an "Image" 1x36 floating point vector
fullyConnectedLayer(200);
reluLayer();
fullyConnectedLayer(100);
reluLayer();
fullyConnectedLayer(50);
reluLayer();
fullyConnectedLayer(24);
regressionLayer();
];
if ~exist(checkpoint_directory_name,'dir')
mkdir(checkpoint_directory_name)
end
options = trainingOptions('sgdm', ...
'MaxEpochs', num_epochs, ...
'InitialLearnRate', 0.0001, ...
'CheckpointPath', checkpoint_directory_name, ...
'MiniBatchSize', batch_size ...
);
t = tic;
[net, info] = trainNetwork(XX, YY, layers, options);
fprintf('Trained in in %.02f seconds\n', toc(t));
我该怎么办才能解决此错误?
答案 0 :(得分:0)
我还不是深度学习工具箱的专家,但是,我的感觉是尺寸应该是:
size(XX) % answer = 36 120000;
size(YY) % answer = 24 120000;
有帮助吗?