MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

MMM-Facial-Recognition-OCV3 -> Problem

  • Hello guys,
    its my first post here. I am not that firm in Python but already had done some things in C. So lets say i´m a beginner in coding and a beginner in Raspberrys.

    I installed MM2 and some modules, which are working after some tweaking. But currently i´m having big problems with the Facial Recognition Module (OCV3).

    “Everything” installed, did it two times on two rasps and got to the same error:
    does work. I´m capturing images, they are saved and cropped and whatever.

    But when i try
    i get:

    Remember to set the name list environment variable FACE_USERS
    Reading training images...
    Assign label 1 to xxx
    Assign label 2 to xxc
    Read 43 positive images and 400 negative images.
    7 images from subject xxx
    36 images from subject xxc
    Training model with threshold 80
    Traceback (most recent call last):
      File "", line 14, in 
      File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/", line 71, in train
        model = ToolsConfig.model()
      File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/", line 99, in model
        return CommonConfig.model(cls.POSITIVE_THRESHOLD)
      File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/common/", line 51, in model
        model = cv2.face.LBPHFaceRecognizer_create(threshold=thresh)
    AttributeError: 'module' object has no attribute 'face'

    and with python3

    Traceback (most recent call last):
      File "", line 10, in 
        from import ToolsTrain
      File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/", line 17, in 
        import cv2
      File "/usr/local/lib/python3.5/dist-packages/cv2/", line 3, in 
        from .cv2 import *
    ImportError: cannot open shared object file: No such file or directory

    gives the same result as

    I am directly writing on the rasp, not connected by ssh or so.

    opencv, opencv_contrib are installed, pip is there.
    It looks like cv2 is not there … when i use python and then import cv2
    there is no error. But when i then ask for help(cv2.face) the error appears:
    AttributeError: module object has no attribute face

    I got Python 2 (ver 2.7.13) and Python 3 (ver 3.5.3), numpy (ver 1.12.1), OpenCV (ver 3.3.0)

    Maybe i did not install everything needed? But it worked till the train part. Maybe some links are missing or wrong?
    I hope you can bring up some ideas or at best a working solution ^^.


  • Im having the exact same error readings. Frustrating. Has anyone managed to tackle or solve this issue?

Log in to reply