nischi / MMM-Face-Reco-DNN

Face recognition with opencv and deep neural network
MIT License
91 stars 46 forks source link

Python Type Checking and the face comparison script #56

Closed KSumwalt closed 4 years ago

KSumwalt commented 4 years ago

I have an error happening when a face is detected. I made a post in the MM2 forum, and the only response I have so far is:

@KSumwalt it seems that python has added type checking, which it wasn’t using before.

there was another python related type checking problem a few days ago…

looks like the node_helper has launched the python script to compare the face files, and run into a problem checking the parms passed to it.

I have loaded the MMM-Face-Reco-DNN and even used the i_face_recognition.py from https://www.pyimagesearch.com/2018/06/25/raspberry-pi-face-recognition/ with the encodings file generated from the MMM-Face-Reco-DNN instructions and had that .py file recognize faces. So I backed everything out of my config file except the default MMM-Face-Reco-DNN settings from the instructions and when I manually start MM2 everything looks fine. I am running on a Raspberry Pi 4. I did install a different facial recognition module, but it was not in the config file and decided not to use it when I saw it only recognized 1 person. When I step in front of the camera, this comes up in the terminal where I manually started MM2:

[2020-08-09 00:59:28.399] [ERROR] Whoops! There was an uncaught exception... [2020-08-09 00:59:28.400] [ERROR] PythonShellError: TypeError: ' (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:121:13) at ChildProcess.emit (events.js:200:13) at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) ----- Python Traceback ----- File "modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 143, in if minDistance < args["tolerance"]: { traceback: 'Traceback (most recent call last):\n File ' + '"modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line ' + '143, in \n if minDistance < args["tolerance"]:\n' + "TypeError: '<' not supported between instances of " + "'numpy.ndarray' and 'str'\n", executable: 'python3', options: null, script: 'modules/MMM-Face-Reco-DNN/tools/facerecognition.py', args: [ '--cascade=modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml', '--encodings=modules/MMM-Face-Reco-DNN/tools/encodings.pickle', '--usePiCamera=1', '--source=0', '--rotateCamera=0', '--method=dnn', '--detectionMethod=hog', '--interval=2000', '--output=0', '--extendDataset=False', '--dataset=modules/MMM-Face-Reco-DNN/dataset/', '--tolerance=0.6' ], exitCode: 1 } [2020-08-09 00:59:28.409] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? [2020-08-09 00:59:28.409] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

There is a little more information at the linked forum post, include the config file if you need it. Is there any assistance you can provide?

Kindest Regards, Karl Sumwalt

x3mEr commented 4 years ago

@KSumwalt , I've replied to your post. The module was upgraded right after your question and now there should not be "TypeError".

KSumwalt commented 4 years ago

The upgrade is no longer showing any errors. Thank you!