nischi / MMM-Face-Reco-DNN

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

Not able to start up #113

Closed chienhao10 closed 2 years ago

chienhao10 commented 2 years ago

Device Info Raspberry Pi 4B+ (running Buster) Camera: CSI Pi Cam

My steps:

  1. Followed https://github.com/cyysky/OpenCV-4.1.2-for-Raspbian installed without issue
  2. pip3 install dlib
  3. pip3 install face_recognition
  4. pip3 install imutils
  5. pip3 install numpy
  6. cd ~/MagicMirror/modules/ git clone https://github.com/nischi/MMM-Face-Reco-DNN.git cd MMM-Face-Reco-DNN npm install
  7. Took 24 photos with iPhone XS Max and put them under MagicMirror\modules\MMM-Face-Reco-DNN\dataset\ch\
  8. Used python3 encode.py -i ../dataset/ -e encodings.pickle -d hog (seems cnn will get out of memory issue due to large photo)
  9. Edited config.js, and did a full copy from your guide
  10. git clone https://github.com/nischi/MMM-MotionControl.git in the module folder
  11. Copied config for MotionControl guide, and made useMMMFaceRecoDNN: true,
  12. Checked pi cam (CSI) is working
  13. npm start got me "ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times!" to 3 times

What I did after:

I had this

Dependency | Versions -- | -- OpenCV | 4.5.0 dlib | 19.23.11 face_recognition | 1.3.0 imutils | 0.5.4

Then I installed 'pip3 install opencv-python==4.4.0.46' still got me same error.

### Config.js as below / MagicMirror² Config Sample

/ DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") {module.exports = config;}

### Log as below:

magicmirror@2.19.0 start DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js

[13.05.2022 18:44.14.650] [LOG] Starting MagicMirror: v2.19.0 [13.05.2022 18:44.14.658] [LOG] Loading config ... [13.05.2022 18:44.14.665] [LOG] Loading module helpers ... [13.05.2022 18:44.14.670] [LOG] No helper found for module: alert. [13.05.2022 18:44.14.687] [LOG] Initializing new module helper ... [13.05.2022 18:44.14.689] [LOG] Module helper loaded: updatenotification [13.05.2022 18:44.14.690] [LOG] No helper found for module: clock. [13.05.2022 18:44.14.876] [LOG] Initializing new module helper ... [13.05.2022 18:44.14.877] [LOG] Module helper loaded: calendar [13.05.2022 18:44.14.879] [LOG] No helper found for module: compliments. [13.05.2022 18:44.14.880] [LOG] No helper found for module: weather. [13.05.2022 18:44.14.905] [LOG] Initializing new module helper ... [13.05.2022 18:44.14.906] [LOG] Module helper loaded: newsfeed [13.05.2022 18:44.15.228] [LOG] Initializing new module helper ... [13.05.2022 18:44.15.229] [LOG] Module helper loaded: MMM-DynamicWeather [13.05.2022 18:44.15.236] [LOG] Initializing new module helper ... [13.05.2022 18:44.15.237] [LOG] Module helper loaded: MMM-Face-Reco-DNN [13.05.2022 18:44.15.238] [LOG] No helper found for module: MMM-MotionControl. [13.05.2022 18:44.15.238] [LOG] All module helpers loaded. [13.05.2022 18:44.15.341] [LOG] Starting server on port 8080 ... [13.05.2022 18:44.15.359] [LOG] Server started ... [13.05.2022 18:44.15.360] [LOG] Connecting socket for: updatenotification [13.05.2022 18:44.15.361] [LOG] Starting module helper: updatenotification [13.05.2022 18:44.15.361] [LOG] Connecting socket for: calendar [13.05.2022 18:44.15.362] [LOG] Starting node helper for: calendar [13.05.2022 18:44.15.363] [LOG] Connecting socket for: newsfeed [13.05.2022 18:44.15.363] [LOG] Starting node helper for: newsfeed [13.05.2022 18:44.15.364] [LOG] Connecting socket for: MMM-DynamicWeather [13.05.2022 18:44.15.365] [LOG] Connecting socket for: MMM-Face-Reco-DNN [13.05.2022 18:44.15.365] [LOG] Starting module helper: MMM-Face-Reco-DNN [13.05.2022 18:44.15.366] [LOG] Sockets connected & modules started ... [13.05.2022 18:44.15.705] [LOG] Launching application. [13.05.2022 18:44.18.186] [LOG] Create new calendarfetcher for url: https://calendar.google.com/calendar/ical/zh-tw.taiwan%23holiday@group.v.calendar.google.com/public/basic.ics - Interval: 300000 [13.05.2022 18:44.18.264] [LOG] Create new newsfetcher for url: http://feeds.feedburner.com/ettoday/realtime?format=xml - Interval: 300000 [13.05.2022 18:44.18.278] [INFO] [MMM-DynamicWeather] Getting Holiday data [13.05.2022 18:44.18.291] [INFO] [MMM-DynamicWeather] Getting Weather API data [13.05.2022 18:44.18.340] [INFO] Checking git for module: MMM-DynamicWeather [13.05.2022 18:44.18.409] [INFO] Checking git for module: MMM-Face-Reco-DNN [13.05.2022 18:44.18.486] [INFO] Checking git for module: MMM-MotionControl [13.05.2022 18:44.18.674] [INFO] Checking git for module: default [13.05.2022 18:44.18.925] [INFO] Newsfeed-Fetcher: Broadcasting 50 items. [13.05.2022 18:44.19.306] [INFO] Calendar-Fetcher: Broadcasting 26 events. [13.05.2022 18:44.19.326] [INFO] [MMM-DynamicWeather] Received successful Weather API data [13.05.2022 18:44.19.586] [INFO] [MMM-DynamicWeather] Received successful Holiday data [4265:0513/184420.758194:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times! [13.05.2022 18:44.24.921] [LOG] [MMM-Face-Reco-DNN] loading encodings + face detector... [13.05.2022 18:44.24.993] [LOG] [MMM-Face-Reco-DNN] starting video stream... [13.05.2022 18:49.19.167] [INFO] Newsfeed-Fetcher: Broadcasting 50 items. [13.05.2022 18:49.19.935] [INFO] Calendar-Fetcher: Broadcasting 26 events. [13.05.2022 18:54.17.716] [INFO] [MMM-DynamicWeather] Getting Weather API data [13.05.2022 18:54.18.127] [INFO] [MMM-DynamicWeather] Received successful Weather API data [13.05.2022 18:54.19.393] [INFO] Newsfeed-Fetcher: Broadcasting 50 items. [13.05.2022 18:54.20.663] [INFO] Calendar-Fetcher: Broadcasting 26 events. [13.05.2022 18:56.08.567] [LOG] Shutting down server...

