Skip to content

nghiapq77/face-recognition-cpp-tensorrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Recognition using C++ TensorRT

Face Recognition with RetinaFace and ArcFace.

This project uses TensorRT, OpenCV and cuBLAS to implement a face recognition system with simple SQLite database and Web APIs via Crow.

Requirements

  • CUDA 11.3
  • TensorRT 8.2.2.1
  • OpenCV 4.5.5
  • SQLite 3.31.1
  • Crow 1.0
  • Boost 1.79.0

Installation

git clone https://github.com/nghiapq77/face-recognition-cpp-tensorrt.git
cd face-recognition-cpp-tensorrt
cd app
mkdir build && cd build
cmake ..
make -j$(nproc)
cd main
mkdir build && cd build
cmake ..
make -j$(nproc)

Pretrained

Requirements

  • Python 3.8
  • torch 1.11.0+cu113
  • torchvision 0.12.0+cu113

Pretrained models

Convert torch model weights to serialized TensorRT engines

Using torch2trt_dynamic.

cd conversion/[retina/arcface]
python torch2trt.py

Usage

cd app/build
./app -c <config-file>

Example:

curl localhost:18080/insert/user -d '{"userId": "morty", "userName": "Morty Smith"}'
curl localhost:18080/insert/face -d '{"data": [{"userId": "morty", "imgPath": "<absolute-path-to-this-repo>/imgs/1.jpg"}]}'
curl localhost:18080/reload
cd main/build
./main

Visualized result from example.

References