MHT代码阅读(4)

本文详细介绍了多目标跟踪(MHT)中的一种全局假设生成方法,该方法采用广度优先搜索策略从单轨道假设开始,逐步扩展为多轨道假设,确保不兼容的轨道不共享观测。在每次扩展过程中,通过剪枝控制假设数量,并利用不兼容列表进行兼容性检查。最终形成一系列包含不同正分数轨道的假设,并将其转换为概率,从而选择高概率假设。代码实现中涉及邻接矩阵、权重矩阵和不兼容列表的处理,以及节点权重分配、错误检查和最佳假设选择等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MHT代码阅读(4)

4. generateGlobalHypothesis

4.1 论文内容

  • 形成多个轨迹假设来表示场景中的多个目标。假设被定义为一组一致(兼容)的轨道,因为在给定假设中没有两条轨道共享观察结果。理论上,一个假设中可以有任意数量的轨道。

在这里插入图片描述

  • 假设形成的一种相对简单的广度优先方法从定义单轨假设(一个且只有一个轨有效)开始搜索过程,并通过向现有假设添加新轨来扩展假设。假设扩展时的假设不能与现有假设中的任何轨道共享观察。这可以直接完成,因为每个轨道都有一个不兼容列表,因此可以为整个假设推断出一个不兼容列表。

  • 假设生成过程的每个后续步骤都以一组 N-track 假设(从 N = 1 开始)开始,并将这些假设的一个子集扩展为 (N + 1)-track 假设。这个过程一直持续到与进一步扩展相关的潜在分数不再被认为足以证明扩展是合理的。最初,这种扩展应该只使用正分数轨道来完成。然后,可以通过它们与由正分数轨道形成的较高分数假设的兼容性来评估负分数轨道。

  • 总而言之,假设是通过广度优先扩展过程形成的,该过程从 N 轨道假设形成 (N + 1) 轨道假设。执行持续的剪枝过程,以便在每一步都控制假设的数量。在这个过程结束时,会有一个假设列表,每个假设包含一组不同的正分数轨道。然后,将负分数轨道添加到可比较的假设中以形成新的假设。最后,使用下一节中介绍的转换将假设分数转换为概率,并修剪(删除)低概率假设。

  • 为了说明假设形成过程,请考虑三个假设(H1、H2、H3)由正轨迹形成且得分分别为 100、98 和 95 的情况。进一步假设不会形成得分低于最大假设得分 8 或更多的任何假设。然后,如果该轨道与 H1 中的所有其他轨道兼容,则可以将得分为 -7 的轨道添加到 H1。该轨迹不能添加到 H2 或 H3,即使满足兼容性要求。同样,分数为 -5 的轨道可以添加到 H1 或 H2,但不能添加到 H3。此外,只要新(增强)假设的得分保持在阈值(在本例中为 92)之上,就可以向给定假设添加一个以上的负得分。

    本例选择低于最大假设得分
    8,也就是选择阈值为100-8=92。因此当得分为-7时,只能给轨道H1,因为100-7>92,而98-7<92.以此类推。

4.2 代码阅读

  1. 初始化
    • clustersNo:族群数量
    • bestHypothesis:最好假设
    • bestScore:最高得分
    • trackIndexInTrees:轨迹序号
    • selectedTrackIDs:选择的轨迹ID
  2. 进入外循环(循环次数是clustersNo的大小)
    • 初始化 adjacencyMat(邻接垫):最后一行和最后一列当哑结点
    • 初始化 weightMat(权重垫):第一行最后一列的元素当作哑结点
    • 初始化 trackIndexInTrees{i,1}
    • 初始化 nodesNo=size(clusters{i},1):第i个族群的根节点数、可以理解为第i个族群的轨迹的数量?(其中r=size(A,1)该语句返回的是矩阵A的行数, c=size(A,2) 该语句返回的是矩阵A的列数)
    • 进入内循环(循环次数是nodesNo的大小)
      1. 初始化 familyID1,leafNodeInd1,IDsel,trackID,index1,trackIndexInTrees{i,1}(index1,:)
      2. 分配节点权重
      3. 分数错误修复
      4. [此处有疑问]:初始化ICL(不兼容轨迹树集),如果ICL只有一行,进入判断,如果index1 ~= index2则报错;
      5. 进入判断,直到 compatibleTracksID 非空为止,如果两个轨道兼容,则分配 1。
      6. 退出内循环
    • 将隔离节点连接到虚拟节点。
    • 对角线设置为0
    • 错误检查

4.3 代码附录

