1 创建环境
conda create -n deepocsort python=3.8
conda activate deepocsort
#根据cuda版本安装torch
pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html
2 (下载好源码后,在源码目录下)安装依赖项
cd external/YOLOX/
pip install -r requirements.txt && python setup.py develop
cd ../external/deep-person-reid/
pip install -r requirements.txt && python setup.py develop
#若报错:AttributeError: module 'distutils' has no attribute 'version'
# 则执行下两条指令,否则跳过
pip uninstall setuptools
pip install setuptools==58.0.4
cd ../external/fast_reid/
pip install -r docs/requirements.txt
3 预训练权重
在external下新建weights文件夹,下载权重后放到该目录下
Deep-OC-SORT/external/weights - Google 云端硬盘
4 数据集处理
在dataset.py更改数据集路径
5 测试
5.1 benchmark测试
# Flags to disable all the new changes
python3 main.py --exp_name $exp --post --emb_off --cmc_off --aw_off --new_kf_off --grid_off --dataset mot17
python3 main.py --exp_name $exp --post --emb_off --cmc_off --aw_off --new_kf_off --grid_off -dataset mot20 --track_thresh 0.4
python3 main.py --exp_name $exp --post --emb_off --cmc_off --aw_off --new_kf_off --grid_off --dataset dance --aspect_ratio_thresh 1000
5.2 mot17消融实验
# exp_name自定义名
# post线性插值后处理
# new_kf_off不使用新KF
# dataset 数据集
# aw_param aw自适应权重参数
python3 main.py --exp_name $exp --post --grid_off --new_kf_off --dataset mot17 --w_assoc_emb 0.75 --aw_param 0.5
python3 main.py --exp_name $exp --post --grid_off --new_kf_off --dataset mot20 --track_thresh 0.4 --w_assoc_emb 0.75 --aw_param 0.5
python3 main.py --exp_name $exp --post --grid_off --new_kf_off --dataset dance --aspect_ratio_thresh 1000 --w_assoc_emb 1.25 --aw_param 1
#如mot17消融:
python3 main.py --exp_name ablation_deepoc --post --dataset mot17 --w_assoc_emb 0.75 --aw_param 0.5
报错:AttributeError: module 'numpy' has no attribute 'int'.
解决:dtype=np.int
报错的情况,建议直接修改为np.int_
即可解决
参考:Bug小能手系列(python)_9: 使用sklearn库报错 module ‘numpy‘ has no attribute ‘int‘-优快云博客
结果:
5.3 获得HOTA结果
文件路径?
# benchmark参数可更改
python3 external/TrackEval/scripts/run_mot_challenge.py \
--SPLIT_TO_EVAL val \
--METRICS HOTA Identity CLEAR \
--TRACKERS_TO_EVAL ${exp}_post \
--GT_FOLDER results/gt/ \
--TRACKERS_FOLDER results/trackers/ \
--BENCHMARK MOT17
# 如对mot17消融结果的评估
python3 external/TrackEval/scripts/run_mot_challenge.py \
--SPLIT_TO_EVAL val \
--METRICS HOTA Identity CLEAR \
--TRACKERS_TO_EVAL ablation_deepoc_post \
--GT_FOLDER results/gt/ \
--TRACKERS_FOLDER results/trackers/ \
--BENCHMARK MOT17
结果: