Login

Image Classification on Jeston Nano

Objectives

  • Building a Hardware Accelerated Facial Recognition System

Things

For this project, you will need

  1. A Jetson Nano Developer Kit
  2. MicroSD Memory Card (32GB UHS-I minimum)
  3. 5V 4A Power Supply with 2.1mm DC barrel connector
  4. 2-pin Jumper
  5. Compatible camera: Logitech C270 USB Webcam
  6. USB cable (Micro-B to Type-A)
  7. Phyton3 and Jupyter Notebook installed in your computer

Lets Get Started!!!

Jetson Nano is a extremely powerful piece of hardware capable of accelerating Machine Learning projects. To build a facial recognition system, we need to install several Python libraries

 

Installing Libraries

From the Jetson Nano desktop, open up a Terminal window and run the following commands:

sudo apt-get update
sudo apt-get install python3-pip cmake libopenblas-dev liblapack-dev libjpeg-dev

git clone https://github.com/JetsonHacksNano/installSwapfile

./installSwapfile/installSwapfile.sh

At this point, you need to reboot the system to make sure the swapfile is running.

Open up a terminal window and type in the following:

pip3 install numpy


Now we are ready to install dlib, a deep learning library created by Davis King that does the heavy lifting for the face_recognition library.

wget http://dlib.net/files/dlib-19.17.tar.bz2 
tar jxvf dlib-19.17.tar.bz2
cd dlib-19.17
gedit dlib/cuda/cudnn_dlibapi.cpp

This will open up the file that we need to edit in a text editor. Search the file for the following line of code (which should be line 854)

forward_algo = forward_best_algo;

And comment it out by adding two slashes in front of it, so it looks like this:

//forward_algo = forward_best_algo;

Now save the file, close the editor, and go back to the Terminal window. Next, run these commands to compile and install dlib:

sudo python3 setup.py install

Finally, we need to install the face_recognition Python library. Do that with this command:

sudo pip3 install face_recognition

 

 

Lets Begin !!!

To get started, let’s download the code

wget -O doorcam.py tiny.cc/doorcam

Then you can run the code and try it out:

python3 doorcam.py

You’ll see a video window pop up on your desktop. Whenever a new person steps in front of the camera, it will register their face and start tracking how long they have been near your door. If the same person leaves and comes back more than 5 minutes later, it will register a new visit and track them again. You can hit ‘q’ on your keyboard at any time to exit.

The app will automatically save information about everyone it sees to a file called known_faces.dat. When you run the program again, it will use that data to remember previous visitors. If you want to clear out the list of known faces, just quit the program and delete that file.

We would love to see what you build out of these learnings!

Click here to submit your projects, share it with the world and stand a chance to be rewarded.

top

Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved

X