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

#include <ccrf_type_fusion.h>

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

Public 成员函数

EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init (const TypeFilterInitOption &option) override
 
bool TypeFusion (const TypeFilterOption &option, const std::vector< TrackedObjectConstPtr > &tracked_objects, TrackedObjectPtr new_object) override
 
std::string Name () const override
 

Protected 成员函数

bool FuseWithConditionalProbabilityInference (const std::vector< TrackedObjectConstPtr > &tracked_objects, TrackedObjectPtr new_object)
 
bool RecoverFromLogProbability (Vectord *prob, std::vector< float > *dst, perception::base::ObjectType *type)
 

Protected 属性

CCRFSingleShotTypeFusion one_shot_fuser_
 
Matrixd transition_matrix_
 
apollo::common::EigenVector< Vectordfused_oneshot_probs_
 
apollo::common::EigenVector< Vectordfused_sequence_probs_
 
apollo::common::EigenVector< Vectoristate_back_trace_
 
double s_alpha_ = 1.8
 
bool debug_log_ = false
 

额外继承的成员函数

- Public 类型 继承自 apollo::perception::lidar::BaseMultiShotTypeFusion
typedef ObjectSequence::TrackedObjects TrackedObjects
 

详细描述

在文件 ccrf_type_fusion.h57 行定义.

成员函数说明

◆ FuseWithConditionalProbabilityInference()

bool apollo::perception::lidar::CCRFMultiShotTypeFusion::FuseWithConditionalProbabilityInference ( const std::vector< TrackedObjectConstPtr > &  tracked_objects,
TrackedObjectPtr  new_object 
)
protected

在文件 ccrf_type_fusion.cc174 行定义.

176 {
177 fused_oneshot_probs_.resize(tracked_objects.size() + 1);
178 std::size_t i = 0;
179 for (const auto& obj : tracked_objects) {
180 // ObjectPtr& object = pair.second;
182 &fused_oneshot_probs_[i++])) {
183 AERROR << "Failed to fuse one short probs in sequence.";
184 return false;
185 }
186 }
188 &fused_oneshot_probs_[i++])) {
189 AERROR << "Failed to fuse one short probs for new object.";
190 return false;
191 }
192 // Use viterbi algorithm to infer the state
193 std::size_t length = fused_oneshot_probs_.size();
194 fused_sequence_probs_.resize(length);
195 state_back_trace_.resize(length);
196
198 // Add priori knowledge to suppress the sudden-appeared object types.
199 // fused_sequence_probs_[0] += transition_matrix_.row(0).transpose();
200
201 for (std::size_t i = 1; i < length; ++i) {
202 for (std::size_t right = 0; right < VALID_OBJECT_TYPE; ++right) {
203 double prob = 0.0;
204 double max_prob = -std::numeric_limits<double>::max();
205 std::size_t id = 0;
206 for (std::size_t left = 0; left < VALID_OBJECT_TYPE; ++left) {
207 prob = fused_sequence_probs_[i - 1](left)
208 + transition_matrix_(left, right) * s_alpha_
209 + fused_oneshot_probs_[i](right);
210 if (prob > max_prob) {
211 max_prob = prob;
212 id = left;
213 }
214 }
215 fused_sequence_probs_[i](right) = max_prob;
216 state_back_trace_[i](right) = static_cast<int>(id);
217 }
221 }
222 // ObjectPtr object = tracked_objects->rbegin()->second;
224 &new_object->type_probs, &new_object->type);
225 if (debug_log_) {
226 std::stringstream sstr;
227 sstr << " total_size: " << fused_oneshot_probs_.size();
228 for (size_t i = 0; i < fused_oneshot_probs_.size(); i++) {
232 sstr << " After-Smooth[" << std::to_string(i) << "]: ";
233 for (size_t j = 0; j < 4; j++) {
234 sstr << tmp(j) << ", ";
235 }
236 }
237 ADEBUG << sstr.str();
238 }
239 return true;
240}
apollo::common::EigenVector< Vectord > fused_sequence_probs_
bool RecoverFromLogProbability(Vectord *prob, std::vector< float > *dst, perception::base::ObjectType *type)
apollo::common::EigenVector< Vectori > state_back_trace_
apollo::common::EigenVector< Vectord > fused_oneshot_probs_
bool FuseOneShotTypeProbs(const TrackedObjectConstPtr &new_object, Vectord *log_prob)
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44
void ToExpStable(Vectord *prob)
Compute stable exponential of Vectord
Definition util.cc:58
void ToExp(Vectord *prob)
Compute exponential of Vectord
Definition util.cc:52
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::CCRFMultiShotTypeFusion::Init ( const TypeFilterInitOption option)
overridevirtual

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

在文件 ccrf_type_fusion.cc131 行定义.

131 {
132 TypeFilterInitOption one_shot_fuser_options;
133 one_shot_fuser_options.config_path = options.config_path;
134 ACHECK(one_shot_fuser_.Init(one_shot_fuser_options));
135
136 std::string config_file = "ccrf_type_fusion.conf";
137 if (!options.config_file.empty()) {
138 config_file = options.config_file;
139 }
140 config_file = GetConfigFile(options.config_path, config_file);
141 CCRFTypeFusionConfig config;
142 ACHECK(cyber::common::GetProtoFromFile(config_file, &config));
143
144 std::string transition_property_file_path
145 = GetConfigFile(options.config_path,
146 config.transition_property_file_path());
147 s_alpha_ = config.transition_matrix_alpha();
148 debug_log_ = options.debug_log;
149 ACHECK(type_util::LoadSingleMatrixFile(transition_property_file_path,
151 transition_matrix_ += Matrixd::Ones() * 1e-6;
152 for (std::size_t i = 0; i < VALID_OBJECT_TYPE; ++i) {
154 }
155 AINFO << "TypeTransitionMatrix: " << std::endl << transition_matrix_;
156
157 for (std::size_t i = 0; i < VALID_OBJECT_TYPE; ++i) {
158 for (std::size_t j = 0; j < VALID_OBJECT_TYPE; ++j) {
159 transition_matrix_(i, j) = log(transition_matrix_(i, j));
160 }
161 }
162 AINFO << "TypeTransitionMatrix(Log): " << std::endl << transition_matrix_;
163 return true;
164}
EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init(const TypeFilterInitOption &option) override
#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
bool LoadSingleMatrixFile(const std::string &filename, Matrixd *matrix)
Load single matrix from file
Definition util.cc:94
void NormalizeRow(Matrixd *prob)
Compute normalize row of Matrixd
Definition util.cc:71
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
Definition util.cc:80

◆ Name()

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

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

在文件 ccrf_type_fusion.h68 行定义.

68 {
69 return "CCRFMultiShotTypeFusion";
70 }

◆ RecoverFromLogProbability()

bool apollo::perception::lidar::CCRFMultiShotTypeFusion::RecoverFromLogProbability ( Vectord prob,
std::vector< float > *  dst,
perception::base::ObjectType type 
)
protected

在文件 ccrf_type_fusion.cc242 行定义.

243 {
247 *type = static_cast<ObjectType>(std::distance(dst->begin(),
248 std::max_element(dst->begin(), dst->end())));
249 return true;
250}
void FromEigenToVector(const Vectord &src_prob, std::vector< float > *dst_prob)
Transfrom Eigen to vector
Definition util.cc:37

◆ TypeFusion()

bool apollo::perception::lidar::CCRFMultiShotTypeFusion::TypeFusion ( const TypeFilterOption option,
const std::vector< TrackedObjectConstPtr > &  tracked_objects,
TrackedObjectPtr  new_object 
)
overridevirtual

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

在文件 ccrf_type_fusion.cc166 行定义.

169 {
170 return FuseWithConditionalProbabilityInference(tracked_objects,
171 new_object);
172}
bool FuseWithConditionalProbabilityInference(const std::vector< TrackedObjectConstPtr > &tracked_objects, TrackedObjectPtr new_object)

类成员变量说明

◆ debug_log_

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

在文件 ccrf_type_fusion.h104 行定义.

◆ fused_oneshot_probs_

apollo::common::EigenVector<Vectord> apollo::perception::lidar::CCRFMultiShotTypeFusion::fused_oneshot_probs_
protected

在文件 ccrf_type_fusion.h98 行定义.

◆ fused_sequence_probs_

apollo::common::EigenVector<Vectord> apollo::perception::lidar::CCRFMultiShotTypeFusion::fused_sequence_probs_
protected

在文件 ccrf_type_fusion.h99 行定义.

◆ one_shot_fuser_

CCRFSingleShotTypeFusion apollo::perception::lidar::CCRFMultiShotTypeFusion::one_shot_fuser_
protected

在文件 ccrf_type_fusion.h93 行定义.

◆ s_alpha_

double apollo::perception::lidar::CCRFMultiShotTypeFusion::s_alpha_ = 1.8
protected

在文件 ccrf_type_fusion.h103 行定义.

◆ state_back_trace_

apollo::common::EigenVector<Vectori> apollo::perception::lidar::CCRFMultiShotTypeFusion::state_back_trace_
protected

在文件 ccrf_type_fusion.h100 行定义.

◆ transition_matrix_

Matrixd apollo::perception::lidar::CCRFMultiShotTypeFusion::transition_matrix_
protected

在文件 ccrf_type_fusion.h95 行定义.


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