Hi Tim,
Everything worked perfectly for me i just have a last question i have to explain all the command i have done for my project, but i don’t really know what they do can you help me please explain not in details but overall Please.
Hi Jorge,
Did you paste all that code directely or did you paste lines by lines. I had the same issues but i have paste lines by lines and it works, for some lines i did also type the line by myself. Retry and i will see if i can help you more (if doesn’t work of course )
Happy to give you the overview and the tools to go deeper if you need to for your project.
sudo = Super User Do. Any command with this at the prefix of the commands will be run with full permissions. Then apt install = a command-line utility for installing, updating, removing, and otherwise managing deb packages on Raspberry Pi OS. Everything following that statment is unique names that will install the desired package. You can google each of them to learn specific details on them.
Next is the cmake section.CMake is an open-source, cross-platform tool that uses compiler and platform independent configuration files to generate native build tool files specific to your compiler and platform. This is what we used to grow our Machine Learned Brain onto our Micro-SD card. Everything that starts with -D is utilised to determine the specific settings of our brain. The final Make command starts the process.
git clone is a Git command-line utility that is used to target an existing repository and create a clone, or copy of the target repository. Another method to get scripts/packages onto our Raspberry Pi system from the internet.
I have a question about the servo motor code. The code works perfectly but I would like the motor to spin every time it sees my face not just once. How do I do it ?
Hey mate,
A great speed run down on servo control with a Raspberry Pi can be found linked here (if I can say so myself). That should get you up to speed with the Python codes that you will need. It may be easier to create a seperate script that runs simultanously whenever a Face is seen by the System, but I’m also sure you can do it just by adding some lines to the current set up.
Kind regards,
Tim
Hey Tim
My code is running but it’s showing the same name for everyone. It’s supposed to show unknown for the person not present in dataset
Please help me
Great thread. Earlier, I came across this tutorial Smart Security System using Facial Recognition with Raspberry Pi 4 - The Engineering Projects
I was thinking about giving it a try. Now I can see this thread is even more helpful. Raspberry pi 4 is quite expensive here now. As soon as I manage sufficient budget for the setup, I wish to start and give updates of my work here. Thanks a lot.
May I know is it possible to create a GUI for this project? using the python code given. If yes, may I know what language can I use? I just think of creating a simple GUI that have 2 options. First button is to register new face and train it. When click the button, it will open up the headshots_picam.py and then train_model.py. Second button is for registered faces. When click the button, it will execute facial_req.py. Is it possible to do this?
Absolutely. I talked a little bit about GUI in my Python Workshop, I will link to it here. There are also many different ways to create GUI, Java is a very common language to do so. But if you are just starting off I’d recommend sticking with Python.
hi bro, I’m still a beginner, is there an additional way to record the results to a csv file? like if you have read the image of his face, it will immediately write a csv file?
sorry for my broken english
Very new here. I have a question about the set up. I’m trying to set up openCV with face recognition to combine this with hassio to get some automation going. However, I keep running into error when running python facial_req.py. Al the previous steps where completed with no problem.
First I got this error: [INFO] loading encodings + face detector…
[ WARN:0] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (2076) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Cannot identify device ‘/dev/video2’.
[ WARN:0] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (1053) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (616) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0] global /home/pi/opencv/modules/videoio/src/cap_v4l.cpp (890) open VIDEOIO(V4L2:/dev/video2): can’t open camera by index
Traceback (most recent call last):
File “facial_req.py”, line 38, in
frame = imutils.resize(frame, width=500)
File “/home/pi/.local/lib/python2.7/site-packages/imutils/convenience.py”, line 69, in resize
(h, w) = image.shape[:2]
AttributeError: ‘NoneType’ object has no attribute ‘shape’
But I solved it using an answer you gave in this forum: " Delete this line |vs = VideoStream(src=0).start() | and uncomment this line |vs = VideoStream(usePiCamera=True).start()t"
Then I got the following error:
Delete this line |vs = VideoStream(src=0).start() | and uncomment this line |vs = VideoStream(usePiCamera=True).start()t
Which was solved by the following commands:
Found a fix for anyone stuck on a similar issue.
sudo apt-get install libqt4-dev
cmake -D WITH_QT=ON ..
make
sudo make install
sudo apt-get install libopencv-*
Not sure why or how but running the above lines worked (altough only the first en last line worked)
But know I have the following error when running python facial_req.py.
…
[INFO] loading encodings + face detector…
Unable to init server: unable to connect: connection refused
Traceback (most recent call last):
File “facial_req.py”, line 90, in
cv2.imshow(“Facial Recognition is Running”, frame)
cv2.error: OpenCV(4.6.0-dev) /home/pi/opencv/modules/highgui/src/window_gtk.cpp:635: error: (-2:Unspecified error) Can’t initialize GTK backend in function ‘cvInitSystem’
…
Can you help me with this?
System
Raspberry pi 4 4GB
Raspian Buster up to date
I’m able to run the raspivid -t 0 line without any issues
Set up open CV without any issues