From 5e5a7d09774bde195fe31ae143704eb124a764ac Mon Sep 17 00:00:00 2001 From: adamhrv Date: Mon, 7 Jan 2019 02:26:34 +0100 Subject: add demos, in progress --- megapixels/app/processors/face_detector.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'megapixels/app/processors/face_detector.py') 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) -- cgit v1.2.3-70-g09d2