Large gap between training and validation accuracy

17 views (last 30 days)
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.

Answers (0)

Categories

Find more on Deep Learning with Time Series and Sequence Data in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!