필터 지우기
필터 지우기

Hand gesture recognition using Deep learning

조회 수: 5 (최근 30일)
Shweta Saboo
Shweta Saboo 2021년 1월 13일
댓글: Shweta Saboo 2021년 2월 1일
I have extracted feature matrix for hand gestures. How can recognition be done using Deep learning with input as the feature matrix?

답변 (3개)

Raynier Suresh
Raynier Suresh 2021년 1월 18일
If you have a data set of numeric features, then you can train a deep learning network using a feature input layer. The below code is a simple example on how to use the feature input layer.
XTrain = [0 0;0 1;1 0;1 1]; % Input Features (Number of Observations x Number of Features)
YTrain = categorical({'Action1';'Action2';'Action2';'Action3'}); % Output Labels for each observation
numClasses = numel(categories(YTrain));
numFeatures = size(XTrain,2);
layers = [
featureInputLayer(numFeatures)
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer]; % Define the Layers
options = trainingOptions('sgdm');
net = trainNetwork(XTrain,YTrain,layers,options); % Train the network
classify(net,[0 1])
Refer the below link for more information:
  댓글 수: 3
Raynier Suresh
Raynier Suresh 2021년 1월 24일
Which MATLAB Release are you using ?
Shweta Saboo
Shweta Saboo 2021년 1월 24일
R2020a

댓글을 달려면 로그인하십시오.


Raynier Suresh
Raynier Suresh 2021년 1월 25일
For a deep learning network every input image is considered as a matrix of numbers, So in place of an image you can also feed your feature matrix and train the network only things is the feature matrix must to reshaped to a proper size so that the imageInputLayer accepts it. The below code will give you an example
XTrain = [0 0;0 1;1 0;1 1]; % Input Features (Number of Observations x Number of Features)
XTrain = reshape(XTrain',[1 2 1 4]); % Reshape the XTrain (1 x Number of Features x 1 x Number of Observation)
YTrain = categorical({'Action1';'Action2';'Action2';'Action3'}); % Output Labels for each observation
options = trainingOptions('sgdm','MaxEpochs',150);
inputSize = [1 2 1]; % set the input size as (1 x Number of Features x 1)
outputSize = numel(categories(YTrain)); % Number of output categories
layers = [imageInputLayer(inputSize);fullyConnectedLayer(outputSize);softmaxLayer;classificationLayer];
net = trainNetwork(XTrain,YTrain,layers,options); % Train the network
classify(net,[1 1])
  댓글 수: 2
Shweta Saboo
Shweta Saboo 2021년 1월 28일
Thanks for the response. I am having 100 observations with 20 features for each observation . When I am trying to run the above code, following error is occuring:
"Error using DAGNetwork/calculatePredict>predictBatch (line 151)
Incorrect input size. The input images must have a size of [1 20 1]."
Please suggest.
Raynier Suresh
Raynier Suresh 2021년 1월 28일
Check whether you have changed the input size of data you fed into the classify function. I have modified the same code for your input size.
XTrain = rand(100,20); % Input Features (Number of Observations x Number of Features)
XTrain = reshape(XTrain',[1 20 1 100]); % Reshape the XTrain (1 x Number of Features x 1 x Number of Observation)
YTrain = categorical(randi(10,[1,100])'); % Output Labels for each observation
options = trainingOptions('sgdm','MaxEpochs',150);
inputSize = [1 20 1]; % set the input size as (1 x Number of Features x 1)
outputSize = numel(categories(YTrain)); % Number of output categories
layers = [imageInputLayer(inputSize);fullyConnectedLayer(outputSize);softmaxLayer;classificationLayer];
net = trainNetwork(XTrain,YTrain,layers,options); % Train the network
classify(net,rand(1,20))

댓글을 달려면 로그인하십시오.


Shweta Saboo
Shweta Saboo 2021년 1월 29일
Thank you so much ,it worked.
  댓글 수: 1
Shweta Saboo
Shweta Saboo 2021년 2월 1일
After classification, I am trying to calculate the recognition accuracy , but in the above code test cases are not defined and hence recognition accuracy cannot be calculated.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by