Read the statement by Michael Teeuw here.
MMM-Facial-Recognition won't work
-
Firstly I really appreciate you for making this nice module!
MMM-Facial-Recognition-Tools-master works perfectly and I get training.xml file ! also i placed it at the right place.
However, MMM-Facial-Recognition module doesn’t work…
everytime I trypython facerecognition.py
it says 3 there r errors like below.pi@raspberrypi:~/MagicMirror/modules/MMM-Facial-Recognition/facerecognition $ python facerecognition.py Traceback (most recent call last): File "facerecognition.py", line 21, in import face File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition/facerecognition/face.py", line 10, in import config File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition/facerecognition/config.py", line 38, in CONFIG = json.loads(sys.argv[1]); IndexError: list index out of range
I dont get this part -> CONFIG = json.loads(sys.argv[1]);
and why it cant import face, config.?
Below is my config.py in facerecognition dir…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]); def get(key): return CONFIG[key] def get_camera(): to_node("status", "-" * 20) try: if get("useUSBCam") == False: import picam to_node("status", "PiCam ausgewählt...") cam = picam.OpenCVCapture() cam.start() return cam else: raise Exception except Exception: import webcam to_node("status", "Webcam ausgewählt...") return webcam.OpenCVCapture(device_id=0) to_node("status", "-" * 20)
Thanks for reading this and your help !!
-
@angie2601 It expects the config file as an argument on the command line. Are you supposed to call the script manually? The module should call the python script with the appropriate parameters.
-
@Jopyth tnx!! I manged to fix it! Thanks alot :-) but I want it to be working face recognition regardless of typing ‘npm start’ everytime. Do you have some ideas??