行人目标追踪及计数YOLOv3+DeepSORT

People-Detection-and-Tracking

[Github 原文档] @Bobby Chen 记得留下小星星

TownCentre 行人流量计数 Demo - [ Bilibili ]

Requirement - 依赖项

  • OpenCV
  • NumPy
  • sklean
  • Pillow
  • tensorflow-gpu 1.10.0

项目算法

It uses:

* YOLOv3 to detect objects on each of the video frames. - 目标检测算法

* Deep_SORT to track those objects over different frames. - 目标追踪算法

DeepSORT 是在 SORT 目标追踪基础上的改进版本,加入了行人重识别数据集上训练的深度学习模型,在实时目标追踪过程中,提取目标的表观特征进行最近邻匹配,提高了目标追踪的鲁棒性。

This repository contains code for Simple Online and Realtime Tracking with a Deep Association Metric (Deep SORT). We extend the original SORT algorithm to integrate appearance information based on a deep appearance descriptor. See the arXiv preprint for more information.

DeepSORT Flowwork:

  • 读取当前帧目标检测框的位置及各检测框图像块的深度特征
  • 根据置信度 (confidence) 对检测框进行过滤,删除置信度不够高的检测框
  • 对所有检测框进行非最大值抑制 (non-maximum suppression),消除置信度得分 (confidence score) 低的检测框,留下最佳的目标检测框
  • 预测:使用 kalman 滤波预测目标在当前帧的位置
  • 更新:更新 kalman 追踪器参数及特征集,另外进行目标消失、新目标出现的判断

Quick Start - 快速开始

详细代码可参考 [Github 原文档] @Bobby Chen

1. 下载Git代码.

git clone https://github.com/yehengchen/Object-Detection-and-Tracking.git

2. 下载 [yolov3.weights] 并将 [ .weights] 文件放入 yolov3_sort/yolo-obj/

这里可以下载我训练的 [yolo_cc_0612.h5] 行人目标检测权重 for detection person/car/bicycle,etc.

3. 将你训练的 [ .weights ] 模型转换为 [ .h5 ] 模型:

$ python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5

4. 运行 YOLO_DEEP_SORT:

$ python main.py -c [CLASS NAME] -i [INPUT VIDEO PATH]

$ python main.py -c person -i ./test_video/testvideo.avi

5. 根据需求可更换检测类别 [deep_sort_yolov3/yolo.py] 的__Line 100__行可更换参数.

DeepSORT pre-trained weights using people-ReID datasets only for person, other targets is not good

    if predicted_class != args["class"]:
               continue
    
    if predicted_class != 'person' and predicted_class != 'car':
               continue

Train on Market1501 & MARS - 目标追踪模型训练

Object Re-identification model

cosine_metric_learning for training a metric feature representation to be used with the deep_sort tracker.


Citation

YOLOv3 :

@article{yolov3,
title={YOLOv3: An Incremental Improvement},
author={Redmon, Joseph and Farhadi, Ali},
journal = {arXiv},
year={2018}
}

Deep_SORT :

@inproceedings{Wojke2017simple,
title={Simple Online and Realtime Tracking with a Deep Association Metric},
author={Wojke, Nicolai and Bewley, Alex and Paulus, Dietrich},
booktitle={2017 IEEE International Conference on Image Processing (ICIP)},
year={2017},
pages={3645--3649},
organization={IEEE},
doi={10.1109/ICIP.2017.8296962}
}

@inproceedings{Wojke2018deep,
title={Deep Cosine Metric Learning for Person Re-identification},
author={Wojke, Nicolai and Bewley, Alex},
booktitle={2018 IEEE Winter Conference on Applications of Computer Vision (WACV)},
year={2018},
pages={748--756},
organization={IEEE},
doi={10.1109/WACV.2018.00087}
}

Reference

Github:deep_sort@Nicolai Wojke nwojke
Github:deep_sort_yolov3@Qidian213

你可能感兴趣的:(行人目标追踪及计数YOLOv3+DeepSORT)