def run_tracker(tracker_name, tracker_param, run_id=None, dataset_name='otb', sequence=None, debug=0, threads=0,
num_gpus=8, tracker_params=None):
dataset = get_dataset(dataset_name)
#Sequence Basketball, length=725 frames, Sequence Biker, length=142 frames ...
run_dataset(dataset, trackers, debug, threads, num_gpus=num_gpus)
run_sequence(seq, tracker_info, debug=debug)# Sequence Basketball, length=725 frames
output = tracker.run_sequence(seq, debug=debug)
# Get init information
init_info = seq.init_info() # {'init_bbox': [198.0, 214.0, 34.0, 81.0]}
tracker = self.create_tracker(params)
-----------------------------------------------------------------------------------------------------------------------
class MixFormerOnline(BaseTracker):
def __init__(self, params, dataset_name):#dataset_name:'otb'
network = build_mixformer_online_score(params.cfg, train=False)
***********************************************************************************************************************
MixFormerOnlineScore(
(backbone): ConvolutionalVisionTransformer(
(stage0): VisionTransformer(
(patch_embed): ConvEmbed(
(proj): Conv2d(3, 64, kernel_size=(7, 7), stride=(4, 4), padding=(2, 2))
(norm): LayerNorm((64,), eps=1e-05, elementwise_affine=True)
)
(pos_drop): Dropout(p=0.0, inplace=False)
(blocks): ModuleList(
(0): Block(
(norm1): LayerNorm((64,), eps=1e-05, elementwise_affine=True)
(attn): Attention(
(conv_proj_q): Sequential(
(conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=64, bias=False)
(bn): FrozenBatchNorm2d()
(rearrage): Rearrange('b c h w -> b (h w) c')
)
(conv_proj_k): Sequential(
(conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=64, bias=False)
(bn): FrozenBatchNorm2d()
(rearrage): Rearrange('b c h w -> b (h w) c')
)
(conv_proj_v): Sequential(
(conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=64, bias=False)
(bn): FrozenBatchNorm2d()
(rearrage): Rearrange('b c h w -> b (h w) c')
)
(proj_q): Linear(in_features=64, out_features=64, bias=True)
(proj_k): Linear(in_features=64, out_features=64, bias=True)
(proj_v): Linear(in_features=64, out_features=64, bias=True)
(attn_drop): Dropout(p=0.0, inplace=False)
(proj): Linear(in_features=64, out_features=64, bias=True)
(proj_drop): Dropout(p=0.0, inplace=False)
)
(drop_path): Identity()
(norm2): LayerNorm((64,), eps=1e-05, elementwise_affine=True)
(mlp): Mlp(
(fc1): Linear(in_features=64, out_features=256, bias=True)
(act): QuickGELU()
(fc2): Linear(in_features=256, out_features=64, bias=True)
(drop): Dropout(p=0.0, inplace=False)
)
)
)
)
(stage1): VisionTransformer(
(patch_embed): ConvEmbed(
(proj): Conv2d(64, 192, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
(norm): LayerNorm((192,), eps=1e-05, elementwise_affine=True)
)
(pos_drop): Dropout(p=0.0, inplace=False)
(blocks): ModuleList(
(0-3): Block(
(norm1): LayerNorm((192,), eps=1e-05, elementwise_affine=True)
(attn): Attention(
(conv_proj_q): Sequential(
(conv): Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=192, bias=False)
(bn): FrozenBatchNorm2d()
(rearrage): Rearrange('b c h w -> b (h w) c')
)
(conv_proj_k): Sequential(
(conv): Conv2d(192, 192, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=192, bias=False)
(bn): FrozenBatchNorm2d()
(rearrage): Rearrange('b c h w -> b (h w) c')
)
(conv_proj_v): Sequential(
(conv): Conv2d(192, 192, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=192, bias=False)
(bn): FrozenBatchNorm2d()
(rearrage): Rearrange('b c h w -> b (h w) c')
)
(proj_q): Linear(in_features=192, out_features=192, bias=True)
(proj_k): Linear(in_features=192, out_features=192, bias=True)
(proj_v): Linear(in_features=192, out_features=192, bias=True)
(attn_drop): Dropout(p=0.0, inplace=False)
(proj): Linear(in_features=192, out_features=192, bias=True)
(proj_drop): Dropout(p=0.0, inplace=False)
)
(drop_path): Identity()
(norm2): LayerNorm((192,), eps=1e-05, elementwise_affine=True)
(mlp): Mlp(
(fc1): Linear(in_features=192, out_features=768, bias=True)
(act): QuickGELU()
(fc2): Linear(in_features=768, out_features=192, bias=True)
(drop): Dropout(p=0.0,
mixformer test代码解析
于 2022-07-12 23:02:12 首次发布
本文深入探讨 Mixformer 模型在目标跟踪任务中的实现细节,通过 Python 代码展示如何运用该模型进行高效的目标检测与跟踪。通过对关键代码段的解析,读者将了解 Mixformer 的核心原理及其在实际应用中的优势。
摘要由CSDN通过智能技术生成