【目标跟踪】|stark配置 win otb

数据集路径生成

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

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

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

直接运行test 会报错 原因是路径问题,在local中所有路径前面加上r即可。

    raise RuntimeError('YOU HAVE NOT SETUP YOUR local.py!!!\n Go to "{}" and set all the paths you need. '
RuntimeError: YOU HAVE NOT SETUP YOUR local.py!!!

【目标跟踪】|stark配置 win otb_第1张图片

更改准备测试的数据集路径

如果不行更改environment.py 中绝对路径

预权重配置

在工程中新建checkpoints/train/stark_st2/路径,然后将下载的预训练模型放到里面
【目标跟踪】|stark配置 win otb_第2张图片

运行测试

测试otb
修改test.py 中的参数

def main():
    #parser = argparse.ArgumentParser(description='Run tracker on sequence or dataset.')
    parser = argparse.ArgumentParser()
    parser.add_argument('--tracker_name', type=str,default='stark_s', help='Name of tracking method.')
    parser.add_argument('--tracker_param', type=str, default='baseline',help='Name of config file.')
    parser.add_argument('--runid', type=int, default=None, help='The run id.')
    parser.add_argument('--dataset_name', type=str, default='otb', help='Name of dataset (otb, nfs, uav, tpl, vot, tn, gott, gotv, lasot).')
    parser.add_argument('--sequence', type=str, default=None, help='Sequence number or name.')
    parser.add_argument('--debug', type=int, default=0, help='Debug level.')
    parser.add_argument('--threads', type=int, default=0, help='Number of threads.')
    parser.add_argument('--num_gpus', type=int, default=1)

    args = parser.parse_args()
    args.tracker_name='stark_st'
    args.tracker_param='baseline'
    args.dataset_name='otb'
    args.sequence='Jump'
    
    
    try:
        seq_name = int(args.sequence)
    except:
        seq_name = args.sequence

    run_tracker(args.tracker_name, args.tracker_param, args.runid, args.dataset_name, seq_name, args.debug,
                args.threads, num_gpus=args.num_gpus)


if __name__ == '__main__':
    main()


Tracker: stark_s baseline None ,  Sequence: Jump
test config:  {'MODEL': {'HEAD_TYPE': 'CORNER', 'HIDDEN_DIM': 256, 'NUM_OBJECT_QUERIES': 1, 'POSITION_EMBEDDING': 'sine', 'PREDICT_MASK': False, 'BACKBONE': {'TYPE': 'resnet50', 'OUTPUT_LAYERS': ['layer3'], 'DILATION': False}, 'TRANSFORMER': {'NHEADS': 8, 'DROPOUT': 0.1, 'DIM_FEEDFORWARD': 2048, 'ENC_LAYERS': 6, 'DEC_LAYERS': 6, 'PRE_NORM': False, 'DIVIDE_NORM': False}}, 'TRAIN': {'LR': 0.0001, 'WEIGHT_DECAY': 0.0001, 'EPOCH': 500, 'LR_DROP_EPOCH': 400, 'BATCH_SIZE': 16, 'NUM_WORKER': 8, 'OPTIMIZER': 'ADAMW', 'BACKBONE_MULTIPLIER': 0.1, 'GIOU_WEIGHT': 2.0, 'L1_WEIGHT': 5.0, 'DEEP_SUPERVISION': False, 'FREEZE_BACKBONE_BN': True, 'FREEZE_LAYERS': ['conv1', 'layer1'], 'PRINT_INTERVAL': 50, 'VAL_EPOCH_INTERVAL': 20, 'GRAD_CLIP_NORM': 0.1, 'SCHEDULER': {'TYPE': 'step', 'DECAY_RATE': 0.1}}, 'DATA': {'MEAN': [0.485, 0.456, 0.406], 'STD': [0.229, 0.224, 0.225], 'MAX_SAMPLE_INTERVAL': 200, 'TRAIN': {'DATASETS_NAME': ['LASOT', 'GOT10K_vottrain', 'COCO17', 'TRACKINGNET'], 'DATASETS_RATIO': [1, 1, 1, 1], 'SAMPLE_PER_EPOCH': 60000}, 'VAL': {'DATASETS_NAME': ['GOT10K_votval'], 'DATASETS_RATIO': [1], 'SAMPLE_PER_EPOCH': 10000}, 'SEARCH': {'SIZE': 320, 'FACTOR': 5.0, 'CENTER_JITTER': 4.5, 'SCALE_JITTER': 0.5}, 'TEMPLATE': {'SIZE': 128, 'FACTOR': 2.0, 'CENTER_JITTER': 0, 'SCALE_JITTER': 0}}, 'TEST': {'TEMPLATE_FACTOR': 2.0, 'TEMPLATE_SIZE': 128, 'SEARCH_FACTOR': 5.0, 'SEARCH_SIZE': 320, 'EPOCH': 500}}
head channel: 256
FPS: 46.0861924816578
create tracking result dir: C:\D\code\object_track\strark2\test/tracking_results/stark_s/baseline
Done

注意, 当再次运行时,需要将上次结果删除,否则无法运行

分析测试结果

analysis_results.py

  File "C:\D\anaconda\lib\site-packages\matplotlib\texmanager.py", line 256, in _run_checked_subprocess
    raise RuntimeError(
RuntimeError: Failed to process string with tex because latex could not be found

没有latex字体

在lib/test/analysis/plot_results.py line 103

    plt.rcParams['text.usetex']=False## False
import _init_paths
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = [8, 8]

from lib.test.analysis.plot_results import plot_results, print_results, print_per_sequence_results
from lib.test.evaluation import get_dataset, trackerlist

trackers = []
dataset_name = 'otb2015'
"""stark"""
trackers.extend(trackerlist(name='stark_s', parameter_name='baseline', dataset_name=dataset_name,
                            run_ids=None, display_name='STARK-S50'))
trackers.extend(trackerlist(name='stark_st', parameter_name='baseline', dataset_name=dataset_name,
                            run_ids=None, display_name='STARK-ST50'))
# trackers.extend(trackerlist(name='stark_st', parameter_name='baseline_R101', dataset_name=dataset_name,
#                             run_ids=None, display_name='STARK-ST101'))
"""TransT"""
# trackers.extend(trackerlist(name='TransT_N2', parameter_name=None, dataset_name=None,
#                             run_ids=None, display_name='TransT_N2', result_only=True))
# trackers.extend(trackerlist(name='TransT_N4', parameter_name=None, dataset_name=None,
#                             run_ids=None, display_name='TransT_N4', result_only=True))
"""pytracking"""
# trackers.extend(trackerlist('atom', 'default', None, range(0,5), 'ATOM'))
# trackers.extend(trackerlist('dimp', 'dimp18', None, range(0,5), 'DiMP18'))
# trackers.extend(trackerlist('dimp', 'dimp50', None, range(0,5), 'DiMP50'))
# trackers.extend(trackerlist('dimp', 'prdimp18', None, range(0,5), 'PrDiMP18'))
# trackers.extend(trackerlist('dimp', 'prdimp50', None, range(0,5), 'PrDiMP50'))

# dataset = get_dataset(dataset_name)
#dataset = get_dataset('otb', 'nfs', 'uav', 'tc128ce')
dataset = get_dataset('otb')
plot_results(trackers, dataset, 'OTB2015', merge_results=False, plot_types=('success', 'norm_prec'),
              skip_missing_seq=True, force_evaluation=True, plot_bin_gap=0.05)
print_results(trackers, dataset, dataset_name, merge_results=False, plot_types=('success', 'prec'))
# print_results(trackers, dataset, 'UNO', merge_results=True, plot_types=('success', 'prec'))

STARK_Lightning 配置

权重
【目标跟踪】|stark配置 win otb_第3张图片

不使用onnx时,lib/test/tracker/stark_lightning_X_trt.py中设置 use_onnx = False
参数设置

    args.tracker_name='stark_lightning_X_trt'##'stark_lightning_X_trt'
    args.tracker_param='baseline_rephead_4_lite_search5'#'' #  baseline
    args.dataset_name='otb'
    args.sequence='Jump'

生成onnx
python tracking/ORT_lightning_X_trt_backbone_bottleneck_pe.py # for the template branch
python tracking/ORT_lightning_X_trt_complete.py # for the search region branch

配置LaSOT数据集

设置好路径
更改参数即可

train

[train: 49, 50 / 937] FPS: 83.4 (122.3)  ,  cls_loss: 0.30591
[train: 49, 50 / 937] FPS: 83.3 (122.5)  ,  cls_loss: 0.29341
[train: 49, 50 / 937] FPS: 83.2 (122.2)  ,  cls_loss: 0.27001
[train: 49, 50 / 937] FPS: 83.4 (121.7)  ,  cls_loss: 0.28869
[train: 49, 100 / 937] FPS: 94.2 (126.0)  ,  cls_loss: 0.26311
[train: 49, 100 / 937] FPS: 94.4 (126.0)  ,  cls_loss: 0.31833
[train: 49, 100 / 937] FPS: 94.3 (125.7)  ,  cls_loss: 0.33061
[train: 49, 100 / 937] FPS: 94.3 (125.8)  ,  cls_loss: 0.28253
[train: 49, 150 / 937] FPS: 97.4 (122.6)  ,  cls_loss: 0.31756
[train: 49, 150 / 937] FPS: 97.4 (122.6)  ,  cls_loss: 0.28038
[train: 49, 150 / 937] FPS: 97.5 (122.4)  ,  cls_loss: 0.30999
[train: 49, 150 / 937] FPS: 97.5 (122.4)  ,  cls_loss: 0.29423
[train: 49, 200 / 937] FPS: 99.1 (132.0)  ,  cls_loss: 0.30516
[train: 49, 200 / 937] FPS: 99.1 (131.3)  ,  cls_loss: 0.29581
[train: 49, 200 / 937] FPS: 99.1 (131.2)  ,  cls_loss: 0.28146

你可能感兴趣的:(目标跟踪,目标跟踪,人工智能,机器学习)