Run rotated NMS regression checks.
61 {
62 {
64 box_a.
center = {0.0f, 0.0f};
69
71 box_b.
center = {0.5f, 0.0f};
73
74 std::vector<pcod_common::BoundingBox> boxes{box_a, box_b};
75
80
82 assert(boxes.size() == 1);
83 assert(std::abs(boxes[0].center[0]) < 1e-6f);
84 assert(std::abs(boxes[0].center[1]) < 1e-6f);
85 }
86
87 {
88 RunNmsCase(
89 {
90 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.9f),
91 MakeBox(1, 0.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.8f),
92 },
93 0.1f, 10, {0});
94
95 RunNmsCase(
96 {
97 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.9f),
98 MakeBox(1, 0.5f, 0.0f, 4.0f, 2.0f, 0.0f, 0.8f),
99 },
100 0.1f, 10, {0});
101
102 RunNmsCase(
103 {
104 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.9f),
105 MakeBox(1, 3.5f, 0.0f, 4.0f, 2.0f, 0.0f, 0.8f),
106 },
107 0.1f, 10, {0, 1});
108
109 RunNmsCase(
110 {
111 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.9f),
112 MakeBox(1, 4.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.8f),
113 },
114 0.0f, 10, {0, 1});
115
116 RunNmsCase(
117 {
118 MakeBox(0, 0.0f, 0.0f, 6.0f, 4.0f, 0.0f, 0.9f),
119 MakeBox(1, 0.0f, 0.0f, 2.0f, 1.0f, 0.0f, 0.8f),
120 },
121 0.05f, 10, {0});
122
123 RunNmsCase(
124 {
125 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, static_cast<float>(M_PI / 4.0), 0.9f),
126 MakeBox(1, 0.2f, 0.1f, 4.0f, 2.0f, static_cast<float>(M_PI / 4.0), 0.8f),
127 },
128 0.1f, 10, {0});
129
130 RunNmsCase(
131 {
132 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, static_cast<float>(M_PI / 4.0), 0.9f),
133 MakeBox(1, 0.0f, 0.0f, 4.0f, 2.0f, static_cast<float>(-M_PI / 4.0), 0.8f),
134 },
135 0.1f, 10, {0});
136
137 RunNmsCase(
138 {
139 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, static_cast<float>(M_PI / 4.0), 0.9f),
140 MakeBox(1, 4.0f, 4.0f, 4.0f, 2.0f, static_cast<float>(M_PI / 4.0), 0.8f),
141 },
142 0.1f, 10, {0, 1});
143
144 RunNmsCase(
145 {
146 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.8f),
147 MakeBox(1, 0.5f, 0.0f, 4.0f, 2.0f, 0.0f, 0.95f),
148 MakeBox(2, 8.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.7f),
149 },
150 0.1f, 10, {1, 2});
151
152 RunNmsCase(
153 {
154 MakeBox(0, 0.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.9f),
155 MakeBox(1, 8.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.8f),
156 MakeBox(2, 16.0f, 0.0f, 4.0f, 2.0f, 0.0f, 0.7f),
157 },
158 0.1f, 2, {0, 1});
159 }
160
161 {
163 keep_box.
center = {0.0f, 0.0f};
165 keep_box.
width = 1.0f;
169
171 drop_box.
center = {10.0f, 10.0f};
173 drop_box.
width = 1.0f;
177
178 std::vector<pcod_common::BoundingBox> boxes{keep_box, drop_box};
184
186 assert(boxes.size() == 1);
187 assert(std::abs(boxes[0].center[0]) < 1e-6f);
188 assert(std::abs(boxes[0].center[1]) < 1e-6f);
189 }
190
191 return 0;
192}
void ApplyRotatedNms(std::vector< BoundingBox > &bboxes, const NmsConfig &config)
float length
Length along the local X axis.
std::array< float, 2 > center
XY center in metres.
float width
Width along the local Y axis.
std::vector< ClassificationEntry > classification
Ranked semantic predictions.
float existence_probability
Detection confidence.
float iou_threshold
IoU above which a lower-scored box is suppressed.
std::vector< float > score_thresholds
Per-class thresholds, or one threshold shared by all classes.
int max_detections
Maximum number of boxes retained.
float internal_score_threshold
Score pivot used when rescaling class thresholds.