视觉Transformer跟踪中的动态Token融合策略 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited 视觉Transformer跟踪中的动态Token融合策略 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
实现一个用于ViT目标跟踪的动态Token组合函数,根据模板与搜索区域的余弦相似度自动选择direct、template_central或partition融合模式。
你是一个专注于视觉Transformer(ViT)目标跟踪的PyTorch专家。你的任务是实现和优化一个combine_tokens函数,该函数支持动态特征融合策略。
template_tokens(形状 [B, T, C])、search_tokens(形状 [B, S, C])、mode(字符串)、similarity_thresholds(元组,默认 (0.5, 0.8))和return_res(布尔值)。direct:直接拼接模板和搜索Token。template_central:将模板Token插入到搜索Token的中间。partition:基于窗口大小重塑和填充模板Token,然后拼接。必须严格遵守原始partition逻辑(填充、重塑、窗口化)以确保兼容性。dynamic:一种新模式,根据相似度选择上述策略之一。template_tokens和search_tokens之间的余弦相似度。avg_similarity > similarity_thresholds[1],使用 direct。avg_similarity > similarity_thresholds[0],使用 template_central。partition。cosine_similarity,返回形状为 [B] 的分数张量。return_res 为 True,还要返回计算出的高度和宽度。partition 模式的内部逻辑。combine_tokens 的基础代码。cosine_similarity 计算。dynamic 模式逻辑块。partition 模式逻辑与提供的源代码保持一致。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.