mtcnn_detector.py 文件源码

python
阅读 52 收藏 0 点赞 0 评论 0

项目:prepare-faces-zyf 作者: walkoncross 项目源码 文件源码
def generate_bboxes(scores_map, reg, scale, t):
    stride = 2
    cellsize = 12

    (y, x) = np.where(scores_map >= t)

    if len(y) < 1:
        return None

    scores = scores_map[y, x]

    dx1, dy1, dx2, dy2 = [reg[i, y, x] for i in range(4)]

    reg = np.array([dx1, dy1, dx2, dy2])

    bbox = np.array([y, x])
#    bb1 = np.fix((stride * bbox) / scale)
#    bb2 = np.fix((stride * bbox + cellsize) / scale)

    # !!! Use fix() for top-left point, and round() for bottom-right point
    # !!! So we can cover a 'whole' face !!! added by zhaoyafei 2017-07-18
    bb1 = np.fix((stride * bbox) / scale)
    bb2 = np.round((stride * bbox + cellsize) / scale)

#    print 'bb1.shape:', bb1.shape
#    print 'bb2.shape:', bb2.shape
#    print 'scores.shape:', scores.shape
#    print 'reg.shape:', reg.shape

    bbox_out = np.vstack((bb1, bb2, scores, reg))
#    print 'bbox_out.shape:', bbox_out.shape

    return bbox_out.T
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号