119 static const float kPillarXSize;
120 static const float kPillarYSize;
121 static const float kPillarZSize;
122 static const float kMinXRange;
123 static const float kMinYRange;
124 static const float kMinZRange;
125 static const float kMaxXRange;
126 static const float kMaxYRange;
127 static const float kMaxZRange;
128 static const int kNumClass;
129 static const int kMaxNumPillars;
130 static const int kMaxNumPointsPerPillar;
131 static const int kNumPointFeature;
132 static const int kGridXSize;
133 static const int kGridYSize;
134 static const int kGridZSize;
135 static const int kRpnInputSize;
136 static const int kNumAnchor;
137 static const int kNumOutputBoxFeature;
138 static const int kRpnBoxOutputSize;
139 static const int kRpnClsOutputSize;
140 static const int kRpnDirOutputSize;
141 static const int kBatchSize;
142 static const int kNumIndsForScan;
143 static const int kNumThreads;
144 static const int kGridSize;
145 static const int kNumAnchorPerGrid;
148 static const int kNumBoxCorners;
149 static const std::vector<int> kAnchorStrides;
150 static const std::vector<int> kAnchorRanges;
151 static const std::vector<int> kNumAnchorSets;
152 static const std::vector<std::vector<float>> kAnchorDxSizes;
153 static const std::vector<std::vector<float>> kAnchorDySizes;
154 static const std::vector<std::vector<float>> kAnchorDzSizes;
155 static const std::vector<std::vector<float>> kAnchorZCoors;
156 static const std::vector<std::vector<int>> kNumAnchorRo;
157 static const std::vector<std::vector<float>> kAnchorRo;
160 const bool reproduce_result_mode_;
161 const float score_threshold_;
162 const float nms_overlap_threshold_;
163 const std::string pfe_onnx_file_;
164 const std::string rpn_onnx_file_;
165 const common::Framework& model_type_;
166 const std::string model_file_;
169 int host_pillar_count_[1];
179 float* box_anchors_min_x_;
180 float* box_anchors_min_y_;
181 float* box_anchors_max_x_;
182 float* box_anchors_max_y_;
186 float* dev_num_points_per_pillar_;
187 int* dev_sparse_pillar_map_;
188 int* dev_cumsum_along_x_;
189 int* dev_cumsum_along_y_;
191 float* dev_pillar_point_feature_;
192 float* dev_pillar_coors_;
194 float* dev_box_anchors_min_x_;
195 float* dev_box_anchors_min_y_;
196 float* dev_box_anchors_max_x_;
197 float* dev_box_anchors_max_y_;
198 int* dev_anchor_mask_;
200 void* pfe_buffers_[3];
201 void* rpn_buffers_[4];
203 float* dev_scattered_feature_;
205 float* dev_anchors_px_;
206 float* dev_anchors_py_;
207 float* dev_anchors_pz_;
208 float* dev_anchors_dx_;
209 float* dev_anchors_dy_;
210 float* dev_anchors_dz_;
211 float* dev_anchors_ro_;
212 float* dev_filtered_box_;
213 float* dev_filtered_score_;
214 int* dev_filtered_label_;
215 int* dev_filtered_dir_;
216 float* dev_box_for_nms_;
217 int* dev_filter_count_;
219 std::unique_ptr<PreprocessPoints> preprocess_points_ptr_;
220 std::unique_ptr<PreprocessPointsCuda> preprocess_points_cuda_ptr_;
221 std::unique_ptr<AnchorMaskCuda> anchor_mask_cuda_ptr_;
222 std::unique_ptr<PostprocessCuda> postprocess_cuda_ptr_;
225 nvinfer1::ICudaEngine* pfe_engine_;
226 nvinfer1::ICudaEngine* rpn_engine_;
227 nvinfer1::IExecutionContext* pfe_context_;
228 nvinfer1::IExecutionContext* rpn_context_;
231 std::vector<std::string> input_blob_names_ = {
232 "pillar_point_feature",
236 std::vector<std::string> output_blob_names_ = {
241 std::shared_ptr<inference::Inference> inference_;
247 void DeviceMemoryMalloc();
285 void GenerateAnchors(
float* anchors_px_,
float* anchors_py_,
286 float* anchors_pz_,
float* anchors_dx_,
287 float* anchors_dy_,
float* anchors_dz_,
296 void OnnxToTRTModel(
const std::string& model_file,
297 nvinfer1::ICudaEngine** engine_ptr);
305 void Preprocess(
const float* in_points_array,
const int in_num_points);
314 void PreprocessCPU(
const float* in_points_array,
const int in_num_points);
322 void PreprocessGPU(
const float* in_points_array,
const int in_num_points);
340 void ConvertAnchors2BoxAnchors(
float* anchors_px_,
float* anchors_py_,
341 float* box_anchors_min_x_,
342 float* box_anchors_min_y_,
343 float* box_anchors_max_x_,
344 float* box_anchors_max_y_);
350 void PutAnchorsInDeviceMemory();
363 PointPillars(
const bool reproduce_result_mode,
364 const float score_threshold,
365 const float nms_overlap_threshold,
366 const common::Framework& model_type,
367 const std::string& model_file);
383 void DoInference(
const float* in_points_array,
const int in_num_points,
384 std::vector<float>* out_detections,
385 std::vector<int>* out_labels);
Postprocess for network output