nischi / MMM-Face-Reco-DNN

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

Camera issues #74

Closed joshbrown35 closed 3 years ago

joshbrown35 commented 3 years ago

Hello! I'm trying to set up facial recognition on my raspberry pi 3 B+. I basically copied and pasted the config file from the readme. When I run Magic Mirror everything runs fine and the camera turns on and stays with the following being shown on the terminal

[2020-11-16 16:38:22.768] [LOG] [MMM-Face-Reco-DNN] loading encodings + face detector... [2020-11-16 16:38:22.927] [LOG] [MMM-Face-Reco-DNN] starting video stream...

Then ifl someone steps in front of it, it shuts off and i get the following

[2020-11-16 16:39:10.951] [ERROR] Whoops! There was an uncaught exception... [2020-11-16 16:39:10.954] [ERROR] PythonShellError: ValueError: min() arg is an empty sequence at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:246:21) at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:129:32) at ChildProcess. (/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 minDistance = min(distances) { traceback: 'Traceback (most recent call last):\n File ' + '"modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 143, ' + 'in \n minDistance = min(distances)\nValueError: min() ' + 'arg is an empty sequence\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=3000', '--output=0', '--extendDataset=False', '--dataset=modules/MMM-Face-Reco-DNN/dataset/', '--tolerance=0.6' ], exitCode: 1 }

I can't figure out for the life of me what is causing this.

joshbrown35 commented 3 years ago

After reading more of the facerecognition.py file I realized it had to do with not enough encodings. I think it didnt run right the first time I ran encodings.py, so I added some more pictures and re ran it and it fixed the error