I'm trying to classify videos using LSTM but getting a different output, can anyone tell me what I'm doing wrong?
조회 수: 2 (최근 30일)
이전 댓글 표시
To train-:
if true
rootFolder = 'C:\New folder\Project\Action_Data\1\';
categories = {'jump','walk','run'};
imds = imageDatastore(fullfile(rootFolder, categories), 'LabelSource', 'foldernames');
tbl = countEachLabel(imds);
k=1;
for loop = 1:3
i = tbl{loop,2};
for lo = 1:i
img = readimage(imds,lo);
img = rgb2gray(img);
m{k} = img;
cate = tbl{loop,1};
a(k) = cate;
k = k+1;
end
end
m = m';
a = a';
inputSize = 144;
outputSize = 100;
outputMode = 'last';
numClasses = 3;
layers = [ ...
sequenceInputLayer(inputSize)
lstmLayer(outputSize,'OutputMode',outputMode)
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer];
if true
% code
end
maxEpochs = 50;
miniBatchSize = 50;
options = trainingOptions('sgdm', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize);
if true
% code
end
net = trainNetwork(m,a,layers,options);
end
And to test -:
if true
rootFolder = 'C:\New folder\Project\Action_Data\1\';
categories = {'jump'};
imds = imageDatastore(fullfile(rootFolder, categories), 'LabelSource', 'foldernames');
tbl = countEachLabel(imds);
for lo = 1:67
img = readimage(imds,lo);
img = rgb2gray(img);
n{lo} = img;
end
% n = n';
miniBatchSize = 19;
YPred = classify(net,n, ...
'MiniBatchSize',miniBatchSize);
%acc = sum(YPred == YTest)./numel(YTest);
end
But I'm not getting the right result(Expected result-Jump, Test result-Walk. can anyone tell me what I'm doing wrong? P.S I'm taking the individual frames as input.
댓글 수: 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!