skin detection by BP
Show older comments
Hi all Kindly i implement below code for RGB skin color detection , 3 input vectors RGB ,1 output vector ( 0 non - skin , 1 skin ) but the outcomes doesn't satisfy me, does NN not trained well or i have wrong , i really appreciate your help
% p=[119 88 82 204 10;79 59 73 150 10 ;53 55 68 103 20 ];
t=[1 1 1 1 0];
net=newff([0 255 ; 0 1],[5,1],{'logsig' 'tansig'});
net.numInputs = 3; % set number of inputs
net.inputs{1}.size = 1; % assign 2 to input size
net.inputs{2}.size = 1;
net.inputs{3}.size = 1;
net.trainParam.show=1;
net.trainParam.epochs=1000;
net.trainParam.goal=0.001;
net.trainParam.lr=0.1;
[net,tr]=train(net,p,t);
im=imread('./test3.jpg');
h=size(im,1);
w=size(im,2);
r=im(:,:,1);
g=im(:,:,1);
b=im(:,:,1);
r=double(reshape(r,1,h*w));
g=double(reshape(g,1,h*w));
b=double(reshape(b,1,h*w));
y=sim(net,[r;g;b]);
y=double(reshape(y,h,w));
imshow(y);
2 Comments
Walter Roberson
on 21 Oct 2013
Edited: Walter Roberson
on 21 Oct 2013
What is "BP" in your Title ?
Have you considered feeding it more examples of non skin tones? Skin tones do not fall into a nice RGB or HSV subsection, so to do a good job you need enough examples near the boundaries (on both sides) for it to be able to deduce where the boundaries are.
Yasir
on 21 Oct 2013
Accepted Answer
More Answers (1)
Image Analyst
on 21 Oct 2013
1 vote
Walter is right. The gamut for skin color does not fall nicely into a region in any colorspace that can be segmented nicely by thresholding. For all skin tones that you encounter, the gamut is banana or boomerang shaped. For any one individual you might be able to threshold and get their skin but it will work only for that one individual, not for any arbitrary individual of any race and any color of lighting and any level of exposure. For that you will need more sophisticated algorithms to carve out the skin gamut's true shape from the total possible gamut. But I don't know neural networks so I can say anything about what you are doing. It seems reasonable that if you were to train a NN on one image and then test it on the same image, it should get the skin. Greg Heath will probably respond to your NN question shortly.
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!