跑通ByteTrack_Yolovx(跑不通你来揍我)

跑通ByteTrack_Yolovx(跑不通你来揍我)

 

🔱下载 ByteTrack Github 资源

🔱修改代码

🔱安装要求 

⚠如果您要在GPU中运行Bytetrack,请执行以下步骤。⚠ 

 🔱两个代码的两端对齐

 📍yolox/data/data_auguments.py

 📍工具/demo_track.py 

🔱bytetrack的Downloas预训练文件 

 🔱Test视频文件


onnxruntime

🔱下载 ByteTrack Github 资源

🔗 GitHub - ifzhang/ByteTrack: [ECCV 2022] ByteTrack: Multi-Object Tracking by Associating Every Detection Box 转存失败重新上传取消

or

git clone https://github.com/ifzhang/ByteTrack.git

🔱修改代码

set.py 近50条线路

只需在“r”后面添加编码='utf-8'即可。

  然后在提示符中输入以下内容

python setup.py develop

完成后,情况就是这样。

🔱安装要求 

pip install cython
pip install -e git+https://github.com/samson-wang/cython_bbox.git#egg=cython-bbox
pip install pycocotools
pip install -r requirements.txt

⚠如果您要在GPU中运行Bytetrack,请执行以下步骤。⚠ 

访问官方 Pytorch 以获取 cmd 来安装 CUDA 的 pytorch。 

🔗 

nvidia-smi

PS.如果您确定CUDA版本,则可以在此cmd中进行检查。

 🔱两个代码的两端对齐

 📍yolox/data/data_auguments.py

找到要替换的预程序函数,如下所示。

    def preproc(img, input_size, swap=(2, 0, 1)):
        if len(img.shape) == 3:
            padded_img = np.ones((input_size[0], input_size[1], 3), dtype=np.uint8) * 114
        else:
            padded_img = np.ones(input_size, dtype=np.uint8) * 114

        r = min(input_size[0] / img.shape[0], input_size[1] / img.shape[1])
        resized_img = cv2.resize(
            img,
            (int(img.shape[1] * r), int(img.shape[0] * r)),
            interpolation=cv2.INTER_LINEAR,
        ).astype(np.uint8)
        padded_img[: int(img.shape[0] * r), : int(img.shape[1] * r)] = resized_img

        padded_img = padded_img.transpose(swap)
        padded_img = np.ascontiguousarray(padded_img, dtype=np.float32)
        return padded_img, r

 📍工具/demo_track.py 

删除“self.rgb_means,self.std”

🔱bytetrack的Downloas预训练文件 

使用在 CrowdHuman、MOT17、Cityperson 和 ETHZ 上训练的模型, 下载地址如下表,表中指标在MOT17训练集上测试得到。

ModelIDsFPS
bytetrack_x_mot17 [google][baidu(code:ic0i)]90.0
83.3
42229.6
bytetrack_l_mot17 [google][baidu(code:1cml)]
88.7
80.7460       43.7       
bytetrack_m_mot17 [google][baidu(code:u3m4)]87.0        80.1        47754.1
bytetrack_s_mot17 [google][baidu(code:qflm)]79.274.353364.5

本文以最轻量的s版本为例,下载bytetrack_s_mot17.pth.tar文件,下载后在项目的根目录下新建models文件夹并将该文件放入其中。 

 🔱Test视频文件

代码:

python tools/demo_track.py video -f exps/example/mot/yolox_s_mix_det.py -c ./models/bytetrack_s_mot17.pth.tar --path ./videos/palace.mp4 --fp16 --fuse --save_result

其中部分选项符的含义如下。

  • demo:任务类型,必选项,可选image、video和webcam
  • -f:模型配置文件
  • -c:模型文件
  • --path:需要进行推理的文件路径
  • --save_result:是否保存推理结果

        推理过程中会出现如下的日志,并在当前目录下生成YOLOX_outputs目录,推理生成的跟踪结果就在其中。 

 生成视频演示: 

在这里插入图片描述

完毕!

如果大家觉得有帮助的话!麻烦点赞+收藏喔,谢谢大家!

  • 13
    点赞
  • 89
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 20
    评论
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大气层煮月亮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值