32using ObjectPtr = std::shared_ptr<apollo::perception::base::Object>;
36 std::string config_file =
"ccrf_type_fusion.pb.txt";
43 std::string classifiers_property_file_path =
51 pair.second.transposeInPlace();
52 AINFO <<
"Source: " << pair.first;
53 AINFO << std::endl << pair.second;
62 AINFO <<
"Confidence: ";
70 if (
object ==
nullptr) {
80 object->type =
static_cast<ObjectType
>(std::distance(
81 object->type_probs.begin(),
82 std::max_element(object->type_probs.begin(), object->type_probs.end())));
88 if (
object ==
nullptr) {
91 if (log_prob ==
nullptr) {
94 const auto& vecs =
object->radar4d_supplement.raw_probs;
95 const auto& names =
object->radar4d_supplement.raw_classification_methods;
103 static const Vectord epsilon = Vectord::Ones() * 1e-6;
104 float conf =
object->confidence;
105 for (
size_t i = 0; i < vecs.size(); ++i) {
110 single_prob = single_prob + epsilon;
112 single_prob = iter->second * single_prob + epsilon;
116 single_prob = conf * single_prob +
119 *log_prob += single_prob;
130 std::string config_file =
"ccrf_type_fusion.pb.txt";
137 std::string transition_property_file_path =
145 AINFO <<
"transition matrix";
158 if (tracked_objects ==
nullptr) {
161 if (tracked_objects->empty()) {
173 for (
auto& pair : *tracked_objects) {
177 AERROR <<
"Failed to fuse one short probs in sequence.";
183 std::size_t length = tracked_objects->size();
191 for (std::size_t i = 1; i < length; ++i) {
194 double max_prob = -std::numeric_limits<double>::max();
200 if (prob > max_prob) {
209 ObjectPtr object = tracked_objects->rbegin()->second;
216 std::vector<float>* dst,
221 *type =
static_cast<ObjectType
>(
222 std::distance(dst->begin(), std::max_element(dst->begin(), dst->end())));
ObjectSequence::TrackedObjects TrackedObjects
bool TypeFusion(const TypeFusionOption &option, std::shared_ptr< perception::base::Object > object) override
Type fusion of objects
Matrixd confidence_smooth_matrix_
EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init(const TypeFusionInitOption &option) override
INit type fusion
bool FuseOneShotTypeProbs(const std::shared_ptr< perception::base::Object > &object, Vectord *log_prob)
Get object type probabilities
apollo::common::EigenMap< std::string, Matrixd > smooth_matrices_
bool TypeFusion(const TypeFusionOption &option, TrackedObjects *tracked_objects) override
Type fusion of tracked object
bool RecoverFromLogProbability(Vectord *prob, std::vector< float > *dst, perception::base::ObjectType *type)
bool FuseWithConditionalProbabilityInference(TrackedObjects *tracked_objects)
Matrixd transition_matrix_
apollo::common::EigenVector< Vectord > fused_sequence_probs_
CCRFOneShotTypeFusion one_shot_fuser_
apollo::common::EigenVector< Vectori > state_back_trace_
apollo::common::EigenVector< Vectord > fused_oneshot_probs_
EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init(const TypeFusionInitOption &option) override
Init type fusion
#define PERCEPTION_REGISTER_ONESHOTTYPEFUSION(name)
#define PERCEPTION_REGISTER_SEQUENCETYPEFUSION(name)
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,...
void ToExpStable(Vectord *prob)
Compute stable exponential of Vectord
bool LoadSingleMatrixFile(const std::string &filename, Matrixd *matrix)
Load single matrix from file
void ToExp(Vectord *prob)
Compute exponential of Vectord
bool LoadMultipleMatricesFile(const std::string &filename, EigenMap< std::string, Matrixd > *matrices)
void Normalize(Vectord *prob)
Compute normalize of Vectord
void ToLog(Vectord *prob)
Compute log of Vectord
void NormalizeRow(Matrixd *prob)
Compute normalize row of Matrixd
void FromEigenToVector(const Vectord &src_prob, std::vector< float > *dst_prob)
Transfrom Eigen to vector
void FromStdToVector(const std::vector< float > &src_prob, Vectord *dst_prob)
From std to vector
std::shared_ptr< apollo::perception::base::Object > ObjectPtr
Eigen::Matrix< double, VALID_OBJECT_TYPE, 1 > Vectord
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
optional string classifiers_property_file_path
optional string transition_property_file_path
optional float transition_matrix_alpha