Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4:npu:demos:face-recognition

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:vim4:npu:demos:face-recognition [2024/10/31 03:03]
jacobe [Compile and run]
products:sbc:vim4:npu:demos:face-recognition [2025/06/12 05:38] (current)
louis
Line 1: Line 1:
 ~~tag> NPU RetinaFace FaceNet VIM4 ~~ ~~tag> NPU RetinaFace FaceNet VIM4 ~~
 +
 +**Doc for version ddk-3.4.7.7**
  
 ====== Face Recognition VIM4 Demo - 7 ====== ====== Face Recognition VIM4 Demo - 7 ======
  
 {{indexmenu_n>7}} {{indexmenu_n>7}}
 +
 +Face Recognition Demo consists of two models, RetinaFace and FaceNet. It can detect face on image and recognize who it is. Here are two judgment indicators, cosine similarity and Euclidean distance. The closer the cosine similarity is to 1 and the closer the Euclidean distance is to 0, the more similar is between two faces.
 +
 +Here takes **lin_1.jpg** as example. Inference results on VIM4. Only show cosine similarity.
 +
 +{{:products:sbc:vim4:npu:demos:face-recognition-vim4-result-2.png?400|}} {{:products:sbc:vim4:npu:demos:face-recognition-vim4-result-1.jpg?400|}}
 +
 +**Inference speed test**: USB camera about **80ms** per frame.
  
 <WRAP important > <WRAP important >
Line 18: Line 28:
 $ git clone https://github.com/khadas/vim4_npu_applications $ git clone https://github.com/khadas/vim4_npu_applications
 ``` ```
 +
 +<WRAP important>
 +If your kernel is older than 241129, please use version before tag ddk-3.4.7.7.
 +</WRAP>
  
 ==== Install dependencies ==== ==== Install dependencies ====
Line 43: Line 57:
  
 # Run mode 1 # Run mode 1
-sudo ./face_recognition -M ../data/model/retinaface_int8.adla -m ../data/model/facenet_int8.adla -p 1+$ ./face_recognition -M ../data/model/retinaface_int8.adla -m ../data/model/facenet_int8.adla -p 1
 ``` ```
  
Line 50: Line 64:
 ```shell ```shell
 # Run mode 2 # Run mode 2
-sudo ./face_recognition -M ../data/model/retinaface_int8.adla -m ../data/model/facenet_int8.adla -p ../data/img/lin_2.jpg+$ ./face_recognition -M ../data/model/retinaface_int8.adla -m ../data/model/facenet_int8.adla -p ../data/img/lin_2.jpg
 ``` ```
  
Line 58: Line 72:
  
 Put your full face photo into the ''vim4_npu_applications/face_recognition/data/img'' and run mode 1 to generate ''face_feature_lib''. Put ''face_feature_lib'' in ''vim4_npu_applications/face_recognition_cap''. Put your full face photo into the ''vim4_npu_applications/face_recognition/data/img'' and run mode 1 to generate ''face_feature_lib''. Put ''face_feature_lib'' in ''vim4_npu_applications/face_recognition_cap''.
- 
-== Compile == 
  
 ```shell ```shell
 +# Compile
 $ cd vim4_npu_applications/face_recognition_cap $ cd vim4_npu_applications/face_recognition_cap
 $ mkdir build $ mkdir build
Line 67: Line 80:
 $ cmake .. $ cmake ..
 $ make $ make
-``` 
  
-== Run== +Run 
- +$ ./face_recognition_cap -../data/model/retinaface_int8.adla -m ../data/model/facenet_int8.adla -t usb -d 0
-**MIPI Camera** +
- +
-``` +
-sudo ./retinaface_cap -../data/retinaface_int8.adla -t mipi -w 1920 -h 1080 +
-``` +
- +
-**USB Camera** +
-``` +
-$ cd build +
-$ sudo ./retinaface_cap -m ../data/retinaface_int8.adla -t usb -w 1920 -h 1080 -d 0+
 ``` ```
  
-**TIP**: Replace as the number for your camera device. Such as ''/dev/video5'', it should be ''-d 5''.+''0'' is the camera device index.
Last modified: 2024/10/31 03:03 by jacobe