人脸跟踪2020

 

https://github.com/kylemcdonald/FaceTracker


 

https://github.com/qaz734913414/MNN_FaceTrack

这是一个移动端快速视频多人脸跟踪的开源项目,这个项目是基于mtcnn人脸检测加上最简单的模板匹配进行人脸跟踪的,算法简单但效果显著,移动端速度可以达到250帧以上,该项目的特点是可实现多人脸跟踪。

速度挺快,但是很容易跟丢。

 

代码算法解析

HyperFT项目的多人脸跟踪算法分三大部分:

第一部分是初始化,通过mtcnn的人脸检测找出第一帧的人脸位置然后将其结果对人脸跟踪进行初始化;

第二部分是更新,利用模板匹配进行人脸目标位置的初步预判,再结合mtcnn中的onet来对人脸位置进行更加精细的定位,最后通过mtcnn中的rnet的置信度来判断跟踪是否为人脸,防止当有手从面前慢慢挥过去的话,框会跟着手走而无法跟踪到真正的人脸;

第三部分是定时检测,通过在更新的部分中加入一个定时器来做定时人脸检测,从而判断中途是否有新人脸的加入,本项目在定时人脸检测中使用了一个trick就是将已跟踪的人脸所在位置利用蒙版遮蔽起来,避免了人脸检测的重复检测,减少其计算量,从而提高了检测速度。

这个也可以试试:需要自己安装ncnn

https://blog.csdn.net/renhanchi/article/details/85089265

https://github.com/HandsomeHans/Face-Tracking-Based-on-OpenTLD-and-RNet

 

python panda

https://github.com/Linzaer/Face-Track-Detect-Extract

改完可以运行,检测不到就会跟丢,偶尔也会跟丢

原来匈牙利指派算法:

def associate_detections_to_trackers(detections, trackers, iou_threshold=0.25):
    """
    Assigns detections to tracked object (both represented as bounding boxes)
    Returns 3 lists of matches, unmatched_detections and unmatched_trackers
    """
    if len(trackers) == 0:
        return np.empty((0, 2), dtype=int), np.arange(len(detections)), np.empty((0, 5), dtype=int)
    iou_matrix = np.zeros((len(detections), len(trackers)), dtype=np.float32)

    for d, det in enumerate(detections):
        for t, trk in enumerate(trackers):
            iou_matrix[d, t] = iou(det, trk)
    '''The linear assignment module tries to minimise the total assignment cost.
    In our case we pass -iou_matrix as we want to maximise the total IOU between track predictions and the frame detection.'''
    matched_indices = linear_assignment(-iou_matrix)

    unmatched_detections = []
    for d, det in enumerate(detections):
        if d not in matched_indices[:, 0]:
            unmatched_detections.append(d)
    unmatched_trackers = []
    for t, trk in enumerate(trackers):
        if t not in matched_indices[:, 1]:
            unmatched_trackers.append(t)

    # filter out matched with low IOU
    matches = []
    for m in matched_indices:
        if iou_matrix[m[0], m[1]] < iou_threshold:
            unmatched_detections.append(m[0])
            unmatched_trackers.append(m[1])
        else:
            matches.append(m.reshape(1, 2))
    if len(matches) == 0:
        matches = np.empty((0, 2), dtype=int)
    else:
        matches = np.concatenate(matches, axis=0)

    return matches, np.array(unmatched_detections), np.array(unmatched_trackers)

一般情况挺好的,KalmanFilter 滤波

 

效果可能不好

https://github.com/ingfrancocrimaldi/face_detection_and_tracking_with_cam_servomotor_arduino_and_opencv

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI视觉网奇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值