sthanhng / yoloface

Deep learning-based Face detection using the YOLOv3 algorithm (https://github.com/sthanhng/yoloface)
MIT License
454 stars 180 forks source link

the size of the boundary box #29

Closed loaysh2010 closed 4 years ago

loaysh2010 commented 4 years ago

What I need to do if I want to increase the size of the boundary box so that It covers the whole face from hair at the top to the bottom of the face. wherein code need to be changed?

naveenmula commented 4 years ago

You can make the change as follows where the top and bottom objects with 1.30 or 1.10 like that.

`def refined_box(left, top, width, height):
    right = left + width
    bottom = top + height

    original_vert_height = bottom - top
    **top = int(top + original_vert_height * 1.30)
    bottom = int(bottom - original_vert_height * 1.30)**

    margin = ((bottom - top) - (right - left)) // 2
    left = left - margin if (bottom - top - right + left) % 2 == 0 else left - margin - 1

    right = right + margin

    return left, top, right, bottom
`
loaysh2010 commented 4 years ago

@naveenmula Thank you. It helped