face-recognition-deepstream
face-recognition-deepstream copied to clipboard
Deepstream app use retinaface and arcface for face recognition.
Face recognition with Deepstream 6.1
This is a face detection and recognition app build on Deepstream.
Requirements
- Deepstream 6.0+
- GStreamer 1.14.5+
- Cuda 11.4+
- NVIDIA driver 470.63.01+
- TensorRT 8+
- Python 3.6+
Follow deepstream official doc to install dependencies.
Deepstream docker is more recommended.
Pretrained
Please refer to links below for pretrained models and serialized TensorRT engine. Or download from Google driver.
- ~~yolov5~~
- retinaface
- arcface
Alignment
there should be a face alignment before arcface. Use a custom-gst-nvinfer to preprocess the tensor-meta of retinaface.
Usage
1 - compile retinaface parse function
set a larger face detection bbox so that we can do alignment better later.
cd models/retinaface
make
2 - modify all path in config and codes
- all path in src/config/face/
- line 24 in src/kbds/app/face.py
- video path in test script
3 - Start kafka service before everything.
Then set "ip;port;topic" in codes. e.g.
DSFace("localhost;9092;deepstream")
you can recieve result messages on deepstream topic and error messages on error topic in same ip&port.
4 - start app
cd test
python3 face_test_demo.py
Notice that only support RTSP stream and Gstreamer format.
5 - check result
images before and after alignment will be stored in images.
modify codes in test/cal_sim.py. replace with your own face-feature npy file.
python3 test/cal_sim.py
it will outputs all score.