コード例 #1
0
 def __init__(self):
     self.labels = ["male", "female"]
     self.mean = (78.4263377603, 87.7689143744, 114.895847746)
     self.f_detector = FDetector()
     self.web_util = web()
     self.f_detector.set_detector("hog")
     self.__set_detector()
コード例 #2
0
from visionlib.face.detection import FDetector
import cv2
import argparse

# Configre the parser.
parser = argparse.ArgumentParser()
parser.add_argument("img_path", help="Path to image")
parser.add_argument("--enable-gpu",
                    help="Set to true to enable gpu support",
                    dest="enable_gpu",
                    default=False,
                    type=bool)
args = parser.parse_args()

# Instantiating the required classes.
detector = FDetector()

# Read the image
img = cv2.imread(args.img_path)
detector.set_detector("hog")
# Apply face detection and show image
d_img, boxes, conf = detector.detect_face(img,
                                          show=True,
                                          enable_gpu=args.enable_gpu)
for box, conf in zip(boxes, conf):
    print(box, conf)
コード例 #3
0
 def setUp(self):
     self.detectors = ["mtcnn", "haar", "hog", "dnn"]
     self.face_detector = FDetector()
     self.group_img_path = "assets/face.jpg"
     self.test_img = cv2.imread(self.group_img_path)
     logging.basicConfig(level=logging.INFO)