MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. anandprabhat567
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    A
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 1
    • Groups 0

    anandprabhat567

    @anandprabhat567

    0
    Reputation
    125
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    anandprabhat567 Unfollow Follow

    Latest posts made by anandprabhat567

    • RE: MMM-Facial-Recognition

      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

      #!/usr/bin/python

      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}))
      sys.stdout.flush()

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

      See: http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html

      HAAR_FACES = path_to_file + ‘/haarcascade_frontalface.xml’
      HAAR_SCALE_FACTOR = 1.3
      HAAR_MIN_NEIGHBORS = 4
      HAAR_MIN_SIZE = (30, 30)

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

          "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)
      try:
      if get(“useUSBCam”) == False:
      #import picam
      from imutils.video import VideoStream
      to_node(“status”, “PiCam Enabled…”)
      vs = VideoStream(usePiCamera=True,resolution=(640,480)).start()
      #cam = picam.OpenCVCapture()
      #cam.start()
      return vs
      else:
      raise Exception
      except Exception:
      import webcam
      to_node(“status”, “Webcam ausgewählt…”)
      return webcam.OpenCVCapture(device_id=0)
      to_node(“status”, “-” * 20)

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

      posted in Troubleshooting
      A
      anandprabhat567