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

#include <ccrf_type_fusion.h>

类 apollo::perception::radar4d::CCRFSequenceTypeFusion 继承关系图:
apollo::perception::radar4d::CCRFSequenceTypeFusion 的协作图:

Public 成员函数

EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init (const TypeFusionInitOption &option) override
 Init type fusion
 
bool TypeFusion (const TypeFusionOption &option, TrackedObjects *tracked_objects) override
 Type fusion of tracked object
 
std::string Name () const override
 Get class name
 

Protected 成员函数

bool FuseWithConditionalProbabilityInference (TrackedObjects *tracked_objects)
 
bool RecoverFromLogProbability (Vectord *prob, std::vector< float > *dst, perception::base::ObjectType *type)
 

Protected 属性

CCRFOneShotTypeFusion 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
 

额外继承的成员函数

- Public 类型 继承自 apollo::perception::radar4d::BaseSequenceTypeFusion
typedef ObjectSequence::TrackedObjects TrackedObjects
 

详细描述

在文件 ccrf_type_fusion.h79 行定义.

成员函数说明

◆ FuseWithConditionalProbabilityInference()

bool apollo::perception::radar4d::CCRFSequenceTypeFusion::FuseWithConditionalProbabilityInference ( TrackedObjects tracked_objects)
protected

在文件 ccrf_type_fusion.cc167 行定义.

168 {
169 // AINFO << "Enter fuse with conditional probability inference";
170 fused_oneshot_probs_.resize(tracked_objects->size());
171
172 std::size_t i = 0;
173 for (auto& pair : *tracked_objects) {
174 ObjectPtr& object = pair.second;
176 &fused_oneshot_probs_[i++])) {
177 AERROR << "Failed to fuse one short probs in sequence.";
178 return false;
179 }
180 }
181
182 // Use viterbi algorithm to infer the state
183 std::size_t length = tracked_objects->size();
184 fused_sequence_probs_.resize(length);
185 state_back_trace_.resize(length);
186
188 // Add priori knowledge to suppress the sudden-appeared object types.
189 fused_sequence_probs_[0] += transition_matrix_.row(0).transpose();
190
191 for (std::size_t i = 1; i < length; ++i) {
192 for (std::size_t right = 0; right < VALID_OBJECT_TYPE; ++right) {
193 double prob = 0.0;
194 double max_prob = -std::numeric_limits<double>::max();
195 std::size_t id = 0;
196 for (std::size_t left = 0; left < VALID_OBJECT_TYPE; ++left) {
197 prob = fused_sequence_probs_[i - 1](left) +
198 transition_matrix_(left, right) * s_alpha_ +
199 fused_oneshot_probs_[i](right);
200 if (prob > max_prob) {
201 max_prob = prob;
202 id = left;
203 }
204 }
205 fused_sequence_probs_[i](right) = max_prob;
206 state_back_trace_[i](right) = static_cast<int>(id);
207 }
208 }
209 ObjectPtr object = tracked_objects->rbegin()->second;
210 RecoverFromLogProbability(&fused_sequence_probs_.back(), &object->type_probs,
211 &object->type);
212 return true;
213}
bool FuseOneShotTypeProbs(const std::shared_ptr< perception::base::Object > &object, Vectord *log_prob)
Get object type probabilities
bool RecoverFromLogProbability(Vectord *prob, std::vector< float > *dst, perception::base::ObjectType *type)
apollo::common::EigenVector< Vectord > fused_sequence_probs_
apollo::common::EigenVector< Vectori > state_back_trace_
apollo::common::EigenVector< Vectord > fused_oneshot_probs_
#define AERROR
Definition log.h:44
std::shared_ptr< apollo::perception::base::Object > ObjectPtr

◆ Init()

bool apollo::perception::radar4d::CCRFSequenceTypeFusion::Init ( const TypeFusionInitOption option)
overridevirtual

Init type fusion

参数
option
返回
true
false

实现了 apollo::perception::radar4d::BaseSequenceTypeFusion.

