ICCV2021跟踪算法Stark的配置(Learning Spatio-Temporal Transformer for Visual Tracking)

 1、论文下载

Learning Spatio-Temporal Transformer for Visual Tracking. ICCV (2021). [paper

2、代码下载

GitHub - researchmm/Stark: [ICCV'21] Learning Spatio-Temporal Transformer for Visual Tracking

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、安装额外的库 

pip install lmdb
pip install timm
pip install pyyaml
pip install yacs
pip install easydict

5、配置预训练模型

预训练模型,Googledrive下载地址

Stark/MODEL_ZOO.md at main · researchmm/Stark · GitHub

预训练模型百度云下载地址:

链接:https://pan.baidu.com/s/1Mug2JX8v0r4XppsqRLvxKQ 
提取码:9f6a 

在工程中新建checkpoints/train/stark_st2/路径,然后将下载的预训练模型放到里面

6、设置配置路径

python tracking/create_default_local_file.py --workspace_dir . --data_dir ./data --save_dir .

运行之后会生成如下两个文件

lib/train/admin/local.py  # 训练的配置文件
lib/test/evaluation/local.py  # 测试的配置文件

设置测试配置文件:lib/test/evaluation/local.py

 最后不要忘记把\t这样的转义字符路径去掉。

7、运行测试

python tracking/test.py stark_st baseline --dataset otb --sequence Soccer --num_gpus 1

表示选择baseline预训练模型,在OTB数据集上,测试Soccer视频序列

结果保存在如下路径:

 8、可能遇到错误:

Exception: Could not read file G:\datasets\OTB\OTB2015/BlurCar1/groundtruth_rect.txt

错误原因:

groundtruth_rect.txt格式与读取格式不对应

解决办法:

打开lib/test/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

猜你喜欢

转载自blog.csdn.net/qq_17783559/article/details/121218275