MMM-Face-Reco-DNN icon indicating copy to clipboard operation
MMM-Face-Reco-DNN copied to clipboard

Facerecognition doesnt work

Open Mickan1994 opened this issue 2 years ago • 4 comments

Hey, I just got everything installed on a virtual environment but even if I set classes and everything, my Face won't be recognized. I just wanted to try the facerecognition.py directly but as soon as I run it I get the following error:

{"status": "loading encodings + face detector..."} {"status": "starting video stream..."} Traceback (most recent call last): File "/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 79, in if args["source"].isdigit(): AttributeError: 'int' object has no attribute 'isdigit'

I'm not able to find anything wrong, I just installed everything step for step but its not working.

Mickan1994 avatar Mar 31 '22 15:03 Mickan1994

Hi

Hmm strange, i installed it a week ago with the newest openCV version and it runs fine. How your config looks like?

nischi avatar Apr 03 '22 08:04 nischi

Hi, I don't know how and why, because I'm not that fit in python but with much searching I was able to get it working by changing the code

#if args["source"].isdigit():

to

if str(args["source"]): src = int(args["source"])

I don't know if this code snippet in facerecognition.py is wrong and need to be updated but this is the way I got it fixed...

Mickan1994 avatar Apr 04 '22 15:04 Mickan1994

I had the same error and @Mickan1994 's suggestion seemed to solve one issue but now I am getting further errors when trying to fun facerecognition.py to test things out.

{"status": "loading encodings + face detector..."} {"status": "starting video stream..."} mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x6a4a080 (ENOSPC) mmal: mmal_connection_enable: output port couldn't be enabled Traceback (most recent call last): File "/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 86, in <module> vs = VideoStream(usePiCamera=True, rotation=args["rotateCamera"]).start() File "/home/pi/.local/lib/python3.9/site-packages/imutils/video/videostream.py", line 17, in __init__ self.stream = PiVideoStream(resolution=resolution, File "/home/pi/.local/lib/python3.9/site-packages/imutils/video/pivideostream.py", line 10, in __init__ self.camera = PiCamera() File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in __init__ self._init_preview() File "/usr/lib/python3/dist-packages/picamera/camera.py", line 512, in _init_preview self._preview = PiNullSink( File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in __init__ self.renderer.inputs[0].connect(source).enable() File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2210, in enable mmal_check( File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check raise PiCameraMMALError(status, prefix) picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

iwant2fly avatar Aug 20 '22 02:08 iwant2fly

I will leave my last comment in case others come across the same thing. The error I received was due to having MagicMirror running at the same time when trying to run facerecognition.py. Stopping MagicMirror then running it worked as expected. I can confirm @Mickan1994 fix worked.

iwant2fly avatar Aug 20 '22 02:08 iwant2fly