這個小項目的目的是將對象跟踪添加到yolov2並實現實時多個對象跟踪。
當前的體系結構僅設置為僅跟踪一種類型的對象,但是應該易於概括所有對象。
目前支持人們跟踪(因為Deep_sort提供的權重接受了人們跟踪的培訓)
python
numpy
opencv 3
tensorflow 1.0
Cython.
sklean.
用於使用排序:
scikit-learn
scikit-image
FilterPy
1-克隆此存儲庫: git clone https://github.com/bendidi/Tracking-with-darkflow.git
2-初始化所有子模型: git submodule update --init --recursive
3-轉到DarkFlow目錄並進行到位構建: python3 setup.py build_ext --inplace
下載權重:
在此處閱讀有關Yolo(在DarkNet中)的更多信息,並在此處下載權重文件,如果找不到重量文件,Trieu已將其上載在此處,其中包括V1.0的yolo-full和yolo-tiny ,V1.1的tiny-yolo-v1.1和yolo的Tiny-Yolo-V1.1和Yolo,Yolo, tiny-yolo-voc v2 v2。
我在此項目中使用/測試的Artchituction是cfg/yolo.cfg ,重物bin/yolo.weights 。
接下來,您需要在此處下載deep_sort權重(網絡文件夾),由nwojke提供
NWOJKE提供的Deep_sort權重已取消。您可以從這裡獲得它們(感謝 @louxy126)
提取文件夾並將其複製到deep_sort/resources
在run.py中編輯標誌以下配置:
demo :要使用的視頻文件的路徑,如果您想使用相機,請將“相機”設置為“相機”
model :用於Yolo的模型配置,您可以在此處獲取更多信息和.cfg文件(將它們放入DarkFlof/ cfg/文件夾中)
load :與所選型號一起使用的相應權重(將它們放入DarkFlow/bin/)更多信息。
threshold :Yolo檢測的信心閾值
gpu :要使用多少GPU,0表示使用CPU
track :激活跟踪是否
trackObj :哪些對象可以跟踪為列表(請注意,Deep_sort的編碼器僅受到人的培訓,因此您需要訓練自己的編碼器,其中更多信息)
saveVideo :是否保存視頻
BK_MOG :添加OpenCV的MOG背景減法模塊,僅當Yolo無法檢測到視頻中的人(低質量,...)時使用它來檢測圍繞移動對象的框
tracker :要使用的跟踪器:“ deep_sort”或“ sort”
**NOTE** : "deep_sort" only supports people tracking as it was only trained to track people(the code for training is not yet published)
**TODO** : add support for GOTURN tracker(tensorflow implementation)
**TODO** : add support for opencv trackers (MIL,KCF,TLD,MEDIANFLOW)
skip :跳過框架以增加FPS,可能會降低準確性!
csv :以格式保存檢測的CSV文件(frame_id,object_id,x,y,w,h)
display :處理是否在處理時顯示視頻
接下來,您只需要運行python run.py ,然後享受!
`使用yolo.cfg的速度:
YOLO with track Flag set to False : 30fps
YOLO with track Flag set to True (deep_sort) : 14 fps
YOLO with track and background subtraction Flags set to True : 10.5 fps
在(1024,1280,3)NVIDIA GTX 1080上的分辨率視頻上進行的測試
跳過多達3幀可以提高速度,同時保持跟踪的準確性
該項目使用的代碼來自以下方式:
Trieu/DarkFlow:用於實時對象檢測和分類。
nwojke/deep_sort:使用深層關聯度量的簡單在線實時跟踪。
請關注鏈接以了解每個項目的所有功能。
@article{redmon2016yolo9000,
title={YOLO9000: Better, Faster, Stronger},
author={Redmon, Joseph and Farhadi, Ali},
journal={arXiv preprint arXiv:1612.08242},
year={2016}
}
@article{Wojke2017simple,
title={Simple Online and Realtime Tracking with a Deep Association Metric},
author={Wojke, Nicolai and Bewley, Alex and Paulus, Dietrich},
journal={arXiv preprint arXiv:1703.07402},
year={2017}
}
@inproceedings{Bewley2016_sort,
author={Bewley, Alex and Ge, Zongyuan and Ott, Lionel and Ramos, Fabio and Upcroft, Ben},
booktitle={2016 IEEE International Conference on Image Processing (ICIP)},
title={Simple online and realtime tracking},
year={2016},
pages={3464-3468},
keywords={Benchmark testing;Complexity theory;Detectors;Kalman filters;Target tracking;Visualization;Computer Vision;Data Association;Detection;Multiple Object Tracking},
doi={10.1109/ICIP.2016.7533003}
}