Apollo 11.0
自动驾驶开放平台
apollo::perception::radar4d::GnnBipartiteGraphMatcher类 参考

#include <gnn_bipartite_graph_matcher.h>

类 apollo::perception::radar4d::GnnBipartiteGraphMatcher 继承关系图:
apollo::perception::radar4d::GnnBipartiteGraphMatcher 的协作图:

Public 成员函数

 GnnBipartiteGraphMatcher (size_t max_size=1000)
 
 ~GnnBipartiteGraphMatcher ()
 
void Match (const BipartiteGraphMatcherOptions &options, std::vector< NodeNodePair > *assignments, std::vector< size_t > *unassigned_rows, std::vector< size_t > *unassigned_cols)
 Match interface
 
std::string Name () const
 Get class name
 
- Public 成员函数 继承自 apollo::perception::radar4d::BaseBipartiteGraphMatcher
 BaseBipartiteGraphMatcher ()=default
 
virtual ~BaseBipartiteGraphMatcher ()=default
 
virtual algorithm::SecureMat< float > * cost_matrix ()
 Get cost matrix
 

Protected 属性

std::vector< int > row_tag_
 
std::vector< int > col_tag_
 
- Protected 属性 继承自 apollo::perception::radar4d::BaseBipartiteGraphMatcher
algorithm::SecureMat< float > * cost_matrix_ = nullptr
 
float max_match_distance_ = 0.0f
 

额外继承的成员函数

- Public 类型 继承自 apollo::perception::radar4d::BaseBipartiteGraphMatcher
typedef std::pair< size_t, size_t > NodeNodePair
 

详细描述

在文件 gnn_bipartite_graph_matcher.h 第 59 行定义.

构造及析构函数说明

◆ GnnBipartiteGraphMatcher()

apollo::perception::radar4d::GnnBipartiteGraphMatcher::GnnBipartiteGraphMatcher ( size_t  max_size = 1000)
explicit

在文件 gnn_bipartite_graph_matcher.cc 第 47 行定义.

47 {
48 row_tag_.reserve(max_size);
49 col_tag_.reserve(max_size);
50 cost_matrix_ = new algorithm::SecureMat<float>();
51}

◆ ~GnnBipartiteGraphMatcher()

apollo::perception::radar4d::GnnBipartiteGraphMatcher::~GnnBipartiteGraphMatcher ( )

在文件 gnn_bipartite_graph_matcher.cc 第 53 行定义.

53 {
54 if (cost_matrix_ != nullptr) {
55 delete cost_matrix_;
56 }
57}

成员函数说明

◆ Match()

void apollo::perception::radar4d::GnnBipartiteGraphMatcher::Match ( const BipartiteGraphMatcherOptions &  options,
std::vector< NodeNodePair > *  assignments,
std::vector< size_t > *  unassigned_rows,
std::vector< size_t > *  unassigned_cols 
)
virtual

Match interface

参数
optionsmatch params
assignmentsmatched pair of objects & tracks
unassigned_rowsunmatched rows
unassigned_colsunmatched cols

实现了 apollo::perception::radar4d::BaseBipartiteGraphMatcher.

在文件 gnn_bipartite_graph_matcher.cc 第 59 行定义.

63 {
64 assignments->clear();
65 unassigned_rows->clear();
66 unassigned_cols->clear();
67 row_tag_.clear();
68 col_tag_.clear();
69 algorithm::SecureMat<float>* cost_matrix = cost_matrix_;
70 float max_dist = options.cost_thresh;
71 int num_rows = static_cast<int>(cost_matrix->height());
72 int num_cols = static_cast<int>(cost_matrix->width());
73 row_tag_.assign(num_rows, 0);
74 col_tag_.assign(num_cols, 0);
75
76 std::vector<MatchCost> match_costs;
77 for (int r = 0; r < num_rows; r++) {
78 for (int c = 0; c < num_cols; c++) {
79 if ((*cost_matrix)(r, c) < max_dist) {
80 MatchCost item(r, c, (*cost_matrix)(r, c));
81 match_costs.push_back(item);
82 }
83 }
84 }
85
86 // sort costs in ascending order
87 std::sort(match_costs.begin(), match_costs.end());
88
89 // gnn
90 for (size_t i = 0; i < match_costs.size(); ++i) {
91 size_t rid = match_costs[i].RowIdx();
92 size_t cid = match_costs[i].ColIdx();
93 if (row_tag_[rid] == 0 && col_tag_[cid] == 0) {
94 row_tag_[rid] = 1;
95 col_tag_[cid] = 1;
96 assignments->push_back(std::make_pair(rid, cid));
97 }
98 }
99
100 for (int i = 0; i < num_rows; i++) {
101 if (row_tag_[i] == 0) {
102 unassigned_rows->push_back(i);
103 }
104 }
105
106 for (int i = 0; i < num_cols; i++) {
107 if (col_tag_[i] == 0) {
108 unassigned_cols->push_back(i);
109 }
110 }
111}
virtual algorithm::SecureMat< float > * cost_matrix()
Get cost matrix

◆ Name()

std::string apollo::perception::radar4d::GnnBipartiteGraphMatcher::Name ( ) const
inlinevirtual

Get class name

返回
std::string

实现了 apollo::perception::radar4d::BaseBipartiteGraphMatcher.

在文件 gnn_bipartite_graph_matcher.h 第 81 行定义.

81{ return "GnnBipartiteGraphMatcher"; }

类成员变量说明

◆ col_tag_

std::vector<int> apollo::perception::radar4d::GnnBipartiteGraphMatcher::col_tag_
protected

在文件 gnn_bipartite_graph_matcher.h 第 85 行定义.

◆ row_tag_

std::vector<int> apollo::perception::radar4d::GnnBipartiteGraphMatcher::row_tag_
protected

在文件 gnn_bipartite_graph_matcher.h 第 84 行定义.


该类的文档由以下文件生成: