Ask Your Question
2

FacemarkLBF Training fewer landmark points than 68

asked 2018-05-23 09:45:23 -0600

krshrimali gravatar image

updated 2018-05-23 09:51:34 -0600

Hi

I've been trying to train model using FacemarkLBF but with landmark points other than 29 and 68, and while training - it shows segmentation fault. Why does this restriction to the landmark points come into play? And is it sure that the error is because of the landmark points being other than 29, and 68? [confirming though that have verified every bit of code and dataset am using].

Also, what does #SWAP(shape, i, j) function does in the facemarkLBF.cpp file? (line 565), code link below

https://github.com/opencv/opencv_cont...

In the else loop, it has a warning that it does not work with the landmark points other than 29/68 : then why does it still go on and train and then give segmentation fault? Shouldn't the code break there only (or before after checking number of landmark points given as parameter/in the file)

Thanks!

edit retag flag offensive close merge delete

Comments

1

i have no idea about the restrictions, but given the pupils lists i doubt, that it will even work with 29 landmarks.

the SWAP function is used to augment the train data,to create another set of landmarksfrom an existing one, by swapping (symmetric) points.

if you have any pointlists with 29 (or other count), please make them (and the resp. images) available, so ppl here can try it !

berak gravatar imageberak ( 2018-05-24 00:01:40 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-05-25 02:13:36 -0600

berak gravatar image

updated 2018-05-25 02:35:10 -0600

as of today, it seems, only exactly 68 landmarks are supported.

there is a hardcoded pupils list which only covers this case. landmarks 69

(i can't even find a consistent descripton of the 29 point model !)

so, currently, using any other (smaller) number of landmarks will lead to a buffer overflow later here

please try to run this with a DEBUG build, from gdb or such, and you'll be able to reproduce it:

add a line here

params.n_landmarks=29;

then

facemark_demo_lbf cascade.xml lbf_img.txt lbf_pts29.txt lbf.model

(using 2 images & 2 pointslists from the attachment below, (renamed to .zip !!))

C:\fakepath\lbf_2img.tiff

edit flag offensive delete link more

Comments

Thanks @berak . I'll keep you updated with the progress.

krshrimali gravatar imagekrshrimali ( 2018-05-25 02:20:12 -0600 )edit
1

I don't know who downvoted the answer. Would really want to know the reason for downvoting.

Anyways, @berak this sounds good. I'll keep this post alive with progress.

krshrimali gravatar imagekrshrimali ( 2018-05-25 02:45:07 -0600 )edit
1

i think, you can train a 29 point model, but you'll have to clear() the pupils vectors in the lbf params, and fill them with appropriate indices, that fit your model. you'll also have to carefully check the part, where the points are swapped for data augmentation. main problem is still, that there seems to be no standard order or location for those 29 point models (i've seen 4 different ones on the net, so far)

berak gravatar imageberak ( 2018-05-26 07:28:17 -0600 )edit

@berak Whenever I try to train the model, why do I get error = -nan, or error = inf? Although the model performs well.

krshrimali gravatar imagekrshrimali ( 2018-05-28 21:34:39 -0600 )edit
1

where, exactly ? sqrt(-1) or 1/0 == NaN,

berak gravatar imageberak ( 2018-05-28 23:58:43 -0600 )edit

For every stage, there is an output while executing the code:

end of train global regression of 0th stage, costs 70.3207 s Train 0th stage Done with Error = -nan

Not sure why -nan is coming. Is it abnormal?

krshrimali gravatar imagekrshrimali ( 2018-05-29 03:03:31 -0600 )edit
1

nan is always abnormal. try to find out, where the err iscalculated, and look out for sqrt() and divisions

maybe pupils_distance is 0 in calcMeanError()

berak gravatar imageberak ( 2018-05-29 03:07:11 -0600 )edit

@berak yes, I tried to debug that. The problem is with some points (x1, y1) and (x2, y2) : from which it calculates pupil_distances, initially and some times, (x1, y1) and (x2, y2) are zero because of which it comes nan later.

krshrimali gravatar imagekrshrimali ( 2018-05-29 04:00:46 -0600 )edit
1

is that with 68 points, or your own pupils values ?

berak gravatar imageberak ( 2018-05-29 04:02:11 -0600 )edit

My own pupil values...

krshrimali gravatar imagekrshrimali ( 2018-05-29 04:02:59 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-05-23 09:45:23 -0600

Seen: 985 times

Last updated: May 25 '18