Can AI Distinguish Between Identical Twins Better Than Humans?



来源:学术头条




本文约4512字,建议阅读8分钟
本文介绍了外国程序员使用软件利用AI系统Raspberry Pi识别双胞胎儿子的实验,并试图探究在面部识别方面,机器的发展是否已经超过人类大脑。





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































By 2021, it is widely believed that through learning algorithms and artificial intelligence research, machines outperform humans in many areas. For a long time, machines have dominated the manufacturing and supply chain sectors, even beginning to tackle more complex tasks such as autonomous driving and even writing high-difficulty comprehensive articles.But has the development of machines in facial recognition really surpassed the human brain?

13 years ago, when my identical twin sons were born, my wife and I easily recognized which one was Nicolas and which one was Alexander. After spending 8 weeks in the neonatal intensive care unit (NICU) at California Pacific Medical Center in San Francisco, we knew how to match their individual behaviors with their names. We learned early on what most parents of identical twins come to master:Who a person is depends not only on their appearance but also on the way they walk, talk, and the various behavioral differences when interacting with the world.This broad dataset allows humans to instantly recognize those we know, including identical twins.

Can AI Distinguish Between Identical Twins Better Than Humans?Image|Alexander and Nicolas

With widespread applications ranging from identifying criminals to helping us shop, facial recognition has been referred to in the news as a “Matrix-like silver bullet,” and I have been wondering,what can machines achieve in distinguishing faces when the dataset presents very slight differences? For example, identifying identical twins.

Diving into the differences
As my sons grow day by day, we have detailed discussions about their unique genetic makeup—essentially, they are cloned from the same fertilized egg (Note: there is a very high frequency of the “coolness” factor because they are avid fans of the clone army in “Star Wars”). To them, they are identical people created from the same blueprint. Of course, there are distinctions between them that occasionally confuse me, and I suspect machines would struggle as well. The same DNA is one thing, but the expression of genes and the influence of the environment play a crucial role in how humans change and develop over time. For example, I recently bought a phone with a fingerprint scanner and asked my sons if they wanted to conduct a little experiment: one would register their fingerprint, and the other would try to unlock it with their own finger, which obviously did not work. It turns out that various environmental factors (only one of which is genetic) drive the formation of “fingerprints” in utero, so twins often have different fingerprints. To help answer the question of “who is better at recognizing identical twins, humans or machines,” I decided to design an experiment slightly more complex than a fingerprint reader and invited my “little scientists” (my sons) to help out.
Building the experiment
For this project, I wanted to build a computer system that could run all the software required to execute and train machine learning and facial recognition models as cheaply as possible. I chose the Raspberry Pi because it offers extremely high cost-effectiveness, peripheral support, and the ability to run standard Linux distributions along with all the necessary tools for compiling software. I already had some Raspberry Pis for other projects, so I tested three to see which was best suited for this application. The Pi Zero worked fine, but it took 48 hours to analyze the video feed frames and compile all the necessary software (yes, it took 2 days to compile that software). For anyone looking to run a similar environment, I highly recommend the Pi 4b (8GB model) as it has a faster processor, multiple cores, and extended memory. The details and form factors of the three Pis we tested are as follows. The rest of the setup process assumes the use of the Pi 4b (8GB).
Can AI Distinguish Between Identical Twins Better Than Humans?Can AI Distinguish Between Identical Twins Better Than Humans?Image | Pi Zero, Pi 3b+, and Pi 4b – Scaled Pencil
This project also required a webcam. I already had a Logitech USB webcam that worked well without needing to install drivers. Any modern Logitech or similar webcam should work.
Setup: Step 1
The first step in setting up the Pi is to flash the Raspberry Pi OS onto the micro SD card and perform some basic configurations. To do this, download and install the Raspberry Pi Imager on your workstation. Once installed, insert the micro SD card (usually using an adapter), launch the imager, select the operating system and SD card, and then choose “Write.” For the OS, please select Raspberry Pi OS (32-bit), which is a port of Debian Linux with everything needed to set up the machine learning environment. After the SD card is written and verified, do not remove it; you need to perform three additional configurations before reinserting it into the Pi: set up WiFi, SSH, and video output.
  • WiFi: When starting the Pi, 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. Ensure the file format is plain text and ends with .conf. Before saving the file, add your two-letter country code and the SSID and PSK of the WiFi network (keep the quotes).