在文件 ccrf_type_fusion.cc125 行定义.

125 {
126 TypeFusionInitOption one_shot_fuser_options;
127 one_shot_fuser_options.config_path = options.config_path;
128 ACHECK(one_shot_fuser_.Init(one_shot_fuser_options));
129
130 std::string config_file = "ccrf_type_fusion.pb.txt";
131 if (!options.config_file.empty()) {
132 config_file = options.config_file;
133 }
134 config_file = GetConfigFile(options.config_path, config_file);
135 CcrfTypeFusionConfig config;
136 ACHECK(cyber::common::GetProtoFromFile(config_file, &config));
137 std::string transition_property_file_path =
139 options.config_path, config.transition_property_file_path());
140 s_alpha_ = config.transition_matrix_alpha();
141 ACHECK(util::LoadSingleMatrixFile(transition_property_file_path,
143 transition_matrix_ += Matrixd::Ones() * 1e-6;
145 AINFO << "transition matrix";
146 AINFO << std::endl << transition_matrix_;
147 for (std::size_t i = 0; i < VALID_OBJECT_TYPE; ++i) {
148 for (std::size_t j = 0; j < VALID_OBJECT_TYPE; ++j) {
149 transition_matrix_(i, j) = log(transition_matrix_(i, j));
150 }
151 }
152 AINFO << std::endl << transition_matrix_;
153 return true;
154}
EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init(const TypeFusionInitOption &option) override
INit type fusion
#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::radar4d::CCRFSequenceTypeFusion::Name ( ) const
inlineoverridevirtual

Get class name

返回
std::string

实现了 apollo::perception::radar4d::BaseSequenceTypeFusion.

在文件 ccrf_type_fusion.h105 行定义.

105{ return "CCRFSequenceTypeFusion"; }

◆ RecoverFromLogProbability()

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

◆ TypeFusion()

bool apollo::perception::radar4d::CCRFSequenceTypeFusion::TypeFusion ( const TypeFusionOption option,
TrackedObjects tracked_objects 
)
overridevirtual

Type fusion of tracked object

参数
option
tracked_objectsupdate the type probs of the tracked object
返回
true
false

实现了 apollo::perception::radar4d::BaseSequenceTypeFusion.

在文件 ccrf_type_fusion.cc156 行定义.

157 {
158 if (tracked_objects == nullptr) {
159 return false;
160 }
161 if (tracked_objects->empty()) {
162 return false;
163 }
164 return FuseWithConditionalProbabilityInference(tracked_objects);
165}
bool FuseWithConditionalProbabilityInference(TrackedObjects *tracked_objects)

类成员变量说明

◆ fused_oneshot_probs_

apollo::common::EigenVector<Vectord> apollo::perception::radar4d::CCRFSequenceTypeFusion::fused_oneshot_probs_
protected

在文件 ccrf_type_fusion.h131 行定义.

◆ fused_sequence_probs_

apollo::common::EigenVector<Vectord> apollo::perception::radar4d::CCRFSequenceTypeFusion::fused_sequence_probs_
protected

在文件 ccrf_type_fusion.h132 行定义.

◆ one_shot_fuser_

CCRFOneShotTypeFusion apollo::perception::radar4d::CCRFSequenceTypeFusion::one_shot_fuser_
protected

在文件 ccrf_type_fusion.h126 行定义.

◆ s_alpha_

double apollo::perception::radar4d::CCRFSequenceTypeFusion::s_alpha_ = 1.8
protected

在文件 ccrf_type_fusion.h136 行定义.

◆ state_back_trace_

apollo::common::EigenVector<Vectori> apollo::perception::radar4d::CCRFSequenceTypeFusion::state_back_trace_
protected

在文件 ccrf_type_fusion.h133 行定义.

◆ transition_matrix_

Matrixd apollo::perception::radar4d::CCRFSequenceTypeFusion::transition_matrix_
protected

在文件 ccrf_type_fusion.h128 行定义.


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