nischi / MMM-Face-Reco-DNN

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

camera 3 support #137

Closed jslits closed 9 months ago

jslits commented 10 months ago

Good morning, Just received and installed a camera (v3) to enable face reco. libcamera-hello -t0 will give me a feed but when I start MMM, it does not recognize the camera:

0|mm | [25.08.2023 11:48.14.107] [ERROR] Whoops! There was an uncaught exception... 0|mm | [25.08.2023 11:48.14.122] [ERROR] PythonShellError: mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM) 0|mm | mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1) 0|mm | Traceback (most recent call last): 0|mm | File "/usr/lib/python3/dist-packages/picamera/camera.py", line 456, in _init_camera 0|mm | self._camera = mo.MMALCamera() 0|mm | File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2279, in init 0|mm | super(MMALCamera, self).init() 0|mm | File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 631, in init 0|mm | mmal_check( 0|mm | File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check 0|mm | raise PiCameraMMALError(status, prefix) 0|mm | picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.ril.camera': Out of memory 0|mm | During handling of the above exception, another exception occurred: 0|mm | Traceback (most recent call last): 0|mm | File "/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 100, in 0|mm | vs = VideoStream(usePiCamera=True, rotation=args["rotateCamera"], resolution=resolution).start() 0|mm | File "/home/pi/.local/lib/python3.9/site-packages/imutils/video/videostream.py", line 17, in init 0|mm | self.stream = PiVideoStream(resolution=resolution, 0|mm | File "/home/pi/.local/lib/python3.9/site-packages/imutils/video/pivideostream.py", line 10, in init 0|mm | self.camera = PiCamera() 0|mm | File "/usr/lib/python3/dist-packages/picamera/camera.py", line 431, in init 0|mm | self._init_camera(camera_num, stereo_mode, stereo_decimate) 0|mm | File "/usr/lib/python3/dist-packages/picamera/camera.py", line 459, in _init_camera 0|mm | raise PiCameraError( 0|mm | picamera.exc.PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled. 0|mm | at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:303:21) 0|mm | at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:190:32) 0|mm | at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:182:13) 0|mm | at ChildProcess.emit (node:events:513:28) 0|mm | at ChildProcess._handle.onexit (node:internal/child_process:291:12) { 0|mm | executable: 'python3', 0|mm | options: null, 0|mm | script: 'modules/MMM-Face-Reco-DNN/tools/facerecognition.py', 0|mm | args: [ 0|mm | '--cascade=modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml', 0|mm | '--encodings=modules/MMM-Face-Reco-DNN/tools/encodings.pickle', 0|mm | '--usePiCamera=1', 0|mm | '--source=0', 0|mm | '--rotateCamera=0', 0|mm | '--method=dnn', 0|mm | '--detectionMethod=hog', 0|mm | '--interval=2000', 0|mm | '--output=0', 0|mm | '--extendDataset=False', 0|mm | '--dataset=modules/MMM-Face-Reco-DNN/dataset/', 0|mm | '--tolerance=0.6', 0|mm | '--brightness=0', 0|mm | '--contrast=0', 0|mm | '--resolution=1280,960', 0|mm | '--processWidth=500' 0|mm | ], 0|mm | exitCode: 1 0|mm | } 0|mm | [25.08.2023 11:48.14.123] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? 0|mm | [25.08.2023 11:48.14.123] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

is this related to the issue/update what is reported in #114 ?

Thanks

Jeroen

jslits commented 10 months ago

FYI, feels like I'm almost there, installed opencv-python 4.7.0.68, pip, dlib face_recognition, numpy and imutils are the most recent ones.

nischi commented 10 months ago

i'm currently working on a new version which is using only the opencv camera moduie, which should support most of the cameras out of the box. i'm currently testing it on my mirror and it looks like i can deploy this in the next few weeks.

this should solve the issue

goldyfruit commented 10 months ago

This is awesome @nischi thanks!! :muscle:

grssll commented 9 months ago

Any updates on when new module will be available for release or testing? Thanks

nischi commented 9 months ago

It's out now :) Version 2.0