Run PBOD decoder regression checks.
13 {
14 {
16
17 const int num_pillars = 1;
18 const int num_classes = 2;
19 float focal_logits[num_pillars] = {0.0F};
20 std::vector<float> size_posterior(static_cast<std::size_t>(num_pillars * num_classes * 3), 1.0F);
21 float class_logits[num_pillars * num_classes] = {0.1F, 0.9F};
22 std::vector<float> reg_logits(static_cast<std::size_t>(num_pillars * num_classes * 7), 0.0F);
23
32
35
37 assert(boxes.size() == 1);
38 const auto& box = boxes[0];
39 assert(box.classification.size() == 2);
40 assert(!box.has_velocity);
41 assert(std::abs(box.length - 1.0F) < 1e-6F);
42 assert(std::abs(box.width - 1.0F) < 1e-6F);
43 assert(std::abs(box.height - 1.0F) < 1e-6F);
44 assert(std::abs(box.center[0] - 0.5F) < 1e-6F);
45 assert(std::abs(box.center[1] - 0.5F) < 1e-6F);
46 }
47
48 {
50
51 const int num_pillars = 2;
52 const int num_classes = 2;
53 float focal_logits[num_pillars] = {0.0F, 2.0F};
54 std::vector<float> size_posterior = {1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F, 8.0F, 9.0F, 10.0F, 11.0F, 12.0F};
55 std::vector<float> class_logits = {0.7F, 0.2F, 0.1F, 1.2F};
56 std::vector<float> reg_logits(static_cast<std::size_t>(num_pillars * num_classes * 7), 0.0F);
57 reg_logits[0] = 0.25F;
58 reg_logits[1] = -0.5F;
59 reg_logits[2] = 0.75F;
60 reg_logits[3] = std::log(2.0F);
61 reg_logits[4] = std::log(0.5F);
62 reg_logits[5] = std::log(1.5F);
63 reg_logits[6] = 3.5F;
64
65 const std::size_t second_pillar_class_one = static_cast<std::size_t>((1 * num_classes + 1) * 7);
66 reg_logits[second_pillar_class_one + 0] = -0.2F;
67 reg_logits[second_pillar_class_one + 1] = 0.3F;
68 reg_logits[second_pillar_class_one + 2] = -0.4F;
69 reg_logits[second_pillar_class_one + 3] = std::log(0.5F);
70 reg_logits[second_pillar_class_one + 4] = std::log(2.0F);
71 reg_logits[second_pillar_class_one + 5] = std::log(1.0F);
72 reg_logits[second_pillar_class_one + 6] = -3.5F;
73
82
86
88 assert(boxes.size() == 2);
89
90 const auto& first = boxes[0];
91 assert(first.classification[0].class_idx == 0);
92 assert(std::abs(first.existence_probability - 0.5F) < 1e-6F);
93 assert(std::abs(first.length - 2.0F) < 1e-6F);
94 assert(std::abs(first.width - 1.0F) < 1e-6F);
95 assert(std::abs(first.height - 4.5F) < 1e-6F);
96 assert(std::abs(first.center[0] - 0.75F) < 1e-6F);
97 assert(std::abs(first.center[1] + 0.5F) < 1e-6F);
98 assert(std::abs(first.z - 2.25F) < 1e-6F);
99 assert(std::abs(first.yaw + 2.7831855F) < 1e-5F);
100
101 const auto& second = boxes[1];
102 assert(second.classification[1].class_idx == 1);
103 assert(std::abs(second.existence_probability - 0.880797F) < 1e-5F);
104 assert(std::abs(second.length - 5.0F) < 1e-6F);
105 assert(std::abs(second.width - 22.0F) < 1e-6F);
106 assert(std::abs(second.height - 12.0F) < 1e-6F);
107 assert(std::abs(second.center[0] + 0.5F) < 1e-6F);
108 assert(std::abs(second.center[1] - 3.8F) < 1e-6F);
109 assert(std::abs(second.z + 4.8F) < 1e-6F);
110 assert(std::abs(second.yaw - 2.7831855F) < 1e-5F);
111 }
112 return 0;
113}
PillarGrid BuildPillarGrid(const std::array< int, 2 > &pillar_map_size, const std::array< std::array< float, 2 >, 3 > &pillar_map_range, int first_up_stride, int stride)
std::vector< BoundingBox > DecodePbod(const PbodOutputsView &outputs, const PillarGrid &grid, const PbodPostprocessConfig &config)
const float * focal_logits
Shape [num_pillars].
int num_classes
Number of semantic classes.
int reg_dim
Regression values per pillar and class.
int num_pillars
Number of spatial pillars.
const float * class_logits
Shape [num_pillars, num_classes].
const float * size_posterior
Shape [num_pillars, num_classes * 3].
const float * reg_logits
Shape [num_pillars, num_classes * reg_dim].
std::vector< float > score_thresholds
Per-class thresholds, or one shared threshold.
std::vector< std::string > class_names
Class name in model-output order.