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

MMM-Facial-Recognition-OCV3 -> tools.train.py 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:
    python tools.capture.py
    does work. I´m capturing images, they are saved and cropped and whatever.

    But when i try
    python train.tools.py
    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 "tools.train.py", line 14, in 
        ToolsTrain().train()
      File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/train.py", line 71, in train
        model = ToolsConfig.model()
      File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/config.py", line 99, in model
        return CommonConfig.model(cls.POSITIVE_THRESHOLD)
      File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/common/commonconfig.py", line 51, in model
        model = cv2.face.LBPHFaceRecognizer_create(threshold=thresh)
    AttributeError: 'module' object has no attribute 'face'
    
    

    and with python3 tools.train.py

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

    python2 tools.train.py
    gives the same result as
    python

    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 ^^.

    Thanks
    Nec



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


Log in to reply