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_beauty.py | |
| parent | fceeb3b7adbc8d522e9fe1c40e12e9a529199068 (diff) | |
change bbox to norm, refine face extractor
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) # ---------------------------------------------------------------------------- |
