visit
A facial recognition demonstration using , , python and the drone , from DJI.
Source code here:
This project is based on two other Github projects:I ran this using Ubuntu (Linux). To run using MS Windows or MacOS some fixes must be done. Be my guest to convert it and submit a pull request!
This software controls a Tello drone, capturing the video streaming generated by its onboard camera. He intercepts each frame and tries to recognize faces that appear on the image, using a that I trained, based on images from the dataset , and some pictures of mine.It is a proof of concept of the use of artificial intelligence with drones and, why not, Internet of Things (IoT). Note that performance can be low, after all, I am using a laptop and a cheap and simple drone. With more resources, better performance of the solution is possible.To use this solution, you will need:If you just bought your Tello drone, you need to check which version of Firmware it has. This can be done through the app (if you haven't downloaded it, it's better to do it now).
Then, turn on the drone, connect to his WiFi network with your Smartphone (TELLO ...), open the app and click on the settings button, as in the image:Then, click on More:
The process is done in two parts: Download the firmware to the Smartphone and update on the drone. To download the new firmware version, disconnect from the drone's WiFi and connect to the Internet. Using the Tello app, click the Update button to download the firmware. After downloading, connect to the drone's WiFi and click the Update button again.
After the process, check the new firmware version.Warning: An indication that the API is out of date is when the drone does not recognize the command streamon!
If you have updated the firmware correctly, I recommend that you try to run the original project, following the instructions in that repository. This confirms that the tracking API is working correctly. Then, you can download and run this repository here.That done, clone this repository and create an environment using the (
./ conda-env.yml)
:conda env create -f conda-env.yml
conda activate drone-facerec
To do facial recognition, it is necessary to train a neural network. I didn't insert the original project here, not even the model file that I trained. I recommend that you clone the original project and train your own model, and then copy the HDF5 file created to the easyTello folder, within this project.
Download and extract the , and place it in the FaceRec_CNN project and also inside the easytello folder for this project!
Generating a model is simple:1. Get multiple photos of the same person's face
2. Convert the photos
./ easytello / faceprocessor.py
);3. Get people's names and model file
ffmpeg -f video4linux2 -s 640x480 -r 15 -i /dev/video0 -vcodec libx264 -f h264 -an udp://localhost:11111
Use the program that I included (
./ facetest_ffmpeg.py
) to capture the images and do the recognition. If everything works, if he recognizes you, then everything is ready to run on the Drone.If you want, you can run this project with FFMPEG:python teste.py
Warning: To do facial recognition, do not use the original Easytello project! I modified the project to communicate with my facial recognition script (
./ easytello / faceprocessor.py
).The (
./ teste.py
) script controls the drone. It basically does 2 things: puts it in command mode and starts capturing video. But you can do so much more! You can make the drone take off, go forward, or turn around and then land. There are some commented commands that you can use. If you want to know more about the commands that Tello accepts, .Warning: Do not try to connect your smartphone to the drone, as it only serves a single connection!
Make sure you have placed the file h5 in the easyTello folder! Make sure the name is the same as it is in the file (
./easytello/faceprocessor.py
)Warning: If you make the drone take off, make sure there is room for it! If it hits the ceiling or walls, it could be damaged! And be careful when trying to use Tello outdoors (not recommended). If he moves more than 10 meters, he may be out of range of WiFi and collide with something. Theoretically, if he loses contact, he lands automatically.
Previously published at //github.com/cleuton/drone-facerec/blob/master/english_version.md