1、论文下载地址:
Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking. [paper]
2、 代码下载地址:
https://github.com/594422814/TransformerTrack
3、环境配置
因为TransformerTrack是基于pytracking来配置,所以我们直接使用已经配置好的pytracking的python环境。
pytracking的ubuntu版本配置:
pytracking系列跟踪算法的配置(LWL, KYS, PrDiMP, DiMP and ATOM Trackers)(Ubuntu版本)_博博有个大大大的Dream-CSDN博客_pytracking配置
pytracking的windows版本配置:
pytracking系列跟踪算法的配置(LWL, KYS, PrDiMP, DiMP and ATOM Trackers)(windows10版本)_博博有个大大大的Dream-CSDN博客
conda activate pytracking
4、配置预训练模型
github下载链接:https://github.com/594422814/TransformerTrack/releases/download/model/trdimp_net.pth.tar
百度云下载链接:链接:https://pan.baidu.com/s/1SY_qR0wri0Ep9DYY1vffBg
提取码:w4of
将下载后的模型放到路径pytracking/networks/
5、 打开pytracking/evaluation/local.py,配置参数
6、运行可视化服务器
conda activate pytracking
python -m visdom.server
7、运行代码
另外开一个终端运行
conda activate pytracking
python pytracking/run_tracker.py trdimp trdimp --dataset_name otb --sequence Soccer --debug 1 --threads 0
参数解释一下:trdimp是需要运行的跟踪器名字
trdimp是参数设置,在pytracking/parameter/trdimp路径下有很多参数可选。
otb是需要运行的数据集名称
Soccer是需要运行的视频序列名字
8、遇到错误1
raise Exception('Could not read file {}'.format(path))
Exception: Could not read file /data3/publicData/Datasets/OTB/OTB2015/BlurCar1/groundtruth_rect.txt
错误原因:
groundtruth_rect.txt格式与读取格式不对应
解决办法:
打开pytracking/utils/load_text.py更改函数:
def load_text_numpy(path, delimiter, dtype)
为如下:
def load_text_numpy(path, delimiter, dtype):
if isinstance(delimiter, (tuple, list)):
for d in delimiter:
try:
# ground_truth_rect = np.loadtxt(path, delimiter=d, dtype=dtype)
# to deal with different delimeters
import io
with open(path,'r') as f:
ground_truth_rect=np.loadtxt(io.StringIO(f.read().replace(',',' ')))
return ground_truth_rect
except:
pass
raise Exception('Could not read file {}'.format(path))
else:
ground_truth_rect = np.loadtxt(path, delimiter=delimiter, dtype=dtype)
return ground_truth_rect
9、遇到错误2
module 'torch' has no attribute 'floor_divide'
错误原因:
torch 1.6.0之后不再支持tensor A和整数n之间的直接除法,
result = A / n # not supported in torch 1.6.0
# solution
result = torch.floor_divide(A, n)
来源:【pytorch】RuntimeError: Integer division of tensors using div or / is no longer supported【解决】_木盏-CSDN博客
而我们的torch版本是1.4.0,还没有 floor_divide函数,所以我们将 floor_divide改为普通直接除法即可。
解决方法:
打开pytracking/features/preprocessing.py
将101/113/114行注释,100/111/112行取消注释
10、再次运行,成功。
在http://localhost:8097/地址可查看跟踪结果