Configuration of ICCV2021 tracking algorithm Stark (Learning Spatio-Temporal Transformer for Visual Tracking)

 1. Paper download

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

2. Code download

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

3. Environment configuration

Because TransformerTrack is configured based on pytracking, we directly use the already configured python environment of pytracking.

Ubuntu version configuration of pytracking:

Configuration of pytracking series tracking algorithms (LWL, KYS, PrDiMP, DiMP and ATOM Trackers) (Ubuntu version)_Bobo has a big Dream-CSDN blog_pytracking configuration

Windows version configuration of pytracking:

Configuration of pytracking series tracking algorithms (LWL, KYS, PrDiMP, DiMP and ATOM Trackers) (windows10 version)_Bobo has a big Dream-CSDN blog

conda activate pytracking

4. Install additional libraries 

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

5. Configure the pre-trained model

Pre-trained model, Google drive download address

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

Pre-trained model Baidu Cloud download address:

Link: https://pan.baidu.com/s/1Mug2JX8v0r4XppsqRLvxKQ 
Extraction code: 9f6a 

Create a new checkpoints/train/stark_st2/ path in the project, and then place the downloaded pre-trained model in it

6. Set the configuration path

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

After running, the following two files will be generated

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

Set the test configuration file: lib/test/evaluation/local.py

 Finally, don’t forget to remove escape character paths like \t.

7. Run the test

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

Indicates selecting the baseline pre-training model and testing the Soccer video sequence on the OTB data set.

The results are saved in the following path:

 8. You may encounter errors:

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

wrong reason:

The groundtruth_rect.txt format does not correspond to the reading format

Solution:

Open lib/test/utils/load_text.py and change the function:

def load_text_numpy(path, delimiter, dtype)

As follows:

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

Guess you like

Origin blog.csdn.net/qq_17783559/article/details/121218275