Closed M08IUS0NE closed 5 years ago
Hi @M08IUS0NE
Sure, i try to help where i can. My first question is which kind of response you are expect? Can you please post me your config.js file? Maybe i see something wrong there?
Have you checked once the logs? If you start your MagicMirror with pm2 you can easy use pm2 log mm
where „mm“ is your name for the MagicMirror Start Script. If you are not sure which you gave you can use pm2 list
Thanks for the fast response @nischi
My mirror loads up into a default configuration with minimal modules loaded. When I look at my camera, my expectation is that the system will recognize my face and load my specific profile with modules, module layout, etc...
For some reason, pm2 doesn't retain the startup configuration so I have to manually start the mirror each time. I have tried a couple of ideas for making the startup configuration stick but to no avail. However, I do run the mirror startup script in "Execute in terminal" and can see all modules load with no faults.
Below is my config file for the Facial Recognition Portion only. If you need more, let me know!
module: 'MMM-Face-Reco-DNN',
config: {
logoutDelay: 5000,
checkInterval: 2000,
defaultClass: 'default',
cascade: 'modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml',
encodings: 'modules/MMM-Face-Reco-DNN/tools/encodings.pickle',
everyoneClass: 'everyone',
usePiCamera: 1,
method: 'dnn',
detectionMethod: 'hog',
animationSpeed: 0,
pythonPath: null,
<-- I'm suspecting issue here, but this is how it is configured in example
welcomeMessage: true,
}
Thanks again for your help! Hoping it's something silly I did.
@M08IUS0NE
To be sure, you use a Raspberry Pi Camery on the Camera Port and not a USB Camera, right?
Maybe you are right on pythonPath
I added that once that you can set another configuration for python, like a Virtual Environment. So if you installed dependencies on virtual environment cv
you need to put there the path of your python in your virtual environment.
Maybe that help to get the correct path.
https://stackoverflow.com/questions/22003769/get-virtualenvs-bin-folder-path-from-script
Start your Virtual Environment with workon cv
and run the command. You need to put in the full path to python, so add python
to the end of the bin folder.
Correct, I am using the Raspberry Pi camera. I do believe the dependencies are installed on the virtual environment, I don't remember having success installing them outside the environment. I'll see if I have any progress with what you suggested and will report back.
if you decide to install cv outside of a virtual environment a look into the MM forum can help you: https://forum.magicmirror.builders/topic/10674/mmm-face-reco-dnn-all-new-face-recognition/21?page=1
I found the directory for my python and linked it. Still not having any response. I DID however notice this little bit of error code when I ran the MM executable in terminal. I may have missed it before, but I think it's happening now because I have the directory linked but linked incorrectly?
Whoops! There was an uncaught exception...
{ Error: spawn home/pi/.virtualenvs/cv/bin/python3.7.sh ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
at onErrorNT (internal/child_process.js:406:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn home/pi/.virtualenvs/cv/bin/python3.7.sh',
path: 'home/pi/.virtualenvs/cv/bin/python3.7.sh',
spawnargs:
[ 'modules/MMM-Face-Reco-DNN/tools/facerecognition.py',
'--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' ] }
MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
I tried a couple of extensions in case the pythonPath was asking for python specifically or just the folder it's located in. I've tried no extension, .sh, and .py, just to see if there is any changes in response. I also tried python
, python3
, and python3.7
at the end of the file path. Same error.
UPDATE: I added a /
at the beginning of the path and it got past that error but now I have a WHOLE slew of things coming up that look bad. I'll do a little more troubleshooting and see if I can identify and report back again.
@M08IUS0NE The path should be look like that pythonPath: '/Users/nischi/.virtualenvsexport/cv4py3/bin/python3'
(Thats on my mac). I have installed everything outside on my Raspberry Pi. Maybe that helps to get the right path. cv4py3
is the name of my virtual environment.
I believe the path is correct now (I have it as /home/pi/.virtualenvs/cv/bin/python
, but now I'm getting some other errors. I apologize in advance... this is a lot. This error code list is identical, regardless of which python I choose in my pythonPath: (python, python3, or python3.7) and these are the only installations on here.
Whoops! There was an uncaught exception...
SyntaxError: Unexpected token T in JSON at position 0
at JSON.parse (
For the second error, it's saying that it cannot find picamera module. While that module is installed, it is installed in the non-virtual environment directory /usr/lib/python3/dist-packages
So it seems I'm trying to find a module that doesn't exist in the virtual environment. Could I just copy the picamera module over to the virtual environment's directory?
As for the first error... I have no idea. unless it's related to the second error.
AHA! I got it. I ended up moving a copy of picamera from the non-virtual environment to the virtual environment repository in /home/pi/.virtualenvs/cv/lib/python3.7/site-packages
and it worked! And it works very well! Thank you again for your help. You helped guide me to success! Will close this now.
Hello!
So I recently installed everything as instructed and when I went to use
python encode.py
orpython3 encode.py
I was struck with errors about not being able to import cv2 or imutils. HOWEVER, when I did the following, I was able to use the encode.py script:source ~/.profile
workon cv
python3
import cv2
exit()
Then run
python3 encode.py
orpython encode.py
in the virtual environment and it worked (at present, I'm only using one face set to verify between my profile and the default profile, so I only encoded 10 photos).Now I have the module installed and configured as mentioned and am not getting any response from the module. The encodings.pickle file is present and MagicMirror is having no problem running, but I stare and stare at my camera and unfortunately get no response. Not sure what I am doing wrong at the moment, and unfortunately my linux coding skills/understanding are pretty basic. Any help/guidance as to what I may have done or still need to do would be greatly appreciated!