|
2 yıl önce | |
---|---|---|
.. | ||
models | 6 yıl önce | |
videos | 6 yıl önce | |
CMakeLists.txt | 4 yıl önce | |
README.md | 2 yıl önce | |
dlib.zip | 4 yıl önce | |
face_detection_dlib_hog.cpp | 4 yıl önce | |
face_detection_dlib_hog.py | 4 yıl önce | |
face_detection_dlib_mmod.cpp | 4 yıl önce | |
face_detection_dlib_mmod.py | 4 yıl önce | |
face_detection_opencv_dnn.cpp | 4 yıl önce | |
face_detection_opencv_dnn.py | 4 yıl önce | |
face_detection_opencv_haar.cpp | 4 yıl önce | |
face_detection_opencv_haar.py | 4 yıl önce | |
run-all.cpp | 4 yıl önce | |
run-all.py | 4 yıl önce |
There are 10 code files in this repo - 5 for C++ and 5 for Python:
First of all Unzip the dlib.zip file
Compile
Add path to the properly build OpenCV with DNN GPU Support and your CUDA:
cmake -D OpenCV_DIR=~/opencv -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ .
make
Note: Our code is tested using Python 3.7.5, but it should also work with any other python3.x.
Install virtualenv:
pip install virtualenv
Create new virtual environment env
and activate it:
python -m venv env
source env/bin/activate
Install numpy:
pip install numpy
Install dlib:
pip install dlib
Create symlink to the properly build OpenCV with DNN GPU Support:
cd env/lib/python3.x/site-packages/
ln -s ~/opencv/build/cv2.so cv2.so
If you don't pass any filename, it will use the web cam
C++
./face_detection_XXXX <filename>
Note: for face_detection_opencv_dnn.cpp
you can pass up to 3 arguments:
./face_detection_opencv_dnn.out <filename>
./face_detection_opencv_dnn.out "" cpu
./face_detection_opencv_dnn.out "" gpu tf
Python
python face_detection_XXXX.py -video <filename>
Note: for face_detection_opencv_dnn.py
you can pass up to 3 arguments:
python face_detection_opencv_dnn.out --video <filename>
python face_detection_opencv_dnn.out --video <filename> --device cpu
python face_detection_opencv_dnn.out --video <filename> --device cpu --framework tf
C++ ./run-all
Python python run-all.py --video
Want to become an expert in AI? AI Courses by OpenCV is a great place to start.