21#include "modules/perception/lidar_tracking/tracker/multi_lidar_fusion/proto/multi_lidar_fusion_config.pb.h"
31 0.7f, 0.2f, 0.3f, 0.1f, 0.2f, 0.f, 0.f};
36 0.f, 0.f, 0.f, 0.4f, 0.f, 0.6f, 0.0f};
40 std::string config_file =
"mlf_track_object_distance.conf";
52 for (
int i = 0; i < config.foreground_weights_size(); ++i) {
55 std::vector<float> weights(7, 0.f);
56 weights[0] = fgws.location_dist_weight();
57 weights[1] = fgws.direction_dist_weight();
58 weights[2] = fgws.bbox_size_dist_weight();
59 weights[3] = fgws.point_num_dist_weight();
60 weights[4] = fgws.histogram_dist_weight();
61 weights[5] = fgws.centroid_shift_dist_weight();
62 weights[6] = fgws.bbox_iou_dist_weight();
63 weights[7] = fgws.semantic_map_dist_weight();
66 for (
int i = 0; i < config.background_weights_size(); ++i) {
69 std::vector<float> weights(7, 0.f);
70 weights[0] = bgws.location_dist_weight();
71 weights[1] = bgws.direction_dist_weight();
72 weights[2] = bgws.bbox_size_dist_weight();
73 weights[3] = bgws.point_num_dist_weight();
74 weights[4] = bgws.histogram_dist_weight();
75 weights[5] = bgws.centroid_shift_dist_weight();
76 weights[6] = bgws.bbox_iou_dist_weight();
86 bool is_background =
object->is_background;
88 std::string key = latest_object->sensor_info.name +
object->sensor_info.name;
89 const std::vector<float>* weights =
nullptr;
95 weights = &iter->second;
102 weights = &iter->second;
105 if (weights ==
nullptr || weights->size() < 7) {
106 AERROR <<
"Invalid weights";
109 float distance = 0.f;
110 float delta = 1e-10f;
112 double current_time =
object->object_ptr->latest_tracked_time;
113 track->PredictState(current_time);
116 track->age_ ? current_time - track->latest_visible_time_ : 0;
119 float euclidean_distance =
125 if (weights->at(0) > delta) {
130 if (weights->at(1) > delta) {
135 if (weights->at(2) > delta) {
140 if (weights->at(3) > delta) {
145 if (weights->at(4) > delta) {
150 if (weights->at(5) > delta) {
152 track->predict_.state,
155 if (weights->at(6) > delta) {
156 distance += weights->at(6) *
static const std::vector< float > kBackgroundDefaultWeight
std::map< std::string, std::vector< float > > background_weight_table_
float ComputeDistance(const TrackedObjectConstPtr &object, const MlfTrackDataConstPtr &track) const
Compute object track distance
std::map< std::string, std::vector< float > > foreground_weight_table_
float euclidean_distance_threshold_
bool Init(const MlfTrackObjectDistanceInitOptions &options=MlfTrackObjectDistanceInitOptions())
Init mlf track object distance
double background_object_match_threshold_
static const std::vector< float > kForegroundDefaultWeight
float out_gate_match_cost_
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
std::shared_ptr< const MlfTrackData > MlfTrackDataConstPtr
std::shared_ptr< const TrackedObject > TrackedObjectConstPtr
float CentroidShiftDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff)
Compute centroid shift distance for object and background match
float HistogramDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff)
Compute histogram distance for given track & object
float BboxIouDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff, double match_threshold)
Compute bbox iou distance for object and background match
float LocationDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff)
Compute location distance for given track & object
float BboxSizeDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff)
Compute bbox size distance for given track & object
float EuclideanDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff)
: compute euclidean distance for given track & object
float PointNumDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff)
Compute point num distance for given track & object
float DirectionDistance(const TrackedObjectConstPtr &last_object, const Eigen::VectorXf &track_predict, const TrackedObjectConstPtr &new_object, const double time_diff)
Compute direction distance for given track & object
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
optional float out_gate_match_cost
optional float euclidean_distance_threshold
repeated MlfDistanceWeight background_weights
repeated MlfDistanceWeight foreground_weights
optional string sensor_name_pair