summaryrefslogtreecommitdiff
path: root/megapixels/app/processors/face_detector.py
diff options
context:
space:
mode:
Diffstat (limited to 'megapixels/app/processors/face_detector.py')
-rw-r--r--megapixels/app/processors/face_detector.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/megapixels/app/processors/face_detector.py b/megapixels/app/processors/face_detector.py
index 6bf27576..c0762564 100644
--- a/megapixels/app/processors/face_detector.py
+++ b/megapixels/app/processors/face_detector.py
@@ -1,3 +1,4 @@
+import sys
import os
from os.path import join
from pathlib import Path
@@ -30,8 +31,6 @@ class DetectorMTCNN:
:returns list of BBox
'''
bboxes = []
- #conf_thresh = self.conf_thresh if conf_thresh is None else conf_thresh
- #pyramids = self.pyramids if pyramids is None else pyramids
dnn_size = self.dnn_size if size is None else size
im = im_utils.resize(im, width=dnn_size[0], height=dnn_size[1])
@@ -72,6 +71,9 @@ class DetectorDLIBCNN:
import dlib
self.log = logger_utils.Logger.getLogger()
cuda_visible_devices = os.getenv('CUDA_VISIBLE_DEVICES', '')
+ if dlib.DLIB_USE_CUDA and gpu < 0:
+ self.log.error('dlib was compiled with CUDA but you selected CPU. Use GPU >= 0 if dlib.DLIB_USE_CUDA')
+ sys.exit()
os.environ['CUDA_VISIBLE_DEVICES'] = str(gpu)
self.log.info('load model: {}'.format(cfg.DIR_MODELS_DLIB_CNN))
self.detector = dlib.cnn_face_detection_model_v1(cfg.DIR_MODELS_DLIB_CNN)