FairMot代码复现及测试

1、源码地址

https://github.com/ifzhang/FairMOThttps://github.com/ifzhang/FairMOT有注释的代码地址:

GitHub - chenjun2hao/FairMOT: A simple baseline for one-shot multi-object trackinghttps://github.com/chenjun2hao/FairMOT

2、 环境准备

(1)conda install pytorch==1.7.1 torchvision==0.8.2 -c pytorch

(2)cuda非root用户安装,driver不安装

./cuda_10.2.89_440.33.01_linux.run --toolkit --toolkitpath=/home/xxx/cuda10.2 --defaultroot=/home/xxx/cuda10.2

(3)cuda环境变量配置,/home目录下

vi ~/.bashrc

# 在文件末尾添加
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/xxx/cuda10.2/lib64
export PATH=$PATH:/home/xxx/cuda10.2/bin:/home/xxx/cuda10.2/bin
export CUDA_HOME=/home/xxx/cuda10.2

# 使其生效
source ~/.bashrc

(4)验证:在终端输入nvcc -V 查看是否可以正常输出信息

3、依赖库安装

cd ${FAIRMOT_ROOT}

pip install cython

pip install -r requirements.txt

4、DCNv2编译(编译前需要安装好cuda)

GitHub - lbin/DCNv2 at pytorch_1.7icon-default.png?t=M85Bhttps://github.com/lbin/DCNv2/tree/pytorch_1.7cd DCNv2

rm -rf build  #删除build文件夹

python setup.py build develop

 5、ffmpeg安装

conda install ffmpeg

pip install ffmpy

6、代码测试(新建models文件夹,模板在源码中有链接)

 python demo.py mot --load_model ../models/fairmot_dla34.pth --conf_thres 0.4

7、遇到的问题汇总

(1)ModuleNotFoundError: No module named 'motmetrics'

pip install motmetrics

(2)ModuleNotFoundError: No module named 'cv2'

pip install opencv-python

(3)ModuleNotFoundError: No module named 'cython_bbox' 

 pip install cython_bbox

(4)RuntimeError: Not compiled with GPU support

未安装cuda,安装cuda并设置环境变量后,重新编译DCNv2即可解决

(5)版本对应参考

FairMot代码复现及测试_第1张图片 

 

你可能感兴趣的:(计算机视觉学习笔记,python,pytorch,深度学习)