軟硬件環境
-
windows 10 64bit -
DBFace -
pytorch 1.6 -
opencv 4.4.0
簡介
DBFace
是一個開源的輕量級(模型只有7兆)的實時人臉檢測方法,檢測的速度與精度都很是不錯。下圖展現了多種人臉檢測方法在WiderFace
數據集上的測試效果,能夠看到不只DBFace
模型的大小最小,並且在Easy
、medium
、Hard
三個測試任務中均取得了最高的檢測精度。html
下圖展現了不一樣人臉檢測方法在WiderFace
數據集上的P-R
曲線,能夠看出,DBFace
包圍的面積在三個任務中均相對較大。python
安裝測試
首先建立python
虛擬環境git
conda create -n dbface python=3.7
conda activate dbface
接下來克隆DBFace
的源碼並安裝必要的依賴庫github
git clone https://github.com/dlunion/DBFace.git
cd DBFace
# 安裝opencv
pip install opencv-python
# 安裝pytorch1.6和cuda10.1
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
修改main.py
文件第54行,由web
ys = list((indices / hm_width).int().data.numpy())
改成windows
ys = list((torch.true_divide(indices, hm_width)).int().data.numpy())
而後執行測試腳本微信
python main.py
程序讀取datas
下的圖片文件進行人臉檢測,而後將檢測結果保存在detect_result
文件夾下編輯器
能夠看到在這張全世界最大的自拍圖片中,DBFace
表現的很是棒,不少人臉,就算是人的肉眼,也很難分辨出。ide
除了檢測圖片中的人臉,測試代碼中還提供了對usb camera
的支持測試
參考資料
-
https://github.com/dlunion/DBFace -
https://xugaoxiang.com/2019/12/08/anaconda/
本文分享自微信公衆號 - 迷途小書童的Note(Dev_Club)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。