function [bestHypothesis,bestScore,trackIndexInTrees,selectedTrackIDs]=...
    generateGlobalHypothesis(scoreTreeSet,idTreeSet,...
    incompabilityListTreeSet,clusters,ICL_clusters,other_param)
    
    %初始化
    clustersNo=length(clusters);
    bestHypothesis=cell(clustersNo,1);
    bestScore=cell(clustersNo,1);
    trackIndexInTrees=cell(clustersNo,1);
    selectedTrackIDs=[];
    if clustersNo == 0    
        return
    end
    %进入循环
    for i=1:clustersNo
       adjacencyMat=zeros(other_param.currentTrackNo(i)+1, other_param.currentTrackNo(i)+1);  % the last row and column for the dummy node 最后一行和最后一列当哑结点
       weightMat=zeros(1, other_param.currentTrackNo(i)+1);    % the last element for the dummy node 第一行的最后一列的元素当作哑结点
       trackIndexInTrees{i,1}=zeros(other_param.currentTrackNo(i),2);   
       nodesNo=size(clusters{i},1); %其中r=size(A,1)该语句返回的是矩阵A的行数, c=size(A,2) 该语句返回的是矩阵A的列数
       %进入内循环
       for j=1:nodesNo            
          familyID1=clusters{i}(j,1);
          leafNodeInd1=clusters{i}(j,2);
          IDsel=idTreeSet(familyID1).get(leafNodeInd1);
          trackID=IDsel(2);
          index1=find(ICL_clusters{i} == trackID);
          trackIndexInTrees{i,1}(index1,:)=[familyID1 leafNodeInd1];

          % assign a node weight   分配节点权重  
          if weightMat(index1) ~= 0
              error('something wrong happend in the weight matrix');
          end
          scoreSel=scoreTreeSet(familyID1).get(leafNodeInd1);
          % score bug fixed 分数错误修复
          if scoreSel(1) > 1.1*(1/other_param.const)
               weightMat(index1)=scoreSel(1);
          else
               weightMat(index1)=1.1*(1/other_param.const);
          end      
          ICL=incompabilityListTreeSet(familyID1).get(leafNodeInd1);  
          if size(ICL,1) == 1 
               index2=find(ICL_clusters{i} == ICL(2));           
               compatibleTracksID=ICL_clusters{i}(ICL_clusters{i} ~= ICL(2));
               if index1 ~= index2
                  error('error happened in the ICL of the confirmed track'); 
               end
          else         
               [compatibleTracksID, index2]=setdiff(ICL_clusters{i},ICL(:,2),'rows');
               index2=index2';
          end
          if isempty(compatibleTracksID)
              continue;
          end
          % assign 1 if two tracks are compatible 如果两个轨道兼容,则分配 1
          adjacencyMat(index1,index2)=1;
       end
       weightMat=other_param.const*weightMat;
       % connect an isolated node to a dummy node. 将隔离节点连接到虚拟节点。
       % NOTE : A single node is not considered as a clique in Cliquer.    注意:在 Cliquer 中,单个节点不被视为集团。  
       weightMat(end)=1.1; 
       index=find(sum(adjacencyMat(1:end-1,1:end-1)') == 0);%哪一列的和是0
       for k=index
           adjacencyMat(k,end)=1;
           adjacencyMat(end,k)=1;
       end
       % set the diagonal terms to zero 对角线设置为0
       adjacencyMat(logical(eye(size(adjacencyMat))))=0;
       % error check 错误检查
       if ~isequal(adjacencyMat,adjacencyMat')
           error('the adjacency matrix is not symmetric');
       end
       if length(weightMat)<50
           bestHypothesis_tmp=CliqueFunc3(adjacencyMat, weightMat);
       else
           bestHypothesis_tmp=mcts_main(adjacencyMat, weightMat);
       end
       
%        try 
%            bestHypothesis_tmp=CliqueFunc3(adjacencyMat, weightMat);
%        catch
%            bestHypothesis_tmp=mcts_main(adjacencyMat, weightMat);
%            disp("hhh")
%        end
       
%        if ((size(adjacencyMat,1)>50 && sum(sum(adjacencyMat))/size(adjacencyMat,1)^2 > 0.5))||(size(adjacencyMat,1)>80)
%            disp('aaa')
%            bestHypothesis_tmp=mcts_main(adjacencyMat, weightMat);%使用启发式搜索
%        else
%            bestHypothesis_tmp=CliqueFunc3(adjacencyMat, weightMat);%使用精确算法 
%        end
       bestHypothesis_tmp=bestHypothesis_tmp(:,1:end-1);
       weightMat=weightMat(1:end-1);
       if size(bestHypothesis_tmp,1) > 1
            bestTracks=~~sum(bestHypothesis_tmp);
       else
            bestTracks=bestHypothesis_tmp;
       end
       index=find(bestTracks == 1);
       selectedTrackIDs_tmp=zeros(length(index),1);
       for k=1:length(index)
           IndSel=trackIndexInTrees{i,1}(index(k),:);
           IDSel=idTreeSet(IndSel(1)).get(IndSel(2));
           selectedTrackIDs_tmp(k)=IDSel(2);
       end
       selectedTrackIDs=[selectedTrackIDs; selectedTrackIDs_tmp];
       score=zeros(size(bestHypothesis_tmp,1),1);
       for k=1:size(bestHypothesis_tmp,1)
            score(k)=sum(weightMat(logical(bestHypothesis_tmp(k,:))));
       end
       [~, index_tmp]=max(score);   
       bestHypothesis{i,1}=bestHypothesis_tmp(index_tmp,:);
       bestScore{i,1}=weightMat;
    end
end
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ChrisP3616

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值