Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative out-of-bounds access in CTreeMaxSumSolver::dt1D #3

Closed
ashbash1987 opened this issue Apr 29, 2015 · 9 comments
Closed

Negative out-of-bounds access in CTreeMaxSumSolver::dt1D #3

ashbash1987 opened this issue Apr 29, 2015 · 9 comments

Comments

@ashbash1987
Copy link

Hi,

I've just been trying to integrate CLandmark into a face detection app, pretty much following the example code (with some additional code from OpenCV to be able to process data from an iPad camera input source), and unfortunately it all comes to a halt when running through CTreeMaxSumSolver::dt1D(...) while in the following loop:

while (s <= z[k])
    k--;
    s = ((src[q*step] - src[v[k]*step]) - b*(q - v[k]) + a*(square(q) - square(v[k]))) / (2*a*(q-v[k]));
}

The reason for the halt is because s has become -Infinity, causing k to become negative.

This is using code as of latest in master (315c1e4).

@uricamic
Copy link
Owner

Hi,

could you please provide me the model, which you are using? Because I haven't encountered any problems using many different models yet.
However, I admit, that there are no fail-safe mechanisms in some parts of the code. In this case, I think it depends on the method chosen for learning the model, which has to enforce some conditions on the weight vector.

@ashbash1987
Copy link
Author

Thanks for the quick response back. I'm using the provided flandmark_model.xml file in the data folder.

@uricamic
Copy link
Owner

I see, that should be the problem. I am still polishing some parts of the code to publish and I forgot to mention that this model is not suitable for usage with distance transform. It is some old version which replaces the previous library - flandmark.

I will try to upload more models soon. Sorry for the inconvenience.

@ashbash1987
Copy link
Author

Ok, thanks for letting me know. I've just swapped to using the 8Lfrontal_SPLIT_1_init.xml model, and that looks to be working much much better!

@uricamic
Copy link
Owner

That one should work with the code, but I am afraid it won't detect anything, since it does not contain the learned weight vector w.

I will try to upload some of the learned models I have as soon as possible.

@lizhong323
Copy link

Hello uricamic,

I have encounter same problem with ashbash1987, when I replace the xml file to 8Lfrontal_SPLIT_1_init.xml, the program could run smoothly but the result is not accurate at all.

I pretty much follow the static_input example, you said you haven't encountered any problems using many different models yet. Could you give me some hint about how to detect the point accurately?

BTW, I have successfully detect 7 face feature points use old library flandmark, but looks the new library still only could only detect 7 face feature points, could you also give me some instruction about how to generate more points like your webpage post?

Thanks!

@uricamic
Copy link
Owner

Hi @lizhong323,

the 8Lfrontal_SPLIT_1_init.xml is an init file, which should be used for learning, i.e. it does not contain the learned weight vector. It cannot actually detect anything.

I have uploaded some models (e.g. the multi-view variant detecting 21, 19 or 13 landmarks depending on the yaw angle estimate) which can be used on the project webpage and I will upload some more soon.
It is also possible to use the enclosed 8 landmark model, which replaces the flandmark. However, so far there is just the version, which does not use speed ups for features computation and distance transform. So the initialization of Flandmark class and detection call looks a bit different. I will write about these differences on the webpage as well.

I am finalizing the MATLAB scripts for learning user-defined models when it is finished, I will write a tutorial on the webpage how to define new model and how to learn it from annotated data. It will be only for MATLAB for start, however after fixing the Python interface I would like to prepare the learning scripts for Python as well.

@lizhong323
Copy link

Hi uricamic,

Thank you for your swift reply!
Yes, I just try two zip file which contain the learned models, it could detect more landmarks, but the result seems not accurate. I just follow the C++ static_input example, do I follow the right example?

I use the face.jpg in data folder. And use this learned model:INDIVIDUAL_FRONTAL_AFLW_SPLIT_1.xml, could give me some hint to fix it?
20150620155143

@uricamic
Copy link
Owner

Hi @lizhong323,

could you please provide me more information about this issue? Which operating system are you using and what version of OpenCV to compile static_input.cpp? And have you done any modifications to the code?

I have just tried to call static_input example with model: INDIVIDUAL_FRONTAL_AFLW_SPLIT_1.xml as flandmark model on face.jpg and I get quite nice output:

flandmark - static input demo_012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants