Apollo 11.0
自动驾驶开放平台
apollo::perception::lidar::CCRFSingleShotTypeFusion类 参考

#include <ccrf_type_fusion.h>

类 apollo::perception::lidar::CCRFSingleShotTypeFusion 继承关系图:
apollo::perception::lidar::CCRFSingleShotTypeFusion 的协作图:

Public 成员函数

EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init (const TypeFilterInitOption &option) override
 
bool TypeFusion (const TypeFilterOption &option, TrackedObjectPtr new_object) override
 
std::string Name () const override
 
bool FuseOneShotTypeProbs (const TrackedObjectConstPtr &new_object, Vectord *log_prob)
 

Protected 属性

apollo::common::EigenMap< std::string, Matrixdsmooth_matrices_
 
Matrixd confidence_smooth_matrix_
 
bool debug_log_ = false
 

详细描述

在文件 ccrf_type_fusion.h35 行定义.

成员函数说明

◆ FuseOneShotTypeProbs()

bool apollo::perception::lidar::CCRFSingleShotTypeFusion::FuseOneShotTypeProbs ( const TrackedObjectConstPtr new_object,
Vectord log_prob 
)

在文件 ccrf_type_fusion.cc85 行定义.

86 {
87 const auto& object = new_object->object_ptr;
88 if (log_prob == nullptr) {
89 return false;
90 }
91 const auto& vecs = object->lidar_supplement.raw_probs;
92 const auto& names = object->lidar_supplement.raw_classification_methods;
93 if (vecs.empty()) {
94 return false;
95 }
96
97 log_prob->setZero();
98
99 Vectord single_prob;
100 static const Vectord epsilon = Vectord::Ones() * 1e-6;
101 float conf = object->confidence;
102 for (size_t i = 0; i < vecs.size(); ++i) {
103 auto& vec = vecs[i];
104 // avoid parsing-wrong-type-probs
105 size_t type_count = static_cast<size_t>(ObjectType::MAX_OBJECT_TYPE);
106 if (vec.size() != type_count) {
107 AERROR << "[TypeFilter] Encounter Unknown type_probs";
108 continue;
109 }
110 type_util::FromStdToVector(vec, &single_prob);
111 auto iter = smooth_matrices_.find(names[i]);
112 if (iter == smooth_matrices_.end()) {
113 single_prob = single_prob + epsilon;
114 } else {
115 single_prob = iter->second * single_prob + epsilon;
116 }
117 type_util::Normalize(&single_prob);
118 // p(c|x) = p(c|x,o)p(o|x)+ p(c|x,~o)p(~o|x)
119 Vectord tmp = confidence_smooth_matrix_ * single_prob;
121 single_prob = conf * single_prob + (1.0 - conf) * tmp;
122
123 type_util::Normalize(&single_prob);
124 type_util::ToLog(&single_prob);
125 *log_prob += single_prob;
126 }
127
128 return true;
129}
apollo::common::EigenMap< std::string, Matrixd > smooth_matrices_
#define AERROR
Definition log.h:44
void FromStdToVector(const std::vector< float > &src_prob, Vectord *dst_prob)
From std to vector
Definition util.cc:29
void ToLog(Vectord *prob)
Compute log of Vectord
Definition util.cc:46
void Normalize(Vectord *prob)
Compute normalize of Vectord
Definition util.cc:65
Eigen::Matrix< double, VALID_OBJECT_TYPE, 1 > Vectord
Definition util.h:38

◆ Init()

bool apollo::perception::lidar::CCRFSingleShotTypeFusion::Init ( const TypeFilterInitOption option)
overridevirtual

实现了 apollo::perception::lidar::BaseSingleShotTypeFusion.

在文件 ccrf_type_fusion.cc36 行定义.

36 {
37 std::string config_file = "ccrf_type_fusion.conf";
38 if (!options.config_file.empty()) {
39 config_file = options.config_file;
40 }
41 config_file = GetConfigFile(options.config_path, config_file);
42
43 CCRFTypeFusionConfig config;
44 ACHECK(cyber::common::GetProtoFromFile(config_file, &config));
45 std::string classifiers_property_file_path
46 = GetConfigFile(options.config_path,
47 config.classifiers_property_file_path());
48 debug_log_ = options.debug_log;
49 ACHECK(type_util::LoadMultipleMatricesFile(classifiers_property_file_path,
51
52 for (auto& pair : smooth_matrices_) {
53 type_util::NormalizeRow(&pair.second);
54 pair.second.transposeInPlace();
55 AINFO << "Source: " << pair.first << std::endl << pair.second;
56 }
57
58 confidence_smooth_matrix_ = Matrixd::Identity();
59 auto iter = smooth_matrices_.find("Confidence");
60 if (iter != smooth_matrices_.end()) {
61 confidence_smooth_matrix_ = iter->second;
62 smooth_matrices_.erase(iter);
63 }
64 AINFO << "ConfSmoothMatrix: " << std::endl << confidence_smooth_matrix_;
65
66 return true;
67}
#define ACHECK(cond)
Definition log.h:80
#define AINFO
Definition log.h:42
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,...
Definition file.cc:132
void NormalizeRow(Matrixd *prob)
Compute normalize row of Matrixd
Definition util.cc:71
bool LoadMultipleMatricesFile(const std::string &filename, EigenMap< std::string, Matrixd > *matrices)
Definition util.cc:108
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
Definition util.cc:80

◆ Name()

std::string apollo::perception::lidar::CCRFSingleShotTypeFusion::Name ( ) const
inlineoverridevirtual

实现了 apollo::perception::lidar::BaseSingleShotTypeFusion.

在文件 ccrf_type_fusion.h44 行定义.

44 {
45 return "CCRFSingleShotTypeFusion";
46 }

◆ TypeFusion()

bool apollo::perception::lidar::CCRFSingleShotTypeFusion::TypeFusion ( const TypeFilterOption option,
TrackedObjectPtr  new_object 
)
overridevirtual

实现了 apollo::perception::lidar::BaseSingleShotTypeFusion.

在文件 ccrf_type_fusion.cc69 行定义.

70 {
71 Vectord log_prob;
72 if (!FuseOneShotTypeProbs(new_object, &log_prob)) {
73 return false;
74 }
75 type_util::ToExp(&log_prob);
76 type_util::Normalize(&log_prob);
77 type_util::FromEigenToVector(log_prob, &(new_object->type_probs));
78 new_object->type = static_cast<ObjectType>(std::distance(
79 new_object->type_probs.begin(),
80 std::max_element(new_object->type_probs.begin(),
81 new_object->type_probs.end())));
82 return true;
83}
bool FuseOneShotTypeProbs(const TrackedObjectConstPtr &new_object, Vectord *log_prob)
void ToExp(Vectord *prob)
Compute exponential of Vectord
Definition util.cc:52
void FromEigenToVector(const Vectord &src_prob, std::vector< float > *dst_prob)
Transfrom Eigen to vector
Definition util.cc:37

类成员变量说明

◆ confidence_smooth_matrix_

Matrixd apollo::perception::lidar::CCRFSingleShotTypeFusion::confidence_smooth_matrix_
protected

在文件 ccrf_type_fusion.h53 行定义.

◆ debug_log_

bool apollo::perception::lidar::CCRFSingleShotTypeFusion::debug_log_ = false
protected

在文件 ccrf_type_fusion.h54 行定义.

◆ smooth_matrices_

apollo::common::EigenMap<std::string, Matrixd> apollo::perception::lidar::CCRFSingleShotTypeFusion::smooth_matrices_
protected

在文件 ccrf_type_fusion.h52 行定义.


该类的文档由以下文件生成: