Opencv_contrib: FaceMarkLBF not parsing userData to custom faceDetection function

Created on 16 Apr 2018  Â·  6Comments  Â·  Source: opencv/opencv_contrib

System information (version)
  • OpenCV => 3.4.1
  • Operating System / Platform => Ubuntu 16.04
  • Compiler => GCC
Detailed description

When training a cv::face::FacemarkLBF model, it is necessary to set a face detector. This is done by using the function bool FacemarkLBFImpl::setFaceDetector(bool(*f)(InputArray , OutputArray, void * extra_params ), void* userData). However, when new data is added using bool addTrainingSample(InputArray image, InputArray landmarks), the provided userData is not parsed to the provided function. I believe this is because of line 464 in the facemarkLBF.cpp file:
faceDetector(img, rects,0);

It clearly parses 0 instead of faceDetectorData.

Steps to reproduce

This can easily be reproduced by setting a custom face detector for the cv::face::FacemarkLBF class and attempting to use it with data parsed from the userData structure.

Most helpful comment

@berak

Error :
[560.64124, 345.45935; 600.91852, 360.5239; 754.4599, 350.24768; 792.64264, 339.04495; 678.92871, 485.25858; 626.54718, 584.4895; 709.2489, 587.44189; 627.09473, 617.69855; 728.48846, 599.61444] Training started. Segmentation fault (core dumped)

The points printed are the facial_points loaded from loadFacePoints() function.
The dataset is Helen and it's 9 point landmarks.

Had printed the statement just before facemark->training() function call, to analyze the point where it stops.
Not sure what's wrong.

All 6 comments

Thanks for the quick fix @berak

hmm, merged pr should have closed this issue, but somehow didn't

@alalek I'm getting somehow the same error.
Segmentation fault comes on training the data using FacemarkLBF given code, and it most probably is not loading the samples for training.

Is there any way I can debug it?

OpenCV Version: 4.0.0-pre
code: https://github.com/opencv/opencv_contrib/blob/master/modules/face/src/facemarkLBF.cpp
Error while executing : facemark->training()
System : Elementary OS
Compiler : g++

@krshrimali , please be more exact.

I'm getting somehow the same error.

which is, exactly ?

it most probably is not loading the samples for training.

that's a different story. issue above was about the cascade classifier instance not being passed correctly

@berak

Error :
[560.64124, 345.45935; 600.91852, 360.5239; 754.4599, 350.24768; 792.64264, 339.04495; 678.92871, 485.25858; 626.54718, 584.4895; 709.2489, 587.44189; 627.09473, 617.69855; 728.48846, 599.61444] Training started. Segmentation fault (core dumped)

The points printed are the facial_points loaded from loadFacePoints() function.
The dataset is Helen and it's 9 point landmarks.

Had printed the statement just before facemark->training() function call, to analyze the point where it stops.
Not sure what's wrong.

Was this page helpful?
0 / 5 - 0 ratings