diff options
| author | adamhrv <adam@ahprojects.com> | 2019-01-16 13:30:16 +0100 |
|---|---|---|
| committer | adamhrv <adam@ahprojects.com> | 2019-01-16 13:30:16 +0100 |
| commit | 65cb506ca182272e2701136097fd00c55dc6bd69 (patch) | |
| tree | cc5be8e61a8d5173745be1d331b210e967e146b5 /megapixels/commands/demo/face_pose.py | |
| parent | fceeb3b7adbc8d522e9fe1c40e12e9a529199068 (diff) | |
change bbox to norm, refine face extractor
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 |
