基于YoloX目标检测+DeepSort算法实现多目标追踪Baseline

Overview

项目简介:

使用YOLOX+Deepsort实现车辆行人追踪和计数,代码封装成一个Detector类,更容易嵌入到自己的项目中。

代码地址(欢迎star):

https://github.com/Sharpiless/yolox-deepsort/

最终效果:

在这里插入图片描述

运行demo:

python demo.py

下载预训练模型:

Model size mAPtest
0.5:0.95
Speed V100
(ms)
Params
(M)
FLOPs
(G)
weights
YOLOX-s 640 39.6 9.8 9.0 26.8 onedrive/github
YOLOX-m 640 46.4 12.3 25.3 73.8 onedrive/github
YOLOX-l 640 50.0 14.5 54.2 155.6 onedrive/github
YOLOX-x 640 51.2 17.3 99.1 281.9 onedrive/github
YOLOX-Darknet53 640 47.4 11.1 63.7 185.3 onedrive/github

下载 yolox_s.pth 放到 weights 文件夹下

下载 https://github.com/Sharpiless/Yolov5-Deepsort/blob/main/deep_sort/deep_sort/deep/checkpoint/ckpt.t7 放到 deep_sort/deep_sort/deep/checkpoint 文件夹下

训练自己的模型:

训练好后放到 weights 文件夹下

调用接口:

创建检测器:

from AIDetector_pytorch import Detector

det = Detector()

调用检测接口:

result = det.feedCap(im)

其中 im 为 BGR 图像

返回的 result 是字典,result['frame'] 返回可视化后的图像

联系作者:

B站:https://space.bilibili.com/470550823

CSDN:https://blog.csdn.net/weixin_44936889

AI Studio:https://aistudio.baidu.com/aistudio/personalcenter/thirdview/67156

Github:https://github.com/Sharpiless

You might also like...
Comments
  • "/opt/module/yolox-deepsort/AIDetector_pytorch.py", line 107, in detect

    Traceback (most recent call last): File "demo.py", line 45, in main() File "demo.py", line 19, in main result = det.feedCap(im) File "/opt/module/yolox-deepsort/BaseDetector.py", line 33, in feedCap im, faces, face_bboxes = update_tracker(self, im) File "/opt/module/yolox-deepsort/tracker.py", line 40, in update_tracker _, bboxes = target_detector.detect(image) File "/opt/module/yolox-deepsort/AIDetector_pytorch.py", line 107, in detect boxes = outputs[:, 0:4] TypeError: 'NoneType' object is not subscriptable

    opened by lry789 0
  • TypeError: 'NoneType' object is not subscriptable

    TypeError: 'NoneType' object is not subscriptable

    Traceback (most recent call last): File "demo.py", line 50, in main() File "demo.py", line 24, in main result = det.feedCap(im) File "/home/shf/yolox2/BaseDetector.py", line 33, in feedCap im, faces, face_bboxes = update_tracker(self, im) File "/home/shf/yolox2/tracker.py", line 40, in update_tracker _, bboxes = target_detector.detect(image) File "/home/shf/yolox2/AIDetector_pytorch.py", line 107, in detect boxes = outputs[:, 0:4] TypeError: 'NoneType' object is not subscriptable

    opened by mthghshf 0
  • No such file or directory: 'deep_sort/deep_sort/deep/checkpoint/ckpt.t7'

    No such file or directory: 'deep_sort/deep_sort/deep/checkpoint/ckpt.t7'

    Traceback (most recent call last): File "D:/pythonProject3/yolox-deepsort-main/demo.py", line 1, in from AIDetector_pytorch import Detector File "D:\pythonProject3\yolox-deepsort-main\AIDetector_pytorch.py", line 6, in from BaseDetector import baseDet File "D:\pythonProject3\yolox-deepsort-main\BaseDetector.py", line 1, in from tracker import update_tracker File "D:\pythonProject3\yolox-deepsort-main\tracker.py", line 9, in deepsort = DeepSort(cfg.DEEPSORT.REID_CKPT, File "D:\pythonProject3\yolox-deepsort-main\deep_sort\deep_sort\deep_sort.py", line 19, in init self.extractor = Extractor(model_path, use_cuda=use_cuda) File "D:\pythonProject3\yolox-deepsort-main\deep_sort\deep_sort\deep\feature_extractor.py", line 13, in init state_dict = torch.load(model_path, map_location=lambda storage, loc: storage)['net_dict'] File "D:\Develop\python\Anaconda3\envs\Pychramproject2\lib\site-packages\torch\serialization.py", line 581, in load with _open_file_like(f, 'rb') as opened_file: File "D:\Develop\python\Anaconda3\envs\Pychramproject2\lib\site-packages\torch\serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "D:\Develop\python\Anaconda3\envs\Pychramproject2\lib\site-packages\torch\serialization.py", line 211, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'deep_sort/deep_sort/deep/checkpoint/ckpt.t7'

    进程已结束,退出代码为 1

    opened by EchoYGemini 1
  • TypeError: 'NoneType' object is not subscriptable

    TypeError: 'NoneType' object is not subscriptable

    File "demo.py", line 52, in main() File "demo.py", line 26, in main result = det.feedCap(im) File "D:\vehicleCount\yolox_deepsort_reply\yolox-deepsort-main\BaseDetector.py", line 33, in feedCap im, faces, face_bboxes = update_tracker(self, im) File "D:\vehicleCount\yolox_deepsort_reply\yolox-deepsort-main\tracker.py", line 40, in update_tracker _, bboxes = target_detector.detect(image) File "D:\vehicleCount\yolox_deepsort_reply\yolox-deepsort-main\AIDetector_pytorch.py", line 109, in detect boxes1 = outputs[:, 0:4] TypeError: 'NoneType' object is not subscriptable

    opened by charmin161 0
Owner
BIT可达鸭
null