0.环境
ubuntu16.04
cuda9.0
python3.6
torch==1.1.0
torchvision==0.3.0
Cython #(install first)
yacs
opencv-python
cython-bbox
scipy
numba
progress
motmetrics
numba
matplotlib
lap
openpyxl
Pillow==6.2.2
tensorboardX
torch与torchvision在上面的链接中下载。
apt-get install libbz2-dev
apt update && apt install -y libsm6 libxext6
apt-get install libxrender1
pip --default-time=500 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch-1.1.0-cp36-cp36m-linux_x86_64.whl
pip --default-time=500 install -i https://pypi.tuna.tsinghua.edu.cn/simple torchvision-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
pip --default-time=500 install -i https://pypi.tuna.tsinghua.edu.cn/simple Cython
pip --default-time=500 install -i https://pypi.tuna.tsinghua.edu.cn/simple llvmlite==0.31.0
pip --default-time=500 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
cd src/lib/models/networks/DCNv2_new
sh make.sh
1.下载
将下载的模型复制到指定的目录下。
2.demo.py
运行demo.py GPU>=1159MiB ,就够了。TITAN xp上测试1500帧大概花费时间221s,所以平均一帧花费147ms。
cd src
python demo.py mot --load_model ../models/all_dla34.pth --conf_thres 0.4
#指定GPU
CUDA_VISIBLE_DEVICES=1 python demo.py mot --load_model ../models/all_dla34.pth --conf_thres 0.4
自己下载的话,需要复制到对应的路径下。
cp dla34-ba72cf86.pth /root/.cache/torch/checkpoints/
运行成功后,终端显示:
结果都保存在result文件夹下。
需要安装ffmpeg才会生成result.mp4,Ubuntu安装ffmpeg,请参考https://blog.csdn.net/lwgkzl/article/details/77836207。安装后,再次运行终端会输出显示:
好吧,我发现这个方法,在行人之间有大面积重合时,ID也会切换即跟丢了(难点啊难点)。
参考