Apollo  v5.5.0
Open source self driving car software
track_object_similarity.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
18 #include <vector>
19 
25 
26 namespace apollo {
27 namespace perception {
28 namespace fusion {
29 
31  float welsh_loss_thresh_ = 0.5f;
32  float welsh_loss_scale_ = 0.3f;
33  float scale_positive_max_p_ = 0.9f;
34  float scale_positive_th_p_ = 0.5f;
35 }; // struct XSimilarityParams
37  float smooth_factor_ = 0.3f;
38  float diff_std_dev_ = 0.2f;
39  float bounded_scale_positive_max_p_ = 0.6f;
40  float bounded_scale_positive_min_p_ = 0.5f;
41 }; // struct YSimilarityParams
43  float initial_similarity_ = 0.5f;
44  float diff_std_dev_ = 0.1f;
45  float scale_positive_max_p_ = 0.9f;
46  float scale_positive_th_p_ = 0.5f;
47 }; // struct HSimilarityParams
49  float diff_std_dev_ = 0.1f;
50  float bounded_scale_positive_max_p_ = 0.7f;
51  float bounded_scale_positive_min_p_ = 0.5f;
52 }; // struct WSimilarityParams
54  float welsh_loss_thresh_ = 0.05f;
55  float welsh_loss_scale_ = 0.05f;
56  float scale_positive_max_p_ = 0.7f;
57  float scale_positive_th_p_ = 0.5f;
58 }; // struct LocSimilarityParams
59 
60 // @brief: calculate the location similarity btween cloud and camera box
61 // @return the localtion similarity which belongs to [0, 1]. When cloud's
62 // location close to the camera box's, the similarity would close to 1.
63 // Otherwise, it would close to 0.
64 // @NOTE: original method name is compute_pts_box_dist_score
66  const ProjectionCacheObject* object,
67  const base::BBox2DF& camera_bbox);
68 // @brief: calculate the shape similarity between cloud and camera box
69 // @return the shape similarity which belongs to [0, 1]. When cloud's shape
70 // close to the camera box's, the simialrity would close to 1. Otherwise,
71 // it would close to 0.
72 // @NOTE: original method name is compute_pts_box_shape_score
74  const ProjectionCacheObject* object,
75  const base::BBox2DF& camera_bbox);
76 // @brief: calculate the similarity between cloud and camera box
77 // @return the similarity which belongs to [0, 1].
78 // @key idea:
79 // 1. compute location similarity and shape similarity
80 // 2. fuse the two similarity calculated above
81 // @NOTE: original method name is compute_pts_box_score
83  const ProjectionCacheObject* object,
84  const base::BBox2DF& camera_bbox);
85 // @brief: calculate the x/y/h/w/3d similarity between radar and camera
86 // @return the similarity which belongs to [0, 1].
87 // @key idea:
88 // 1. compute the difference on x/y/h/w/3d
89 // 2. compute similarity according to the WelshVarLoss/ChiSquareProb
90 // 3. scale the similarity above
91 double ComputeRadarCameraXSimilarity(const double velo_ct_x,
92  const double camera_ct_x,
93  const double size_x,
94  const XSimilarityParams& params);
95 double ComputeRadarCameraYSimilarity(const double velo_ct_y,
96  const double camera_ct_y,
97  const double size_y,
98  const YSimilarityParams& params);
100  const SensorObjectConstPtr& radar, const SensorObjectConstPtr& camera,
101  const double size_y,
102  const std::vector<Eigen::Vector2d>& radar_box2d_vertices,
103  const HSimilarityParams& params);
105  const SensorObjectConstPtr& radar, const double width, const double size_x,
106  const std::vector<Eigen::Vector2d>& radar_box2d_vertices,
107  const WSimilarityParams& params);
108 double ComputeRadarCameraLocSimilarity(const Eigen::Vector3d& radar_ct,
109  const SensorObjectConstPtr& camera,
110  const Eigen::Matrix4d& world2camera_pose,
111  const LocSimilarityParams& params);
113  const SensorObjectConstPtr& camera);
114 
115 } // namespace fusion
116 } // namespace perception
117 } // namespace apollo
double ComputePtsBoxShapeSimilarity(const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)
double ComputePtsBoxLocationSimilarity(const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)
double ComputeRadarCameraHSimilarity(const SensorObjectConstPtr &radar, const SensorObjectConstPtr &camera, const double size_y, const std::vector< Eigen::Vector2d > &radar_box2d_vertices, const HSimilarityParams &params)
Definition: blob.h:72
Definition: track_object_similarity.h:53
Definition: projection_cache.h:32
float welsh_loss_scale_
Definition: track_object_similarity.h:32
double ComputeRadarCameraVelocitySimilarity(const SensorObjectConstPtr &radar, const SensorObjectConstPtr &camera)
Definition: track_object_similarity.h:30
float welsh_loss_thresh_
Definition: track_object_similarity.h:31
Definition: projection_cache.h:93
float scale_positive_th_p_
Definition: track_object_similarity.h:34
double ComputeRadarCameraXSimilarity(const double velo_ct_x, const double camera_ct_x, const double size_x, const XSimilarityParams &params)
double ComputePtsBoxSimilarity(const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)
Definition: track_object_similarity.h:42
double ComputeRadarCameraLocSimilarity(const Eigen::Vector3d &radar_ct, const SensorObjectConstPtr &camera, const Eigen::Matrix4d &world2camera_pose, const LocSimilarityParams &params)
Definition: track_object_similarity.h:36
double ComputeRadarCameraWSimilarity(const SensorObjectConstPtr &radar, const double width, const double size_x, const std::vector< Eigen::Vector2d > &radar_box2d_vertices, const WSimilarityParams &params)
float scale_positive_max_p_
Definition: track_object_similarity.h:33
Definition: track_object_similarity.h:48
std::shared_ptr< const SensorObject > SensorObjectConstPtr
Definition: sensor_object.h:69
double ComputeRadarCameraYSimilarity(const double velo_ct_y, const double camera_ct_y, const double size_y, const YSimilarityParams &params)