复现FairMot踩坑记录

(1)打开官方的网站:

GitHub - ifzhang/FairMOT: [IJCV-2021] FairMOT: On the Fairness of Detection and Re-Identification in Multi-Object Trackinghttps://github.com/ifzhang/FairMOT(2)然后下载代码到本地

(3)打开vscode 读取文件

(4)创建环境

conda create -n FairMOT
conda activate FairMOT
conda install pytorch==1.7.0 torchvision==0.8.0 cudatoolkit=10.2 -c pytorch
cd ${FAIRMOT_ROOT}
pip install cython
pip install -r requirements.txt
git clone -b pytorch_1.7 https://github.com/ifzhang/DCNv2.git
cd DCNv2
./make.sh

 问题1: 

ERROR: Command errored out with exit status 1:
   command: /home/se8502/anaconda3/envs/fairmot/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-loqfqgxu/lap_27d2b6fda8f14025af34865b05f8ff1c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-loqfqgxu/lap_27d2b6fda8f14025af34865b05f8ff1c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-bqxx55fu

解決:

sudo apt update
sudo apt install build-essential

安装ffmpeg

打开终端

输入:

sudo apt update

sudo apt install ffmpeg

ffmpeg -version

输出应如下所示:

ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)

(5)下载模型

创建一个文件夹叫models

放入模型文件

(6)测试

cd src
python demo.py mot --load_model ../models/fairmot_dla34.pth --conf_thres 0.4
 
#指定GPU 因为我只有一个gpu所以是0 作者说 --conf_thres 可以设置为 0.3 到 0.7,具体取决于您自己的视频。
CUDA_VISIBLE_DEVICES=0 python demo.py mot --load_model ../models/fairmot_dla34.pth --conf_thres 0.4

在文件夹demos里面可以看到结果

结束

猜你喜欢

转载自blog.csdn.net/qwazp3526cn/article/details/121527060