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


  • hello everyone,
    First of all,thank you very much for face recognition on smart mirror @paviro
    but ı stuck somewhere
    ı did all the steps but ı’m using raspberry pi camera and magic mirror does not turn on when I start
    but in the capture and train part is running smoothly
    what should ı do
    I’m waiting for your help

  • I hope you are talking about capture part and train part in MMM-Facial-recognition-Tools. It works fine but in mmm-facial recognition folder there is a config .py file which created the problem throwing config=jsonl.oads(sys arg…) // I do not remmeber.
    I just figured out few hours ago.
    TRy this code


    coding: utf8

    “”"MMM-Facial-Recognition - MagicMirror Module
    Face Recognition script config
    The MIT License (MIT)

    Copyright © 2016 Paul-Vincent Roll (MIT License)
    Based on work by Tony DiCola (Copyright 2013) (MIT License)
    import inspect
    import os
    import json
    import sys
    import platform

    def to_node(type, message):
    print(json.dumps({type: message}))

    _platform = platform.uname()[4]
    path_to_file = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))

    Size (in pixels) to resize images for training and prediction.

    Don’t change this unless you also change the size of the training images.

    FACE_WIDTH = 92
    FACE_HEIGHT = 112

    Face detection cascade classifier configuration.

    You don’t need to modify this unless you know what you’re doing.


    HAAR_FACES = path_to_file + ‘/haarcascade_frontalface.xml’
    HAAR_MIN_SIZE = (30, 30)

    #CONFIG = json.loads(sys.argv[1]);

        "recognitionAlgorithm": 1,
        "lbphThreshold": 50,
        "fisherThreshold": 250,
        "eigenThreshold": 3000,
        "useUSBCam": False,
        "trainingFile": '/home/pi/MagicMirror/modules/MMM-Facial-Recognition/training.xml',
        "interval": 2,
        "logoutDelay": 15,
        "users": ['user1'],
        "defaultClass": "default",
        "everyoneClass": "everyone",
        "welcomeMessage": True


    def get(key):
    return CONFIG[key]

    def get_camera():
    to_node(“status”, “-” * 20)
    if get(“useUSBCam”) == False:
    #import picam
    from import VideoStream
    to_node(“status”, “PiCam Enabled…”)
    vs = VideoStream(usePiCamera=True,resolution=(640,480)).start()
    #cam = picam.OpenCVCapture()
    return vs
    raise Exception
    except Exception:
    import webcam
    to_node(“status”, “Webcam ausgewählt…”)
    return webcam.OpenCVCapture(device_id=0)
    to_node(“status”, “-” * 20)

    replace the code with above code.
    I was able to fix the error with this. Hope it helps!

  • @anandprabhat567 canu edit this and change the marks before and after to the backtic char (left of the 1 key), need three before and after

Log in to reply