Closed thetobyde closed 1 month ago
There are probably many ways to do it. But I solved It by using pm2 (also used for MM to autostart). And use a sh script started by pm2 containing the following line:
DISPLAY=:0 python3 ~/MagicMirror/modules/MMM-Face-Recognition-SMAI/MMM-Face-Recognition-SMAI.py
OK, make sense. Is this the .sh script?
If I look at it with "sudo nano run-face-rec.sh" I only can find this:
My thing is: I want to stop the Face-Rec for 20 secounds to be able to use a Selfie-Module. The cam is not able to do the 2 modules at the same time. Can you please help me bro?
Toby :)
@opdoffer as u can see in my post above there is an run-face-rec.sh file, but nothing is in there. The face-reg.py starts with my MM (PID 631) but now by the run-face.sh file (think so :o )
@EbenKouao who executes the command "python3 ~/MagicMirror/modules/MMM-Face-Recognition-SMAI/MMM-Face-Recognition-SMAI.py" ? thx
I solved it like this, dunno its this is the correct way but it works for me.
sudo nano ~/face-rec-autostart.sh
python3 ~/MagicMirror/modules/MMM-Face-Recognition-SMAI/MMM-Face-Recognition-SMAI.py
chmod +x ~/face-rec-autostart.sh
pm2 start ~/face-rec-autostart.sh
pm2 save
reboot and try
In case you want to use the camera you can stop the face-rec-autostart script with the following command:
pm2 stop face-rec-autostart
@opdoffer Thank you man! that would be great for me! But in my image the module was pre-installed and there is somewhere an ecisting thing that starts the .py file... and I dont know how I can stop it (only with "kill [PID] ) If I create a file like you, the .py script would be executed twice, doasnt it?
Ah so. I installed all of it manually. You used the image. Sorry my bad.
Yes if you create a file like I did then it will be executed twice and the second one will fail. Hopefully Ebenkouao will answer your question soon.
I will try the pre-installed version soon and if I found how it is configured I will let you know.
@opdoffer ok thank you, If you will find something with the pre-installed image let me know please <3
@EbenKouao I just want to deactivate the autostart of face-recognition-SMAI.py ... can u help me?
Hi @thetobyde @opdoffer, Thanks for trying it out.
In order to deactivate the autostart of face-recognition-SMAI.py (in LXTerminal at boot) Go to the Pi directory, Right-click, show hidden files, and open up .bashrc
sudo nano /home/pi/.bashrc
Remove the line at the bottom. This is what autostarts at boot:
sudo python3 /home/pi/dlib/build/face_recognition/examples/MMM-Face-Recognition-SMAI.py
That should avoid the camera module python script conflicts. Let me know how it goes. BTW, you can customize the python script face recognition, to include multiple profiles. As of now, it's limited to one.
Eben.
Thnx for the info Eben. And btw great work you’ve done! It is much fun.
Leaves me one question: when is the one user limitation resolved?
Hi @opdoffer, the 'one user limitation' has been resolved. You will observe that your face can be differentiated from others. You can now develop multiple profiles as you wish. Let me know how it goes and if you develop the module further, feel free to commit to the git!
Eben.
Hey again, short question: what does the Face-Rec-SMAI.py file start? Is it a cronjob?
Greetings Toby :)