8

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.

URLDownload["https://raw.githubusercontent.com/nagadomi/lbpcascade_animeface/master/lbpcascade_animeface.xml","lbpcascade_animeface.xml"];
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?

rhermans
  • 36,518
  • 4
  • 57
  • 149
Aster
  • 3,836
  • 1
  • 18
  • 44

2 Answers2

4

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.

mikado
  • 16,741
  • 2
  • 20
  • 54
  • 1
    Nice find. Still, Mathematica should be resilient to errors in external calls. This should be reported to Wolfram Support. – rhermans Oct 25 '18 at 10:20
2

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[#]&}]

Remark:

  • Method must be set
  • Image`HumanDump`FindFacesHiddenOptions
Aster
  • 3,836
  • 1
  • 18
  • 44