Can't find the fault in my code.
1 次查看(过去 30 天)
显示 更早的评论
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!![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/652045/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/652045/image.jpeg)
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 个评论
Image Analyst
2021-6-14
You might not have trained the network very well. Unfortunately we can't really tell that from Network, even if you did attach it, since it's basically a black box. We'd need to see all of your hundreds of training images. How many hand gestures were there? How many images did you use for each gesture?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!