By 2021, people generally believe that through learning algorithms and artificial intelligence research, machines outperform humans in many aspects.
For a long time, machines have dominated the manufacturing and supply chain fields, and have even begun to tackle more complex tasks, such as autonomous driving and even writing high-difficulty comprehensive articles. However, has the development of machines in facial recognition really surpassed the human brain?
-
WiFi: When the Pi starts, it needs to connect to the local network. Create a file named wpa_supplicant.conf and place it at the top level of the SD card. Make sure the file is in plain text format and ends with .conf. Before saving the file, add the two-letter country code for your location along with the SSID and PSK for your WiFi network (keep them in double quotes).
-
SSH: Since we are setting up the Pi to run headless (without a monitor), we need a way to connect to it for management and configuration — using SSH. To enable the Linux SSH daemon and automate it, place a file named ssh at the top level of the SD card that contains no content and has no file extension. -
Video: We will start the Pi without a display connected, but we still want to enable video while remotely controlling it, so we must force the HDMI to be active even if it is not detected. Edit the config.txt file at the top level of the SD card and uncomment the line hdmi_force_hotplug = 1.
-
Connect to the Pi via SSH as the pi user and ensure you are in the pi user’s home directory: cd~ -
Clone a copy of our Raspberry Pi facial recognition repository on GitHub: git clone https://github.com/tomalessi/pi-facial-recognition.git -
Execute the installation script (takes about 1 hour): pi-facial-recognition/pi-setup.sh
-
Pi Setup: SSH into the Pi, execute the command sudo raspi-config, scroll down to Interface Options → VNC and enable it. After enabling this feature, you will need to reboot. -
Workstation Setup: Download and install VNC Viewer from RealVNC for your platform (free download). Once installed, set up a new connection from VNC Viewer to the Pi using its IP address and ensure you can log in. Once logged in successfully, you will see the background of the Raspberry Pi OS.
-
Take a picture by executing the following command and pressing the space bar while watching the live video: python pi-facial-recognition/face-req.py -c photo -n Tom Continue taking pictures for others by replacing the -n parameter with another parameter. Press ctrl + c in the terminal window to exit. -
Train the model: python pi-facial-recognition/face-req.py -c train. It takes about 10 seconds to analyze each photo and serialize the results for video analysis. -
Analyze video and apply the facial recognition model: python pi-facial-recognition/face-req.py -c analyze. After about ten seconds, live video should start. All recognized faces will be tagged with the person’s name, otherwise, the face will be tagged as unrecognized. Press “q” to exit. -
To clean the environment and start over, please execute: python pi-facial-recognition/face-req.py -c clean.
Alexander (left), Nicolas (right)
Alexander (left), Nicolas (right)
Leave a Comment
Your email address will not be published. Required fields are marked *