Ask Your Question

Can you help me with nail detection please?

asked 2020-05-20 09:00:58 -0500

denissav gravatar image

Hello, i working on application,that recognization nails... I working only by your instructions... 1. Asking 60 peoples took photo of their fingers and filled my "training data" image description

  1. Launch opencv_annotation C:\opencv\build\x64\vc14\bin\opencv_annotation.exe --annotations=./file.txt --images=C:\OpenServer\OSPanel\domains\\training_data3

for "boxing" the desired image fragment

  1. Than i create vector file by command C:\opencv\build\x64\vc14\bin\opencv_createsamples -info file.txt -w 50 -h 50 -vec pos-samples.vec and got 216 samples of nail (in screenshot i am using command C:\opencv\build\x64\vc14\bin\opencv_createsamples -vec pos-samples.vec -w 50 -h 50) image description

  2. And than i launch tarining cascade by command C:\opencv\build\x64\vc14\bin\opencv_traincascade -data obj-classifier -vec pos-samples.vec -bg neg-filepaths.txt -precalcValBufSize 2048 -precalcIdxBufSize 2048 -numPos 59 -numNeg 2000 -numStages 2000 -minhitrate 0.999 -maxfalsealarm 0.5 -acceptanceRatioBreakValue 10e-5 -w 50 -h 50 -nonsym -baseFormatSave

as negative samples in neg-filepaths.txt i used sample for facecascade_data, that include in build of "opencv sources"

image description

But, during working of script, number of stages not become more 2, that talking about bad input data's? image description

I tried much possible variants, as a could: - maxDepth 5, - maxWeakCount 100, - numStages 3000, - i tried used photo of my apartment as negaive samples (less, than 3000 of course), - i trained cascade for 12 hours sometimes.

Even after training in all variants, my script working wrong. image description

It catch very messy anything else, but not nails... even only accidentally. image description image description

Can you help me please, what i'm doing wrong?! I am ready to thank for help financially, if it appropriate...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-05-21 02:45:09 -0500

berak gravatar image

though you did everything right here, it is doubtful, that you ever get a nicely working cascade out of it.

have another look at how haar features work:

now compare this to your nail input images -- where would it find those features there ? all you have is the gradients at the nail-skin border. there isn't anything in the center, im afraid, there is just not enough "texture" here for a cascade classifier.

also, 60 positive samples are not enough, you'd need like 20x more.

maybe youcan improve your detection (or even entirely replace it) by using a dnn based hand detector :

edit flag offensive delete link more


Thank you, i launched it even with through videocapture. If it possible, could you tell me please. There is method for "net" object ".format()" that working too slow, that video made 1 frame in 10 seconds... Could i replace this method by something else like Caffe API, that had problems, i tried to understand how method work and rewrite my own for improve speed of work, but it was failed, made scale minimum, it was failed too, model i couldn't change... Are there any libraries or desicions for fixed it, or i wasting time and i need to work only with that "0.1 fps"?

denissav gravatar imagedenissav ( 2020-05-22 08:06:25 -0500 )edit

1 frame in 10 seconds

unfortunately, quite realistic, imho ;(

berak gravatar imageberak ( 2020-05-22 08:11:25 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-05-20 09:00:58 -0500

Seen: 75 times

Last updated: May 21