This is Face Identification Test App with Intel OpenVINO Face Re-Identification Model.
You can do followings:
- Realtime Face Re-Identification
- Face Search
Real time face re-identifiction (Youtube Link)
Face Search
- Python 3.6+ (Required Ordered Dict)
- OpenVINO Toolkit 2021.4[^1]
- Windows 10
pip install -r requirements.txt
python app.py -h
usage: app.py [-h] -i INPUT [-l CPU_EXTENSION] [-d {CPU,GPU,FPGA,MYRIAD}]
[-d_lm {CPU,GPU,FPGA,MYRIAD}] [-d_fi {CPU,GPU,FPGA,MYRIAD}]
[--dbname DBNAME] [--no_v4l]
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Path to video file or image. 'cam' for capturing video
stream from camera
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with the kernels impl.
-d {CPU,GPU,FPGA,MYRIAD}, --device {CPU,GPU,FPGA,MYRIAD}
Specify the target device for Face Detection to infer
on; CPU, GPU, FPGA or MYRIAD is acceptable.
-d_lm {CPU,GPU,FPGA,MYRIAD}, --device_landmarks {CPU,GPU,FPGA,MYRIAD}
Specify the target device for Facial Landmarks
Estimation to infer on; CPU, GPU, FPGA or MYRIAD is
acceptable.
-d_fi {CPU,GPU,FPGA,MYRIAD}, --device_reidentification {CPU,GPU,FPGA,MYRIAD}
Specify the target device for Facial re-identificaiton
to infer on; CPU, GPU, FPGA or MYRIAD is acceptable.
--dbname DBNAME Specify face database name
--no_v4l cv2.VideoCapture without cv2.CAP_V4L
At first, you need to create face Database.
Here is an example of face registration from csv file.
Download dataset from CelebA using Google Drive [CelebA > img > img_align_celba.zip] and extract the file.
Note: img_align_celba.zip includes 202,599 face images and 1GB size
I tested to register 20,000 faces. Change /path/to/celeba.
- celeba.csv
imagepath, label
<path_to_celeba_img_align_celeba>\000001.jpg,F00001
<path_to_celeba_img_align_celeba>\000002.jpg,F00002
<path_to_celeba_img_align_celeba>\000003.jpg,F00003
..
<path_to_celeba_img_align_celeba>\000004.jpg,F00004
[dbname]_vecs.gz and [dbname]_pics.gz are created. (You can ignore the errors during face registration.)
python registrar.py csv_register --csv celeba.csv --dbname celeba --batch_size 500
celeba_vecs.gz
includes feature vectors, celeca_pics.gz
includes image path of each face.
The size of feature vectors file produced from 20,000 face images is about 22 MB.
>dir
..
2019/06/26 22:06 159,470 celeba_pics.gz
2019/06/26 22:06 23,168,652 celeba_vecs.gz
Face images are saved to /static/images/dbname
python registrar.py list --dbname celeba
..
19781, label:F19999 file:/static/images/celeba/F19999.png
19782, label:F20000 file:/static/images/celeba/F20000.png
Rows:19782
# dbname is the face db name (ex. celeba)
python app.py -i cam --no_v4l --dbname celeba
If you use OpenVINO Toolkit 2019 R3 or earlier build please specify cpu_extension
.
# dbname is the face db name (ex. celeba)
python app.py -i cam -l extension\cpu_extension.dll --no_v4l --dbname celeba
Access to the url
http://127.0.0.1:5000/