MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-Facial-Recognition-Tools error

    Scheduled Pinned Locked Moved Troubleshooting
    2 Posts 1 Posters 2.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      acabrera2012
      last edited by

      Hello everyone,

      I have been trying for weeks to get the facial recognition to work with my magic mirror. I have searched this forum and google but I can’t quite seem to find an answer to my problem. Here is the error I get when I’m trying to test it:

      [‘Angel’]
      Using FACE_ALGORITM: 1
      Loading training data…
      Training data loaded!
      Cropping…
      Crop: [[ 30 30 31 …, 148 143 136]
      [ 30 32 32 …, 145 143 136]
      [ 32 32 31 …, 144 144 135]
      …,
      [238 206 164 …, 200 206 179]
      [240 227 184 …, 199 210 181]
      [240 240 206 …, 199 212 193]]
      OpenCV Error: Bad argument (This LBPH model is not computed yet. Did you call the train method?) in predict, file /home/pi/opencv_contrib-3.3.0/modules/face/src/lbph_faces.cpp, line 396
      Traceback (most recent call last):
      File “facerecognition.py”, line 83, in
      label, confidence = model.predict(crop)
      cv2.error: /home/pi/opencv_contrib-3.3.0/modules/face/src/lbph_faces.cpp:396: error: (-5) This LBPH model is not computed yet. Did you call the train method? in function predict

      I have trained the LBPH model multiple times using .jpg’s as well as using the camera on my own face. This is what I’m running:

      • Raspberry PI 3
      • Raspberry pi cam
      • OpenCV-3.3.0
      • Python 2.7 (I also have Python 3 installed)
      • Electron 1.7.9
      • Node 8.9.1
      • npm 5.6.0

      If anyone has any idea how I can better troubleshoot this error through logs or any other means, please let me know. I’m so close to being up and running but I can’t seem to make any real progress on this one. Thanks.

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        acabrera2012 @acabrera2012
        last edited by

        @acabrera2012 SOLVED!

        I changed “model.save(config.TRAINING_FILE)” to “model.write(config.TRAINING_FILE)” in train.py

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy