diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-01-17 15:11:47 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-01-17 15:11:47 +0100 |
| commit | 85ae432fb6c6c17292b319bca068e46a4ea81eb3 (patch) | |
| tree | 4d0270fac0fdc7c1c1333af9c4bb82c6eb00669d /megapixels/commands/demo/face_pose.py | |
| parent | c293006ba43944ffeb4dcab17b2256f3a5491a36 (diff) | |
| parent | 03ad11fb2a3dcd425d50167b15d72d4e0ef536a2 (diff) | |
Merge branch 'master' of github.com:adamhrv/megapixels_dev
Diffstat (limited to 'megapixels/commands/demo/face_pose.py')
| -rw-r--r-- | megapixels/commands/demo/face_pose.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/megapixels/commands/demo/face_pose.py b/megapixels/commands/demo/face_pose.py index 3918adac..48214e0d 100644 --- a/megapixels/commands/demo/face_pose.py +++ b/megapixels/commands/demo/face_pose.py @@ -22,7 +22,7 @@ from app.settings import app_cfg as cfg help='GPU index') @click.option('-f', '--force', 'opt_force', is_flag=True, help='Force overwrite file') -@click.option('--display/--no-display', 'opt_display', is_flag=True, default=False, +@click.option('--display/--no-display', 'opt_display', is_flag=True, default=True, help='Display detections to debug') @click.pass_context def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): @@ -61,12 +61,12 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): # ---------------------------------------------------------------------------- # detect face - face_detector = face_detector.DetectorDLIBCNN(gpu=opt_gpu) # -1 for CPU + face_detector = face_detector.DetectorCVDNN() bboxes = face_detector.detect(im_resized, largest=True) - bbox = bboxes[0] + bbox_norm = bboxes[0] dim = im_resized.shape[:2][::-1] - bbox_dim = bbox.to_dim(dim) - if not bbox: + bbox_dim = bbox_norm.to_dim(dim) + if not bbox_norm: log.error('no face detected') return @@ -76,7 +76,7 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): from app.processors import face_landmarks landmark_detector_2d_68 = face_landmarks.Dlib2D_68() - points_2d_68 = landmark_detector_2d_68.landmarks(im_resized, bbox_dim) + points_2d_68 = landmark_detector_2d_68.landmarks(im_resized, bbox_norm) # ---------------------------------------------------------------------------- @@ -97,14 +97,14 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): # draw # draw 2d landmarks - im_landmarks_2d_68 = im_resized.copy() - draw_utils.draw_landmarks2D(im_landmarks_2d_68, points_2d_68) - draw_utils.draw_bbox(im_landmarks_2d_68, bbox_dim) + im_landmarks = im_resized.copy() + im_landmarks = draw_utils.draw_landmarks2D(im_landmarks, points_2d_68) + im_landmarks = draw_utils.draw_bbox(im_landmarks, bbox_norm) # draw pose im_pose = im_resized.copy() - draw_utils.draw_pose(im_pose, pose_data['point_nose'], pose_data['points']) - draw_utils.draw_degrees(im_pose, pose_data) + im_pose = draw_utils.draw_pose(im_pose, pose_data['point_nose'], pose_data['points']) + im_pose = draw_utils.draw_degrees(im_pose, pose_data) # ---------------------------------------------------------------------------- @@ -120,9 +120,8 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): if opt_display: - # show all images here cv.imshow('Original', im_resized) - cv.imshow('2D 68PT Landmarks', im_landmarks_2d_68) + cv.imshow('2D 68PT Landmarks', im_landmarks) cv.imshow('Pose', im_pose) display_utils.handle_keyboard()
\ No newline at end of file |
