27 namespace perception {
68 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
72 memset(k_mat_, 0,
sizeof(
float) * 9);
73 resize_ry_score(params_.nr_bins_ry);
74 set_default_variance();
80 orientation_variance_(0) = 1.0f;
81 orientation_variance_(1) = orientation_variance_(2) = 0.0f;
82 position_uncertainty_ << 1, 0, 0, 0, 0, 0, 0, 0, 1;
85 void Init(
const float *k_mat,
int width,
int height) {
86 memcpy(k_mat_, k_mat,
sizeof(
float) * 9);
97 FillRyScoreSingleBin(ry);
107 float hwl[3],
float *
ry);
110 bool Solve3dBboxGivenOneFullBboxDimensionOrientation(
const float *
bbox,
115 bool SolveCenterFromNearestVerticalEdge(
const float *bbox,
const float *hwl,
116 float ry,
float *center,
117 float *center_2d)
const;
119 void UpdateCenterViaBackProjectZ(
const float *bbox,
const float *hwl,
120 const float *center_2d,
121 float *center)
const {
124 center[1] += hwl[0] / 2;
127 float GetProjectionScore(
float ry,
const float *bbox,
const float *hwl,
128 const float *center,
bool check_truncation =
false,
129 float *bbox_res =
nullptr)
const {
132 float *bbox_near =
nullptr;
134 &k_mat_[0], width_, height_, bbox, rot, hwl, center, check_truncation,
135 bbox_res, bbox_near);
139 void PostRefineZ(
const float *bbox,
const float *hwl,
const float *center2d,
140 float ry,
float *center,
float dz = 0.2f,
float rz = 1.0f,
141 bool fix_proj =
true)
const {
143 float score_best = 0.0f;
144 float x[2] = {center2d[0], center2d[1]};
145 float center_best[3] = {center[0], center[1], center[2]};
146 for (
float offset = -rz; offset <= rz; offset += dz) {
147 float z_test = std::max(z + offset, params_.depth_min);
148 float center_test[3] = {center[0], center[1], z_test};
151 center_test[1] += hwl[0] / 2;
153 float score_test = GetProjectionScore(ry, bbox, hwl, center_test);
154 if (score_best < score_test) {
155 score_best = score_test;
156 memcpy(center_best, center_test,
sizeof(
float) * 3);
159 memcpy(center, center_best,
sizeof(
float) * 3);
162 void PostRefineOrientation(
const float *bbox,
const float *hwl,
163 const float *center,
float *ry);
165 void GetCenter(
const float *bbox,
const float &z_ref,
const float &ry,
166 const float *hwl,
float *center,
169 void FillRyScoreSingleBin(
const float &ry) {
170 int nr_bins_ry =
static_cast<int>(ry_score_.size());
171 memset(ry_score_.data(), 0,
sizeof(float) * nr_bins_ry);
173 int index =
static_cast<int>(
174 std::floor((ry + PI) * static_cast<float>(nr_bins_ry) / (2.0f * PI)));
175 ry_score_[index % nr_bins_ry] = 1.0f;
180 float k_mat_[9] = {0};
183 std::vector<float> ry_score_ = {};
float iou_suc
Definition: obj_mapper.h:61
Definition: obj_mapper.h:66
float occ_ratio
Definition: obj_mapper.h:57
float eps_mapper
Definition: obj_mapper.h:60
std::vector< float > get_ry_score()
Definition: obj_mapper.h:94
float dist_far
Definition: obj_mapper.h:59
float reproj_err
Definition: obj_mapper.h:53
float bbox[4]
Definition: obj_mapper.h:32
float angle_resolution_degree
Definition: obj_mapper.h:63
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Eigen::Vector3d get_orientation_var()
Definition: obj_mapper.h:101
int boundary_len
Definition: obj_mapper.h:47
float iou_high
Definition: obj_mapper.h:62
Definition: obj_mapper.h:30
int type_min_vol_index
Definition: obj_mapper.h:36
float depth_min
Definition: obj_mapper.h:58
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
bool check_dimension
Definition: obj_mapper.h:35
const double PI
Definition: const_var.h:77
void set_default_variance()
Definition: obj_mapper.h:79
float factor_small
Definition: obj_mapper.h:51
float small_bbox_height
Definition: obj_mapper.h:50
Definition: object_template_manager.h:49
void GenRotMatrix(const T &ry, T *rot)
Definition: twod_threed_util.h:101
float stable_w
Definition: obj_mapper.h:56
float rz_ratio
Definition: obj_mapper.h:54
void resize_ry_score(int size)
Definition: obj_mapper.h:92
float learning_r
Definition: obj_mapper.h:52
int nr_bins_z
Definition: obj_mapper.h:45
~ObjMapper()
Definition: obj_mapper.h:77
int max_nr_iter
Definition: obj_mapper.h:48
ObjMapperParams()
Definition: obj_mapper.h:41
T GetScoreViaRotDimensionCenter(const T *k_mat, int width, int height, const T *bbox, const T *rot, const T *hwl, const T *location, const bool &check_truncation, T *bbox_res=nullptr, T *bbox_near=nullptr)
Definition: twod_threed_util.h:177
float abnormal_h_veh
Definition: obj_mapper.h:55
std::vector< float > get_ry_score(float ry)
Definition: obj_mapper.h:96
void Init(const float *k_mat, int width, int height)
Definition: obj_mapper.h:85
Definition: obj_mapper.h:40
float hwl[3]
Definition: obj_mapper.h:31
int nr_bins_ry
Definition: obj_mapper.h:46
bool is_veh
Definition: obj_mapper.h:34
ObjMapper()
Definition: obj_mapper.h:71
void IBackprojectCanonical(const T *x, const T *K, T depth, T *X)
Definition: i_util.h:164
Eigen::Matrix3d Matrix3d
Definition: base_map_fwd.h:33
float ry
Definition: obj_mapper.h:33
Eigen::Matrix3d get_position_uncertainty()
Definition: obj_mapper.h:103