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_beauty.py | |
| parent | c293006ba43944ffeb4dcab17b2256f3a5491a36 (diff) | |
| parent | 03ad11fb2a3dcd425d50167b15d72d4e0ef536a2 (diff) | |
Merge branch 'master' of github.com:adamhrv/megapixels_dev
Diffstat (limited to 'megapixels/commands/demo/face_beauty.py')
| -rw-r--r-- | megapixels/commands/demo/face_beauty.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/megapixels/commands/demo/face_beauty.py b/megapixels/commands/demo/face_beauty.py index d31c5cee..45643c61 100644 --- a/megapixels/commands/demo/face_beauty.py +++ b/megapixels/commands/demo/face_beauty.py @@ -66,10 +66,10 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): face_detector = face_detector.DetectorDLIBCNN(gpu=opt_gpu) # -1 for CPU 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 else: @@ -78,7 +78,7 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): # ---------------------------------------------------------------------------- # beauty - beauty_score = beauty_predictor.beauty(im_resized, bbox_dim) + beauty_score = beauty_predictor.beauty(im_resized, bbox_norm) # ---------------------------------------------------------------------------- @@ -93,9 +93,9 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_gpu, opt_size, opt_force, opt_display): # draw 2d landmarks im_beauty = im_resized.copy() - draw_utils.draw_bbox(im_beauty, bbox_dim) + im_beauty = draw_utils.draw_bbox(im_beauty, bbox_dim) txt = f'Beauty score: {(100*beauty_score):.2f}' - draw_utils.draw_text(im_beauty, bbox_dim.pt_tl, txt) + im_beauty = draw_utils.draw_text(im_beauty, bbox_dim.pt_tl, txt) # ---------------------------------------------------------------------------- |
