implement face recognition in jetson nano - Massii94/GENERAL-TUTORIAL GitHub Wiki

We did somethings before:

we had cmpiled cv_bridge with python2 at first, and when we tried to use python3.7, they had conflicts. So we had to compile cv_bridge with python3.7 again.
we have used 'opencv3.4' now. At first we tried to compile 'opencv3.0', but it did not work.
To compile 'opencv3.4':
https://github.com/amin-amani/DataSci/wiki/install-opencv-3.4

Next, we have to add install path into LD_library_path:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/

Next, do the following: 1- Install related dependencies:

sudo apt-get install python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml ros-melodic-cv-bridge

2- Create a workspace to store the to-be-compiledcv_bridge file:

mkdir -p cvbridge_workspace/src

3- Instruct Carkin to set cmake variables:

cd cvbridge_workspace
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.7m.so

4- Instruct catkin to install built packages into install place. It doesn't matter if this step is unsuccessful, no need.

catkin config --install

5- Clone cv_bridge src in cvbridge_workspace workspace:

git clone https://github.com/ros-perception/vision_opencv.git src/vision_opencv

6-Find version of cv_bridge in your repository:

apt-cache show ros-melodic-cv-bridge | grep Version 

7- Checkout right version in git repo. In our case it is 1.13.0. So:

cd src/vision_opencv/
git checkout 1.13.0
cd ../../

8- Start compiling:

catkin build
 Or catkin build cv_bridge

9- Source

cd cvbridge_workspace/
source install/setup.bash --extend

10- Now, you can run your node. Usefull link:

https://www.programmersought.com/article/85247550924/

################################## if you get the error bellow:

ImportError: /home/jetson/.local/lib/python3.7/site-packages/_dlib_pybind11.cpython-37m-aarch64-linux-gnu.so: undefined symbol: png_riffle_palette_neon

do:

The fix is adding the cuDNNv8 new API support.
And it is available in the newest dlib-19.21 release in Aug 8.

So you can build it from source directly:

Install dependencies
$ sudo apt-get install python3-pip
$ sudo apt-get install libjpeg-dev
Build dlib from source
$ wget http://dlib.net/files/dlib-19.21.tar.bz2
$ tar jxvf dlib-19.21.tar.bz2
$ cd dlib-19.21/
$ mkdir build
$ cd build/
$ cmake ..
$ cmake --build .
$ cd ../
$ sudo python3 setup.py install
$ sudo pip3 install face_recognition

references:

https://forums.developer.nvidia.com/t/simple-accelerated-face-recognition/142679/3