Can't find the fault in my code.

1 view (last 30 days)
Marlene Patterer
Marlene Patterer on 13 Jun 2021
Commented: Marlene Patterer on 14 Jun 2021
Hi,
I am doing a hand recognition project and I have a problem and I can't solve it.
That is the code our network was trained with. If I train the network it tells me that it has a accuracy of 99% percent but if I'm using the code below it dosen't recognize any hand gestures. It only shows me "search" which it only should do if its a black picture. Does anyone have an idea? Thank you!
clc;
close all;
%webcam
c = webcam('HD Pro Webcam C920');
load Network;
%handbox settings
Handbox=[0 0 300 300];
while true
video = c.snapshot;
%Video RGB to gray
video_grey = rgb2gray(video);
videoAdj = imadjust(video_grey);
%Video RGB to BW
BW = imbinarize(videoAdj);
%BW inverte
BW_inverse = imcomplement(BW);
%Fill holes
BW_IH = imfill(BW_inverse, 'holes');
%change format [x x 1] --> [x x 3]
BW_3D = repmat(BW_IH,[1 1 3]);
%Create Handbox
Handbox_new = insertObjectAnnotation(video,'rectangle',Handbox,'Handgeste');
Handbox_crop = imcrop(BW_3D,Handbox);
video_new = imresize(Handbox_crop, [227 227]);
%classify
label=classify(Network,video_new);
%show
imshow(Handbox_new);
title(char(label));
drawnow;
end
  3 Comments
Marlene Patterer
Marlene Patterer on 14 Jun 2021
We took 500 images for each gesture, so for the numbers 0-5. Shell I send you one of each? Or what else may I give you so you have a better picture of it? Thank you!
Which settings would you therefore use? Thank you!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!