Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Hand Gesture Recognition Demo using AlexNet & MATLAB

 

%Code for training:

 

clc

clear all

close all

warning off

g=alexnet;

layers=g.Layers;

layers(23)=fullyConnectedLayer(7);

layers(25)=classificationLayer;

allImages=imageDatastore('Hand Dataset','IncludeSubfolders',true, 'LabelSource','foldernames');

opts=trainingOptions('sgdm','InitialLearnRate',0.001,'MaxEpochs',20,'MiniBatchSize',64);

myNet1=trainNetwork(allImages,layers,opts);

save myNet1;

 

 

%Code for testing:

 

clc;

close all;

clear all

warning off

c=webcam;

load myNet1;

x=0;

y=0;

height=200;

width=200;

bboxes=[x y height width];

while true

    e=c.snapshot;

    IFaces = insertObjectAnnotation(e,'rectangle',bboxes,'Processing Area');  

es=imcrop(e,bboxes);

    es=imresize(es,[227 227]);

    label=classify(myNet1,es);

    imshow(IFaces);

    title(char(label));

    drawnow;

end

 


Join us on Telegram: https://t.me/matlabcastor

No comments

Popular Posts

Followers