MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / count_im_pair

Method count_im_pair

eval/LANE_evaluation/lane2d/src/counter.cpp:77–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77tuple<vector<int>, long, long, long, long> Counter::count_im_pair(const vector<vector<Point2f> > &anno_lanes, const vector<vector<Point2f> > &detect_lanes, vector<uint8_t> &anno_lanes_flag, vector<uint8_t> &detect_lanes_flag,bool category_flag)
78{
79 vector<int> anno_match(anno_lanes.size(), -1);
80 vector<int> detect_match;
81 if(anno_lanes.empty())
82 {
83 return make_tuple(anno_match, 0, detect_lanes.size(), 0, 0);
84 }
85
86 if(detect_lanes.empty())
87 {
88 return make_tuple(anno_match, 0, 0, 0, anno_lanes.size());
89 }
90
91 // hungarian match first
92
93 // first calc similarity matrix
94 vector<vector<double> > similarity(anno_lanes.size(), vector<double>(detect_lanes.size(), 0));
95 for(int i=0; i<anno_lanes.size(); i++)
96 {
97 const vector<Point2f> &curr_anno_lane = anno_lanes[i];
98 for(int j=0; j<detect_lanes.size(); j++)
99 {
100 const vector<Point2f> &curr_detect_lane = detect_lanes[j];
101 if (category_flag)
102 {
103 similarity[i][j] = lane_compare->get_lane_similarity(curr_anno_lane, curr_detect_lane);
104 }
105 else
106 {
107
108 if (((anno_lanes_flag[i] - detect_lanes_flag[j])< 1e-4 ) & ((anno_lanes_flag[i] - detect_lanes_flag[j]) > -1e-4))
109 {
110 similarity[i][j] = lane_compare->get_lane_similarity(curr_anno_lane, curr_detect_lane);
111 }
112 else
113 {
114 similarity[i][j] = 0;
115 }
116 }
117 }
118 }
119
120 makeMatch(similarity, anno_match, detect_match);
121
122 int curr_tp = 0;
123 // count and add
124 for(int i=0; i<anno_lanes.size(); i++)
125 {
126 if(anno_match[i]>=0 && similarity[i][anno_match[i]] > sim_threshold)
127 {
128 curr_tp++;
129 }
130 else
131 {
132 anno_match[i] = -1;
133 }
134 }

Callers 1

mainFunction · 0.80

Calls 1

get_lane_similarityMethod · 0.80

Tested by

no test coverage detected