ByteTrack(Multi-Object Tracking by Associating Every Detection Box)のPythonでのONNX推論サンプル

Overview

ByteTrack-ONNX-Sample

ByteTrack(Multi-Object Tracking by Associating Every Detection Box)のPythonでのONNX推論サンプルです。
ONNXに変換したモデルも同梱しています。
変換自体を試したい方はByteTrack_Convert2ONNX.ipynbを使用ください。
ByteTrack_Convert2ONNX.ipynbはColaboratory上での実行を想定しています。
書き動画はWindowsでの実行例です。

sample_.mp4

Requirement

opencv-python 4.5.3.56 or later
onnx 1.9.0 or later
onnxruntime-gpu 1.9.0 or later
Cython 0.29.24 or later
torch 1.8.1 or later
torchvision 0.9.1 or later
pycocotools 2.0.2 or later
scipy 1.6.3 or later
loguru 0.5.3 or later
thop 0.0.31.post2005241907 or later
lap 0.4.0 or later
cython_bbox 0.1.3 or later

※onnxruntime-gpuはonnxruntimeでも動作しますが、推論時間がかかるためGPUを推奨します
※Windowsでcython_bbox のインストールが失敗する場合は、GitHubからのインストールをお試しください(2021/11/19時点)
pip install -e git+https://github.com/samson-wang/cython_bbox.git#egg=cython-bbox

Demo

デモの実行方法は以下です。

動画:動画に対しByteTrackで追跡した結果を動画出力します

python demo_video_onnx.py
実行時オプション
  • --use_debug_window
    動画書き込み時に書き込みフレームをGUI表示するか否か
    デフォルト:指定なし
  • --model
    ByteTrackのONNXモデル格納パス
    デフォルト:byte_tracker/model/bytetrack_s.onnx
  • --video
    入力動画の格納パス
    デフォルト:sample.mp4
  • --output_dir
    動画出力パス
    デフォルト:output
  • --score_th
    人検出のスコア閾値
    デフォルト:0.1
  • --score_th
    人検出のNMS閾値
    デフォルト:0.7
  • --input_shape
    推論時入力サイズ
    デフォルト:608,1088
  • --with_p6
    YOLOXモデルのFPN/PANでp6を含むか否か
    デフォルト:指定なし
  • --track_thresh
    追跡時のスコア閾値
    デフォルト:0.5
  • --track_buffer
    見失い時に何フレームの間、追跡対象を保持するか
    デフォルト:30
  • --match_thresh
    追跡時のマッチングスコア閾値
    デフォルト:0.8
  • --min-box-area
    最小のバウンディングボックスのサイズ閾値
    デフォルト:10
  • --mot20
    MOT20を使用しているか否か
    デフォルト:指定なし

Webカメラ:Webカメラ画像に対しByteTrackで追跡した結果をGUI表示します

python demo_webcam_onnx.py
実行時オプション
  • --model
    ByteTrackのONNXモデル格納パス
    デフォルト:byte_tracker/model/bytetrack_s.onnx
  • --device
    カメラデバイス番号の指定
    デフォルト:0
  • --width
    カメラキャプチャ時の横幅
    デフォルト:960
  • --height
    カメラキャプチャ時の縦幅
    デフォルト:540
  • --score_th
    人検出のスコア閾値
    デフォルト:0.1
  • --score_th
    人検出のNMS閾値
    デフォルト:0.7
  • --input_shape
    推論時入力サイズ
    デフォルト:608,1088
  • --with_p6
    YOLOXモデルのFPN/PANでp6を含むか否か
    デフォルト:指定なし
  • --track_thresh
    追跡時のスコア閾値
    デフォルト:0.5
  • --track_buffer
    見失い時に何フレームの間、追跡対象を保持するか
    デフォルト:30
  • --match_thresh
    追跡時のマッチングスコア閾値
    デフォルト:0.8
  • --min-box-area
    最小のバウンディングボックスのサイズ閾値
    デフォルト:10
  • --mot20
    MOT20を使用しているか否か
    デフォルト:指定なし

Reference

Author

