MMM-Face-Reco-DNN - All new Face Recognition



  • @ChrizZz
    Yes i know this issue. i’m currently working on a bugfix. will tell you if i’m done.



  • I am turning on the monitor using a PIR sensor and it is instant. Keep in mind that it also depends on your monitor, some are slower to respond - this is my second monitor, the first one was very slow to respond to any HDMI related commands.



  • I have a new strange error and I think it’s just if I restart mm with “pm2 restart mm”. If I reboot my pi, everything is fine.

    SyntaxError: Unexpected token m in JSON at position 0
        at JSON.parse (:null:null)
        at PythonShell.asJson (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:375:21)
        at /home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:326:42
        at Array.forEach (:null:null)
        at PythonShell.receiveInternal (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:322:15)
        at PythonShell.receiveStderr (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:306:21)
        at Socket. (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:109:22)
        at Socket.emit (events.js:182:13)
        at addChunk (_stream_readable.js:279:12)
        at readableAddChunk (_stream_readable.js:260:13)
        at Socket.Readable.push (_stream_readable.js:219:10)
        at Pipe.onread (net.js:636:20)
    
    SyntaxError: Unexpected token T in JSON at position 0
        at JSON.parse (:null:null)
        at PythonShell.asJson (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:375:21)
        at /home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:326:42
        at Array.forEach (:null:null)
        at PythonShell.receiveInternal (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:322:15)
        at PythonShell.receiveStderr (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:306:21)
        at Socket. (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:109:22)
        at Socket.emit (events.js:182:13)
        at addChunk (_stream_readable.js:279:12)
        at readableAddChunk (_stream_readable.js:260:13)
        at Socket.Readable.push (_stream_readable.js:219:10)
        at Pipe.onread (net.js:636:20)
    
    { Error: 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))0x631b2f0 (ENOSPC)
    mmal: mmal_connection_enable: output port couldn't be enabled
    Traceback (most recent call last):
      File "modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 56, in 
        vs = VideoStream(usePiCamera=True).start()
      File "/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/tools/stream.py", line 18, in __init__
        framerate=framerate)
      File "/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/tools/picam.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 513, in _init_preview
        self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
      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 2212, in enable
        prefix="Failed to enable connection")
      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
    
        at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:268:21)
        at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:139:32)
        at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:131:13)
        at ChildProcess.emit (events.js:182:13)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
    
      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',
         '--method=dnn',
         '--detectionMethod=hog',
         '--interval=2000',
         '--output=0' ],
      exitCode: 1 }
    


  • I get this too, when my PI can’t connect to the camera. I know that, because if i use
    Raspistill -o s.jpg
    I will get an error there too. A reboot seems to fix it though. I don’t know what makes it happen, but i suspect the cable.



  • @Blauenfeldt the python code returns an error, but the module does not expect it, and fails.