nischi / MMM-Face-Reco-DNN

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

Bookworm Dependency Update #144

Closed kschlichter closed 7 months ago

kschlichter commented 8 months ago

I think the bookworm dependencies need opencv-python either in addition to, or instead of opencv-python-headless. In the Some additional steps for Bookworm and above to run it with an virtual environment section of the readme, changing pip install face-recognition numpy dlib picamera2 opencv-python-headless to pip install face-recognition numpy dlib picamera2 opencv-python-headless opencv-python resolved this error for me:

[06.11.2023 15:04.36.537] [LOG]   [MMM-Face-Reco-DNN] loading encodings + face detector...
[06.11.2023 15:04.36.603] [LOG]   [MMM-Face-Reco-DNN] starting video stream...
[06.11.2023 15:04.36.604] [LOG]   [MMM-Face-Reco-DNN] 3280,2464
[06.11.2023 15:04.36.604] [LOG]   [MMM-Face-Reco-DNN] 500
[06.11.2023 15:04.38.351] [ERROR] Whoops! There was an uncaught exception...
[06.11.2023 15:04.38.356] [ERROR] PythonShellError: [54:45:10.689025098] [23526]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+52-a858d20b
[54:45:10.736992410] [23574]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[54:45:10.738836305] [23574]  WARN RPI vc4.cpp:333 Mismatch between Unicam and CamHelper for embedded data usage!
[54:45:10.739775715] [23574]  INFO RPI vc4.cpp:387 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media3 and ISP device /dev/media
[54:45:10.745997704] [23526]  INFO Camera camera.cpp:1213 configuring streams: (0) 3280x2464-XRGB8888 (1) 3280x2464-SBGGR10_CSI2P
[54:45:10.746546343] [23574]  INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unic
Traceback (most recent call last):
  File "/home/kschlichter/MagicMirror/modules/MMM-Face-Reco-DNN/tools/recognition.py", line 183, in <module>
    key = cv2.waitKey(1) & 0xFF
          ^^^^^^^^^^^^^^
cv2.error: OpenCV(4.8.1) /io/opencv/modules/highgui/src/window.cpp:1338: error: (-2:Unspecified error) The function is not implemented. Rebuild the library w

    at PythonShell.parseError (/home/kschlichter/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:311:21)
    at terminateIfNeeded (/home/kschlichter/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:193:32)
    at ChildProcess.<anonymous> (/home/kschlichter/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:185:13)
    at ChildProcess.emit (node:events:513:28)
    at Process.onexit (node:internal/child_process:291:12) {
  executable: '/home/kschlichter/MagicMirror-venv/bin/python',
  options: null,
  script: 'modules/MMM-Face-Reco-DNN/tools/recognition.py',
  args: [
    '--cascade=modules/MMM-Face-Reco-DNN/model/haarcascade_frontalface_default.xml',
    '--encodings=modules/MMM-Face-Reco-DNN/model/encodings.pickle',
    '--rotateCamera=-1',
    '--method=dnn',
    '--detectionMethod=hog',
    '--interval=2000',
    '--output=0',
    '--outputmm=0',
    '--extendDataset=True',
    '--dataset=/home/kschlichter/MagicMirror/modules/MMM-Face-Reco-DNN/dataset',
    '--tolerance=0.6',
    '--brightness=0',
    '--contrast=0',
    '--resolution=3280,2464',
    '--processWidth=500'
  ],
  exitCode: 1
}
[06.11.2023 15:04.38.365] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[06.11.2023 15:04.38.365] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

I'm running a Pi 4B on bookworm. I can share any other information you need. I now have the module working with the new pip install command, and I want to say thank you for all of your work on this module. It's precisely what I was looking for, and it's working perfectly for me.

nischi commented 8 months ago

Hi @kschlichter Nice to hear that it is now working for you and it's exactly what you had looking for :)

Strange is that it was working for me with only the headless. Need to investigate that, but we need either or. Thanks for the information.