高橋かずひと(https://twitter.com/KzhtTkhs)

License

ByteTrack-ONNX-Sample is under MIT License.

License(Movie)

サンプル動画はNHKクリエイティブ・ライブラリーイギリス ウースターのエルガー像を使用しています。

Owner
KazuhitoTakahashi
KazuhitoTakahashi
Hyperparameters tuning and features selection are two common steps in every machine learning pipeline.

shap-hypetune A python package for simultaneous Hyperparameters Tuning and Features Selection for Gradient Boosting Models. Overview Hyperparameters t

Marco Cerliani 422 Jan 08, 2023
Jittor Medical Segmentation Lib -- The assignment of Pattern Recognition course (2021 Spring) in Tsinghua University

THU模式识别2021春 -- Jittor 医学图像分割 模型列表 本仓库收录了课程作业中同学们采用jittor框架实现的如下模型: UNet SegNet DeepLab V2 DANet EANet HarDNet及其改动HarDNet_alter PSPNet OCNet OCRNet DL

48 Dec 26, 2022
Distilling Motion Planner Augmented Policies into Visual Control Policies for Robot Manipulation (CoRL 2021)

Distilling Motion Planner Augmented Policies into Visual Control Policies for Robot Manipulation [Project website] [Paper] This project is a PyTorch i

Cognitive Learning for Vision and Robotics (CLVR) lab @ USC 6 Feb 28, 2022
Simple and understandable swin-transformer OCR project

swin-transformer-ocr ocr with swin-transformer Overview Simple and understandable swin-transformer OCR project. The model in this repository heavily r

Ha YongWook 67 Dec 31, 2022
NumQMBasic - A mini-course offered to Undergrad physics students

The best way to use this material is by forking it by click the Fork button at the top, right corner. Then you will get your own copy to play with! Th

Raghu 35 Dec 05, 2022
Learning infinite-resolution image processing with GAN and RL from unpaired image datasets, using a differentiable photo editing model.

Exposure: A White-Box Photo Post-Processing Framework ACM Transactions on Graphics (presented at SIGGRAPH 2018) Yuanming Hu1,2, Hao He1,2, Chenxi Xu1,

Yuanming Hu 719 Dec 29, 2022
This provides the R code and data to replicate results in "The USS Trustee’s risky strategy"

USSBriefs2021 This provides the R code and data to replicate results in "The USS Trustee’s risky strategy" by Neil M Davies, Jackie Grant and Chin Yan

1 Oct 30, 2021
🚀 An end-to-end ML applications using PyTorch, W&B, FastAPI, Docker, Streamlit and Heroku

🚀 An end-to-end ML applications using PyTorch, W&B, FastAPI, Docker, Streamlit and Heroku

Made With ML 82 Jun 26, 2022
A light-weight image labelling tool for Python designed for creating segmentation data sets.

An image labelling tool for creating segmentation data sets, for Django and Flask.

117 Nov 21, 2022
Location-Sensitive Visual Recognition with Cross-IOU Loss

The trained models are temporarily unavailable, but you can train the code using reasonable computational resource. Location-Sensitive Visual Recognit

Kaiwen Duan 146 Dec 25, 2022
PyTorch code for 'Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning'

Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning This repository is for EMSRDPN introduced in the foll

7 Feb 10, 2022
NeuroLKH: Combining Deep Learning Model with Lin-Kernighan-Helsgaun Heuristic for Solving the Traveling Salesman Problem

NeuroLKH: Combining Deep Learning Model with Lin-Kernighan-Helsgaun Heuristic for Solving the Traveling Salesman Problem Liang Xin, Wen Song, Zhiguang

xinliangedu 33 Dec 27, 2022
Learned Initializations for Optimizing Coordinate-Based Neural Representations

Learned Initializations for Optimizing Coordinate-Based Neural Representations Project Page | Paper Matthew Tancik*1, Ben Mildenhall*1, Terrance Wang1

Matthew Tancik 127 Jan 03, 2023
A computational optimization project towards the goal of gerrymandering the results of a hypothetical election in the UK.

A computational optimization project towards the goal of gerrymandering the results of a hypothetical election in the UK.

Emma 1 Jan 18, 2022
UltraGCN: An Ultra Simplification of Graph Convolutional Networks for Recommendation

UltraGCN This is our Pytorch implementation for our CIKM 2021 paper: Kelong Mao, Jieming Zhu, Xi Xiao, Biao Lu, Zhaowei Wang, Xiuqiang He. UltraGCN: A

XUEPAI 93 Jan 03, 2023
Pyramid R-CNN: Towards Better Performance and Adaptability for 3D Object Detection

Pyramid R-CNN: Towards Better Performance and Adaptability for 3D Object Detection

61 Jan 07, 2023
WORD: Revisiting Organs Segmentation in the Whole Abdominal Region

WORD: Revisiting Organs Segmentation in the Whole Abdominal Region (Paper and DataSet). [New] Note that all the emails about the download permission o

Healthcare Intelligence Laboratory 71 Dec 22, 2022
Athena is the only tool that you will ever need to optimize your portfolio.

Athena Portfolio optimization is the process of selecting the best portfolio (asset distribution), out of the set of all portfolios being considered,

Indrajit 1 Mar 25, 2022
Implementation of Hire-MLP: Vision MLP via Hierarchical Rearrangement and An Image Patch is a Wave: Phase-Aware Vision MLP.

Hire-Wave-MLP.pytorch Implementation of Hire-MLP: Vision MLP via Hierarchical Rearrangement and An Image Patch is a Wave: Phase-Aware Vision MLP Resul

Nevermore 29 Oct 28, 2022
Sleep staging from ECG, assisted with EEG

Sleep_Staging_Knowledge Distillation This codebase implements knowledge distillation approach for ECG based sleep staging assisted by EEG based sleep

2 Dec 12, 2022