NVIDIA DeepStream SDK API Reference

9.1 Release
sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef DECODER_HPP
19 #define DECODER_HPP
20 
21 #include <memory>
22 #include <vector>
23 #include "dtype.hpp"
24 
25 namespace bevfusion{
26 namespace decoder{
27 
28 struct Position {
29  float x, y, z;
30 };
31 
32 struct Size {
33  float w, l, h; // x, y, z
34 };
35 
36 struct Velocity {
37  float vx, vy;
38 };
39 
40 struct ThreeDBox {
44  float yaw;
45  float score;
46  int category;
47  int ibatch;
48  int id;
49 };
50 
51 typedef struct ThreeDBox ThreeDBox;
52 typedef std::vector<ThreeDBox> ThreeDBoxes;
53 
54 struct Head{
55  void* heatmap;
56  void* rotation;
57  void* height;
58  void* dim;
59  void* vel;
60  void* reg;
61  unsigned int fm_area;
62  unsigned int fm_width;
63  unsigned int batch;
64 };
65 
66 class Decoder {
67 public:
69  float out_size_factor = 4;
70  ds3d::Float2 voxel_size{0.075, 0.075};
71  ds3d::Float2 pc_range{-54.0f, -54.0f};
72  ds3d::Float3 post_center_range_start{-61.2, -61.2, -10.0};
74  unsigned int num_classes = 5;
75  };
76 
77 public:
78  static std::unique_ptr<Decoder> createDecoder(const DecoderParameter& param);
79  virtual bool init(const Decoder::DecoderParameter& param) = 0;
80  virtual ThreeDBoxes forward(
81  const std::vector<Head>& heads,
82  float confidence_threshold, float nms_threshold, void* stream) = 0;
83  virtual ~Decoder() = default;
84 };
85 
86 };
87 }; // bevfusion
88 
89 #endif // DECODER_HPP
bevfusion::decoder::Decoder::DecoderParameter::post_center_range_end
ds3d::Float3 post_center_range_end
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:73
bevfusion::decoder::Head::heatmap
void * heatmap
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:55
bevfusion::decoder::Head::reg
void * reg
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:60
bevfusion
Definition: sources/libs/ds3d/datafilter/lidar_preprocess/voxelization.hpp:24
bevfusion::decoder::Head::height
void * height
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:57
bevfusion::decoder::Position::x
float x
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:29
bevfusion::decoder::Velocity
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:36
bevfusion::decoder::Head
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:54
bevfusion::decoder::ThreeDBox
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:40
bevfusion::decoder::Decoder::DecoderParameter::post_center_range_start
ds3d::Float3 post_center_range_start
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:72
bevfusion::decoder::Head::fm_area
unsigned int fm_area
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:61
bevfusion::decoder::Head::vel
void * vel
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:59
bevfusion::decoder::Position
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:28
bevfusion::decoder::ThreeDBox::ibatch
int ibatch
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:47
bevfusion::decoder::Decoder::DecoderParameter::num_classes
unsigned int num_classes
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:74
bevfusion::decoder::Head::rotation
void * rotation
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:56
bevfusion::decoder::Decoder::DecoderParameter::out_size_factor
float out_size_factor
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:69
bevfusion::decoder::Size::l
float l
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:33
bevfusion::decoder::Size::w
float w
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:33
bevfusion::decoder::ThreeDBox::size
Size size
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:42
bevfusion::decoder::Decoder::init
virtual bool init(const Decoder::DecoderParameter &param)=0
bevfusion::decoder::Decoder
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:66
bevfusion::decoder::ThreeDBox::category
int category
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:46
bevfusion::decoder::Decoder::DecoderParameter::voxel_size
ds3d::Float2 voxel_size
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:70
ds3d::Float2
Definition: sources/includes/ds3d/common/helper/dtype.hpp:44
bevfusion::decoder::Position::z
float z
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:29
bevfusion::decoder::ThreeDBox::score
float score
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:45
bevfusion::decoder::Decoder::createDecoder
static std::unique_ptr< Decoder > createDecoder(const DecoderParameter &param)
bevfusion::decoder::Decoder::~Decoder
virtual ~Decoder()=default
bevfusion::decoder::Decoder::DecoderParameter
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:68
bevfusion::decoder::Head::batch
unsigned int batch
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:63
bevfusion::decoder::Position::y
float y
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:29
bevfusion::decoder::Head::dim
void * dim
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:58
ds3d::Float3
Definition: sources/includes/ds3d/common/helper/dtype.hpp:51
bevfusion::decoder::Size
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:32
bevfusion::decoder::Decoder::DecoderParameter::pc_range
ds3d::Float2 pc_range
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:71
bevfusion::decoder::Decoder::forward
virtual ThreeDBoxes forward(const std::vector< Head > &heads, float confidence_threshold, float nms_threshold, void *stream)=0
bevfusion::decoder::ThreeDBox::id
int id
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:48
bevfusion::decoder::Velocity::vx
float vx
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:37
bevfusion::decoder::ThreeDBox::velocity
Velocity velocity
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:43
bevfusion::decoder::ThreeDBoxes
std::vector< ThreeDBox > ThreeDBoxes
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:52
bevfusion::decoder::ThreeDBox::position
Position position
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:41
bevfusion::decoder::Head::fm_width
unsigned int fm_width
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:62
bevfusion::decoder::Size::h
float h
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:33
bevfusion::decoder::ThreeDBox::yaw
float yaw
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:44
bevfusion::decoder::Velocity::vy
float vy
Definition: sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_postprocess/decoder.hpp:37