I found Mathematica can use OpenCV to improve face recognition in FindFaces: how to improve the results of the face recognition feature.

But I tried this way and the kernel crashed.

FindFaces[img,"Image","TrainingFile" ->"lbpcascade_animeface.xml"]

Then I found that even using the files in the distribution will still cause kernel shut down.

enter image description here

Notice that the number disappears, the code highlight disappears, the calculation does not continue, the kernel has stopped working at this time.

Can someone else reproduce this situation, is this a bug?

  • 2
    $\begingroup$ I observe the same behaviour ("11.3.0 for Linux x86 (64-bit) (March 7, 2018)") $\endgroup$ – mikado Sep 23 '18 at 11:33
  • $\begingroup$ Same on 11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018) $\endgroup$ – Rohit Namjoshi Sep 24 '18 at 1:49
  • 1
    $\begingroup$ This should be reported to Wolfram Support, please share then the case number so other people get a chance to follow up when new versions are released. $\endgroup$ – rhermans Oct 25 '18 at 10:20
  • 2
    $\begingroup$ @rhermans Re: [CASE:4169085] I was able to reproduce the crash, however TrainingFile is not documented and not supported. $\endgroup$ – GalAster Oct 25 '18 at 10:49
  • 2
    $\begingroup$ Seems undocumented functions cannot get support. $\endgroup$ – GalAster Oct 25 '18 at 10:49

I launch Mathematica from a bash shell under linux and get the following error message when the kernel crashes:

OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file /home/usr0/matthias/tmp/opencv/opencv-3.1.0/modules/core/src/persistence.cpp, line 4976
terminate called after throwing an instance of 'cv::Exception'
what():  /home/usr0/matthias/tmp/opencv/opencv-3.1.0/modules/core/src/persistence.cpp:4976: error: (-2) The node does not represent a user object (unknown type?) in function cvRead

I guess that you have triggered an error in OpenCV.

  • 1
    $\begingroup$ Nice find. Still, Mathematica should be resilient to errors in external calls. This should be reported to Wolfram Support. $\endgroup$ – rhermans Oct 25 '18 at 10:20

Fixed in Version 12.

enter image description here

animeface = FindFaces[#,
    "Method" -> "LocalBinaryPatterns",
    "TrainingFile" -> "lbpcascade_animeface.xml",
    AcceptanceThreshold -> 0.1,
    "ScaleDecreaseFraction" -> 1
HighlightImage[img, {"Boundary", Green, animeface[#]&}]


  • Method must be set
  • Image`HumanDump`FindFacesHiddenOptions
  • $\begingroup$ That's very interesting. Is there a repository somewhere for LBP xml files like the one you used? $\endgroup$ – Carl Lange Apr 18 at 7:20
  • $\begingroup$ @CarlLange, OpenCV maintained some. Or search lbpcascade in google or github. $\endgroup$ – GalAster Apr 18 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.