Large gap between training and validation accuracy
4 次查看(过去 30 天)
显示 更早的评论
I am working on gesture video classification. I have gone through the MATLAB tutorial https://in.mathworks.com/help/deeplearning/ug/classify-videos-using-deep-learning.html. Using this I tried the similar way on the dataset I am using. The piece of code is
numFeatures = (size(TC{1},1));
numClasses = numel(categories(Trainlbl1));
layers = [
sequenceInputLayer(numFeatures,'Name','sequence')
bilstmLayer(128,'OutputMode','last','Name','bilstm')
dropoutLayer(0.2,'Name','drop')
fullyConnectedLayer(numClasses,'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classification')];
miniBatchSize = 32;
numObservations = numel(TC);
numIterationsPerEpoch = floor(numObservations / miniBatchSize);
options = trainingOptions('adam', ...
'MiniBatchSize',miniBatchSize, ...
'InitialLearnRate',0.0001, ...
'L2Regularization', 1.0000e-04, ...
'GradientThreshold',2, ...
'Shuffle','never', ...
'ValidationData',{VC,Validlbl1'}, ...
'ValidationFrequency',numIterationsPerEpoch, ...
'Plots','training-progress', ...
'Verbose',false);
lt=Trainlbl1(1:35516)';
[netLSTM,info] = trainNetwork(TC,lt,layers,options);
YPred = classify(netLSTM,VC,'MiniBatchSize',miniBatchSize);
YValidation = Validlbl1';
accuracy = mean(YPred == YValidation);
where TC is the cell containing the training sequences of size 35516-by-1. Each cell is of size 1024-by-32. Trainlbl1 is the labels of training dataset and VC is the cell containing the training sequences of size 5784-by-1 and each cell is of size 1024-by-32. After running the code I am not getting accuracy more than 10%. I am not getting where the problem lies. Also, I am not getting how to tune the hyparameters. I am attaching here the plot of training progress. There is a large gap between training accuracy and validation accuracy. How to reduce that gap or how to avoid that overfitting?
In case of any query, feel free to comment.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/724794/image.png)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!