Side question is: where should i add USERS_LOGIN into? is it inside motioncontrol or the face-reco.

Thank you for the help

nischi commented 2 years ago

Hi @chienhao10

Can you test if open CV is correct installed?

python
>>> import cv2
>>> cv2.__version__
'4.0.0'
>>> exit()

But the error-message sounds like the chromium/electron is not installed properly. I remember that i needed to configure something for the browser in raspberry 4, but not sure anymore what.

The USERS_LOGIN should be catched in another Module than face-reco. If you write another module you can listen to this notification. MotionControl module uses GET_LOGGED_IN_USERS and LOGGED_IN_USERS to work.

chienhao10 commented 2 years ago

@nischi Hello, thx for your time. Yes, i've checked if CV was correctly installed. Firslty i got 4.5 version, from the tutorial provided. But then it wasn't working so I stight installed 4.4 from https://github.com/nischi/MMM-Face-Reco-DNN/issues/79

Indeed, I've asked the same from MM community discord and got the same answer. It seems like a chromium issue, which i have no idea how to fix that. Since i have not mess areound with any of them after installed PI (only installed MM). I've looked around and also tried re-install chromium but no luck. I have found the error message only appears when I alt-tab to another window. But if I don't alt-tab, MM just displaying black, the person from the MM disocrd said this is something about chromium overlay. I am currently trying to reinstall with PI OS Legacy with desktop on another SD card to see if this can be solved. Please do let me know if memory came back to you about the configure for the browser. (Could it be GPU acceleration thing?)

Thx again.

nischi commented 2 years ago

@chienhao10 Yeah i think i remember now.

I changed the startup script in the package.json of MagicMirror

Instead of "start": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js", i did "start": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron --no-sandbox js/electron.js",

I added the --no-sandbox

Did that help?

chienhao10 commented 2 years ago

@nischi Unfortunately, it didnt work, the error still appear. I also did a reinstall with the guide Able to import cv2 and result version:

cv2. version '4.5.0'

started MM with updatred package.json of MagicMirror root folder. Error still exist when i alt tab to another window, and the Face-Reco-DNN last LOG is "starting video steam..."

Thank you for the time, kindly close the issue if its not related to the module. It could be pi OS issue or pi 4B. I might need try purchase a pi4 or 3 then install with pi os legacy with desktop to try.

nischi commented 2 years ago

@chienhao10 Sorry to hear that it does not help. hope you will find an issue. i think it has nothing to do with the module. Would be awesome if you have a solution that you post it here. thank you.

Good luck to purchase a new one. I ordered it already in Januar and it does not look that i get one this year.