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

#include <gnn_bipartite_graph_matcher.h>

类 apollo::perception::lidar::GnnBipartiteGraphMatcher 继承关系图:
apollo::perception::lidar::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::lidar::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_
 
std::vector< int > ignore_track_
 
- Protected 属性 继承自 apollo::perception::lidar::BaseBipartiteGraphMatcher
algorithm::SecureMat< float > * cost_matrix_ = nullptr
 
float max_match_distance_ = 0.0f
 

额外继承的成员函数

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

详细描述

在文件 gnn_bipartite_graph_matcher.h59 行定义.

构造及析构函数说明

◆ GnnBipartiteGraphMatcher()

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

在文件 gnn_bipartite_graph_matcher.cc47 行定义.

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

◆ ~GnnBipartiteGraphMatcher()

apollo::perception::lidar::GnnBipartiteGraphMatcher::~GnnBipartiteGraphMatcher ( )

在文件 gnn_bipartite_graph_matcher.cc53 行定义.

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

成员函数说明

◆ Match()

void apollo::perception::lidar::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::lidar::BaseBipartiteGraphMatcher.

在文件 gnn_bipartite_graph_matcher.cc59 行定义.

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

◆ Name()

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

Get class name

返回
std::string

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

在文件 gnn_bipartite_graph_matcher.h81 行定义.

81{ return "GnnBipartiteGraphMatcher"; }

类成员变量说明

◆ col_tag_

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

在文件 gnn_bipartite_graph_matcher.h85 行定义.

◆ ignore_track_

std::vector<int> apollo::perception::lidar::GnnBipartiteGraphMatcher::ignore_track_
protected

在文件 gnn_bipartite_graph_matcher.h86 行定义.

◆ row_tag_

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

在文件 gnn_bipartite_graph_matcher.h84 行定义.


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