Can AI Distinguish Between Identical Twins Better Than Humans?
  • 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 have it start automatically, 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 controlling it remotely, so we must force 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.
Now eject the micro SD card, insert it into the Pi, connect it to power, and turn it on. After about a minute, the Pi should be fully booted and connected to your WiFi network. Check your WiFi router for the Pi’s IP address. Now, verify that you can connect to the Pi by opening a terminal (on Mac) or using Putty (on Windows) and SSH with the IP address as username “Pi” (default password is “raspberry”).Setup: Step 2The second step of the installation process is to install and compile all necessary software. To perform facial recognition tasks, I decided to use OpenCV (Open Source Computer Vision Library) and Dlib. OpenCV and Dlib have many optimized algorithms, including facial recognition, which are widely used in industry and academia, receiving good respect and support, and have interfaces for the Python programming language that can be used to drive model training and recognition programs. There are many examples online for setting up OpenCV and Dlib on Raspberry Pi, but I couldn’t find anything concise and comprehensive, so I created a simple wrapper to install all the required software and compile OpenCV and Dlib source code. To download and execute this wrapper, do the following:
  • SSH into Pi as the pi user and ensure you are in the pi user’s home directory: cd~
  • Clone our Raspberry Pi Facial Recognition repository from Github: git clone https://github.com/tomalessi/pi-facial-recognition.git
  • Run the installation script (which takes about 1 hour): pi-facial-recognition/pi-setup.sh
Setup: Step 3The Pi is now ready to take pictures and train the facial recognition model. To do this, we need to view the window environment on the Pi to connect to it via VNC Viewer. You need to enable the VNC server on the Pi and download a client on your workstation. Please follow these steps:
  • 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 restart.
  • Workstation Setup: Download VNC Viewer from RealVNC and install it for your platform (free download). After installation, set up a new connection from the 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.
Conducting Facial Recognition
The facial recognition process involves 3 steps: taking pictures, training the model, and analyzing real-time video. All three tasks can be executed using the face-req.py Python program, which has been popped from the Github repository above (Note: this is the first revision, with not much error handling functionality—if you want us to improve it, please submit a PR). The steps for taking pictures, training the model, and analyzing video are as follows. These assume you are logged into the Pi via VNC and have opened a terminal window.
  • Take a picture by executing the following command and pressing the spacebar while watching the live video: python pi-facial-recognition/face-req.py -c photo -n Tom Replace the -n argument with another argument to continue taking pictures for others. 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 picture and serialize the results for use in analyzing video.
  • Analyze video and apply the facial recognition model: python pi-facial-recognition/face-req.py -c analyze. After about ten seconds, the live video should start. All recognized faces will be labeled with that person’s name; otherwise, the face will be labeled as unrecognized. Press “q” to exit.
  • Clean the environment and restart by executing: python pi-facial-recognition/face-req.py -c clean.
Experimental Results
Once the environment was fully set up, I took 3 pictures of myself, 3 pictures of Nicolas, and 3 pictures of Alexander, and then trained the facial recognition machine learning system with these photos (one facing forward, one to the left, and one to the right). On the day of conducting these tests, no adjustments were made to any photos other than the current ones. After training the system, we took turns standing in front of the camera to see if the machine could recognize us. Note: We tried another experiment where we took 10 photos from different angles, but it did not change the results, possibly because we used a histogram of oriented gradients (HOG) based facial recognition method that only works well with frontal photos.Results: Test 1Test 1 was between myself and Alexander, and the machine recognized correctly.
Can AI Distinguish Between Identical Twins Better Than Humans?
Results: Test 2Test 2 was between myself and Nicolas. The machine recognized correctly again. I began to think that my initial guess was wrong—maybe the machine would win.
Can AI Distinguish Between Identical Twins Better Than Humans?
Results: Test 3Test 3 was the “main event”—the three of us together. Then the machine failed! Obviously, there were not two Nicolas. We found that when the kids moved around, the recognition would switch back and forth, but the machine rarely managed to recognize the twins simultaneously. Unscientifically, about 5% of the time, it could correctly identify both twins and myself at the same time.Can AI Distinguish Between Identical Twins Better Than Humans?
Results: Test 4I wanted to see how well the machine learning model recognized photos of the twins at age 3—photos held up to the camera. I must give the machine some credit; it did correctly recognize Nicolas (though it did not recognize Alexander) in the photo (the first time). I slightly adjusted the direction and distance of the photo in front of the camera, and then it incorrectly recognized Alexander and failed to recognize Nicolas. However, this was a good result, considering how much the children’s faces change from ages 3 to 10.
Can AI Distinguish Between Identical Twins Better Than Humans?
Alexander (left), Nicolas (right)
Can AI Distinguish Between Identical Twins Better Than Humans?
Alexander (left), Nicolas (right)
Results: Test 5I tried a newer colored photo (the kids might have been 4 years old), and the machine failed again. It incorrectly identified both as Nicolas.
Can AI Distinguish Between Identical Twins Better Than Humans?
For the final test, I wanted to see how old the photos could be before the machine completely failed to recognize. I used a photo of the twins around one year old. The machine correctly recognized me but did not recognize the twins.
Note: Even with a 12-year-old static photo, my wife and I could easily distinguish between the twins immediately.
Can AI Distinguish Between Identical Twins Better Than Humans?
Experimental Conclusion
The first conclusion here is obvious. One can build a fully functional computer system capable of running modern facial recognition and machine learning algorithms for $75 (if you don’t mind it being a bit slow, some can be built for as little as $10). Not to mention the more complex task of recognizing twins, this machine had a 100% success rate in identifying non-twins in live video. Every non-twin trained in the system achieved a 100% recognition success rate (we did other non-twin tests not shown here). At the same time, for personal privacy reasons, this does give me pause. This technology is powerful, very easy to use, and likely to be deployed in ways we cannot predict in our daily lives—we need to ensure this technology is not abused.
The second conclusion is that our facial features continue to undergo significant changes during the first 13 years of our lives, making it difficult for machines to recognize young people. The machine’s ability to recognize twins from old photos, even when they were “toddling,” impressed me. Honestly, it was fantastic! Aside from my wife and me, no one could look at our children’s old photos and determine who was who.
Finally, and most importantly, I observed that machines struggle to recognize identical twins, even with twins like my children who have noticeable differences. The system indeed had a tough time recognizing them, especially when a pair of twins or one was moving within the video frame—identification errors frequently occurred. From these simple tests, we conclude that, for now, humans are much better at facial recognition than machines. This is not surprising, as we have been evolving and refining our senses for 6 million years. I cannot tell you why I can easily distinguish between my children; I just know it is easy. Machines may eventually catch up to us, but not yet.
Next Steps
My sons want to build in some additional features on the Pi to control locks on doors or greet them when they enter their rooms, but based on our results, we first need to enhance the Pi’s ability to distinguish between them (to prevent one from accessing the other’s treasures). To improve the system’s accuracy, I want to try some different facial recognition technologies, such as utilizing convolutional neural networks (CNNs) supported by Dlib (though the Raspberry Pi is limited by its computational power), or having the Pi call public services for facial recognition in GCP, AWS, or Azure. Academia is increasingly researching facial recognition for twins, so the technology will certainly continue to improve to address some of the existing flaws we pointed out here—my sons and I will certainly keep an eye on this field.
Original link:
https://medium.com/swlh/can-a-trained-machine-distinguish-between-identical-twins-better-than-a-human-e801fdbc1943
——END——
Can AI Distinguish Between Identical Twins Better Than Humans?
Can AI Distinguish Between Identical Twins Better Than Humans?
Can AI Distinguish Between Identical Twins Better Than Humans?

Leave a Comment