{"id":15037738,"url":"https://github.com/zqpei/deep_sort_pytorch","last_synced_at":"2025-05-14T19:06:32.806Z","repository":{"id":37431979,"uuid":"150449550","full_name":"ZQPei/deep_sort_pytorch","owner":"ZQPei","description":"MOT using deepsort and yolov3 with pytorch ","archived":false,"fork":false,"pushed_at":"2024-07-16T04:40:59.000Z","size":29868,"stargazers_count":2899,"open_issues_count":124,"forks_count":726,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-11T06:17:53.993Z","etag":null,"topics":["cnn-model","deep-sort","deepsort","mot","mot-tracking","pytorch","sort","yolo3","yolov3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZQPei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-26T15:34:11.000Z","updated_at":"2025-04-10T13:47:44.000Z","dependencies_parsed_at":"2022-07-12T13:33:44.391Z","dependency_job_id":"c48c76b3-0fb5-4deb-89ef-4f2d9ab558f8","html_url":"https://github.com/ZQPei/deep_sort_pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZQPei%2Fdeep_sort_pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZQPei%2Fdeep_sort_pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZQPei%2Fdeep_sort_pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZQPei%2Fdeep_sort_pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZQPei","download_url":"https://codeload.github.com/ZQPei/deep_sort_pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351396,"owners_count":21089272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cnn-model","deep-sort","deepsort","mot","mot-tracking","pytorch","sort","yolo3","yolov3"],"created_at":"2024-09-24T20:35:29.565Z","updated_at":"2025-04-11T06:17:58.962Z","avatar_url":"https://github.com/ZQPei.png","language":"Python","readme":"# Deep Sort with PyTorch\n\n![](demo/demo.gif)\n\n## Update(1-1-2020)\nChanges\n- fix bugs\n- refactor code\n- accerate detection by adding nms on gpu\n\n## Update(07-22)\nChanges\n- bug fix (Thanks @JieChen91 and @yingsen1 for bug reporting).  \n- using batch for feature extracting for each frame, which lead to a small speed up.  \n- code improvement.\n\nFuther improvement direction  \n- Train detector on specific dataset rather than the official one.\n- Retrain REID model on pedestrain dataset for better performance.\n- Replace YOLOv3 detector with advanced ones.\n\n## Update(23-05-2024)\n\n### tracking \n\n- Added resnet network to the appearance feature extraction network in the deep folder\n\n- Fixed the NMS bug in the `preprocessing.py` and also fixed covariance calculation bug in the `kalmen_filter.py` in the sort folder\n\n### detecting\n\n- Added YOLOv5 detector, aligned interface, and added YOLOv5 related yaml configuration files. Codes references this repo: [YOLOv5-v6.1](https://github.com/ultralytics/yolov5/tree/v6.1).\n\n- The `train.py`, `val.py` and `detect.py` in the original YOLOv5 were deleted. This repo only need **yolov5x.pt**.\n\n### deepsort\n\n- Added tracking target category, which can display both category and tracking ID simultaneously.\n\n## Update(28-05-2024)\n\n### segmentation\n\n* Added Mask RCNN instance segmentation model. Codes references this repo: [mask_rcnn](https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/tree/master/pytorch_object_detection/mask_rcnn). Visual result saved in `demo/demo2.gif`.\n* Similar to YOLOv5, `train.py`, `validation.py` and `predict.py` were deleted. This repo only need **maskrcnn_resnet50_fpn_coco.pth**.\n\n### deepsort\n\n- Added tracking target mask, which can display both category, tracking ID and target mask simultaneously.\n\n## latest Update(09-06-2024)\n\n### feature extraction network\n\n* Using `nn.parallel.DistributedDataParallel` in PyTorch to support multiple GPUs training.\n* Added [GETTING_STARTED.md](deep_sort/deep/GETTING_STARTED.md) for better using `train.py` and `train_multiGPU.py`.\n\nUpdated `README.md` for previously updated content(#Update(23-05-2024) and #Update(28-05-2024)).\n\n**Any contributions to this repository is welcome!**\n\n\n## Introduction\nThis is an implement of MOT tracking algorithm deep sort. Deep sort is basicly the same with sort but added a CNN model to extract features in image of human part bounded by a detector. This CNN model is indeed a RE-ID model and the detector used in [PAPER](https://arxiv.org/abs/1703.07402) is FasterRCNN , and the original source code is [HERE](https://github.com/nwojke/deep_sort).  \nHowever in original code, the CNN model is implemented with tensorflow, which I'm not familier with. SO I re-implemented the CNN feature extraction model with PyTorch, and changed the CNN model a little bit. Also, I use **YOLOv3** to generate bboxes instead of FasterRCNN.\n\n## Dependencies\n- python 3 **(python2 not sure)**\n- numpy\n- scipy\n- opencv-python\n- sklearn\n- torch \u003e= 1.9\n- torchvision \u003e= 0.13\n- pillow\n- vizer\n- edict\n- matplotlib\n- pycocotools\n- tqdm\n\n## Quick Start\n0. Check all dependencies installed\n```bash\npip install -r requirements.txt\n```\nfor user in china, you can specify pypi source to accelerate install like:\n```bash\npip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple\n```\n\n1. Clone this repository\n```bash\ngit clone git@github.com:ZQPei/deep_sort_pytorch.git\n```\n\n2. Download detector parameters\n```bash\n# if you use YOLOv3 as detector in this repo\ncd detector/YOLOv3/weight/\nwget https://pjreddie.com/media/files/yolov3.weights\nwget https://pjreddie.com/media/files/yolov3-tiny.weights\ncd ../../../\n\n# if you use YOLOv5 as detector in this repo\ncd detector/YOLOv5\nwget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5s.pt\nor \nwget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5m.pt\ncd ../../\n\n# if you use Mask RCNN as detector in this repo\ncd detector/Mask_RCNN/save_weights\nwget https://download.pytorch.org/models/maskrcnn_resnet50_fpn_coco-bf2d0c1e.pth\ncd ../../../\n```\n\n3. Download deepsort feature extraction networks weight\n```bash\n# if you use original model in PAPER\ncd deep_sort/deep/checkpoint\n# download ckpt.t7 from\nhttps://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6 to this folder\ncd ../../../\n\n# if you use resnet18 in this repo\ncd deep_sort/deep/checkpoint\nwget https://download.pytorch.org/models/resnet18-5c106cde.pth\ncd ../../../\n```\n\n4. **(Optional)** Compile nms module if you use YOLOv3 as detetor in this repo\n```bash\ncd detector/YOLOv3/nms\nsh build.sh\ncd ../../..\n```\n\nNotice:\nIf compiling failed, the simplist way is to **Upgrade your pytorch \u003e= 1.1 and torchvision \u003e= 0.3\" and you can avoid the troublesome compiling problems which are most likely caused by either `gcc version too low` or `libraries missing`.\n\n5. **(Optional)** Prepare third party submodules\n\n[fast-reid](https://github.com/JDAI-CV/fast-reid)\n\nThis library supports bagtricks, AGW and other mainstream ReID methods through providing an fast-reid adapter.\n\nto prepare our bundled fast-reid, then follow instructions in its README to install it.\n\nPlease refer to `configs/fastreid.yaml` for a sample of using fast-reid. See [Model Zoo](https://github.com/JDAI-CV/fast-reid/blob/master/docs/MODEL_ZOO.md) for available methods and trained models.\n\n[MMDetection](https://github.com/open-mmlab/mmdetection)\n\nThis library supports Faster R-CNN and other mainstream detection methods through providing an MMDetection adapter.\n\nto prepare our bundled MMDetection, then follow instructions in its README to install it.\n\nPlease refer to `configs/mmdet.yaml` for a sample of using MMDetection. See [Model Zoo](https://github.com/open-mmlab/mmdetection/blob/master/docs/model_zoo.md) for available methods and trained models.\n\nRun\n\n```\ngit submodule update --init --recursive\n```\n\n\n6. Run demo\n```bash\nusage: deepsort.py [-h]\n                   [--fastreid]\n                   [--config_fastreid CONFIG_FASTREID]\n                   [--mmdet]\n                   [--config_mmdetection CONFIG_MMDETECTION]\n                   [--config_detection CONFIG_DETECTION]\n                   [--config_deepsort CONFIG_DEEPSORT] [--display]\n                   [--frame_interval FRAME_INTERVAL]\n                   [--display_width DISPLAY_WIDTH]\n                   [--display_height DISPLAY_HEIGHT] [--save_path SAVE_PATH]\n                   [--cpu] [--camera CAM]\n                   VIDEO_PATH         \n\n# yolov3 + deepsort\npython deepsort.py [VIDEO_PATH] --config_detection ./configs/yolov3.yaml\n\n# yolov3_tiny + deepsort\npython deepsort.py [VIDEO_PATH] --config_detection ./configs/yolov3_tiny.yaml\n\n# yolov3 + deepsort on webcam\npython3 deepsort.py /dev/video0 --camera 0\n\n# yolov3_tiny + deepsort on webcam\npython3 deepsort.py /dev/video0 --config_detection ./configs/yolov3_tiny.yaml --camera 0\n\n# yolov5s + deepsort\npython deepsort.py [VIDEO_PATH] --config_detection ./configs/yolov5s.yaml\n\n# yolov5m + deepsort\npython deepsort.py [VIDEO_PATH] --config_detection ./configs/yolov5m.yaml\n\n# mask_rcnn + deepsort\npython deepsort.py [VIDEO_PATH] --config_detection ./configs/mask_rcnn.yaml --segment\n\n# fast-reid + deepsort\npython deepsort.py [VIDEO_PATH] --fastreid [--config_fastreid ./configs/fastreid.yaml]\n\n# MMDetection + deepsort\npython deepsort.py [VIDEO_PATH] --mmdet [--config_mmdetection ./configs/mmdet.yaml]\n```\nUse `--display` to enable display image per frame.  \nResults will be saved to `./output/results.avi` and `./output/results.txt`.\n\nAll files above can also be accessed from BaiduDisk!  \nlinker：[BaiduDisk](https://pan.baidu.com/s/1YJ1iPpdFTlUyLFoonYvozg)\npasswd：fbuw\n\n## Training the RE-ID model\nCheck [GETTING_STARTED.md](deep_sort/deep/GETTING_STARTED.md) to start training progress using standard benchmark or **customized dataset**.\n\n## Demo videos and images\n[demo.avi](https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6)\n[demo2.avi](https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6)\n\n![1.jpg](demo/1.jpg)\n![2.jpg](demo/2.jpg)\n\n\n## References\n- paper: [Simple Online and Realtime Tracking with a Deep Association Metric](https://arxiv.org/abs/1703.07402)\n- code: [nwojke/deep_sort](https://github.com/nwojke/deep_sort)\n- paper: [YOLOv3: An Incremental Improvement](https://pjreddie.com/media/files/papers/YOLOv3.pdf)\n- code: [Joseph Redmon/yolov3](https://pjreddie.com/darknet/yolo/)\n- paper: [Mask R-CNN](https://arxiv.org/pdf/1703.06870)\n- code: [WZMIAOMIAO/Mask R-CNN](https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/tree/master/pytorch_object_detection/mask_rcnn)\n- paper: [YOLOv5](https://github.com/ultralytics/yolov5)\n- code: [ultralytics/yolov5](https://github.com/ultralytics/yolov5/tree/v6.1)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzqpei%2Fdeep_sort_pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzqpei%2Fdeep_sort_pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzqpei%2Fdeep_sort_pytorch/lists"}