Apollo  6.0
Open source self driving car software
ccrf_type_fusion.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 #include <functional>
18 #include <map>
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
26 
27 namespace apollo {
28 namespace perception {
29 namespace lidar {
30 
32  public:
33  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
34 
35  bool Init(const TypeFusionInitOption& option) override;
36  bool TypeFusion(const TypeFusionOption& option,
37  std::shared_ptr<perception::base::Object> object) override;
38  std::string Name() const override { return "CCRFOneShotTypeFusion"; }
40  const std::shared_ptr<perception::base::Object>& object,
41  Vectord* log_prob);
42 
43  protected:
46 };
47 
49  public:
50  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
51 
52  bool Init(const TypeFusionInitOption& option) override;
53  bool TypeFusion(const TypeFusionOption& option,
54  TrackedObjects* tracked_objects) override;
55  std::string Name() const override { return "CCRFSequenceTypeFusion"; }
56 
57  protected:
58  // The fusion problem is modeled
59  // as inferring the discrete state in a chain CRFs.
60  // Note, log(P({X}|O)) =
61  // sigma_i{E_unary(X_i,O)} + sigma_ij{E_pairwise(X_i,X_j)} - logZ;
62  // E_unary(X_i,O) = sigma{logP(classifier)},
63  // E_pairwise(X_i,X_j) = logTransition(X_i,X_j)
64  // a) Maximize the sequence probability P(X_t|{X}^opt,O)
65  // based on optimal state inference.
66  // b) (did not use) Maximize the marginal probability P(X_t|O)
67  // with history state integrated.
68 
69  // window version of Chain-CRFs inference
70  bool FuseWithConditionalProbabilityInference(TrackedObjects* tracked_objects);
71  // util
72  bool RecoverFromLogProbability(Vectord* prob, std::vector<float>* dst,
74 
75  protected:
77  // Note all in the log space
79 
80  // data member for window inference version
84 
85  protected:
86  double s_alpha_ = 1.8;
87 };
88 
89 } // namespace lidar
90 } // namespace perception
91 } // namespace apollo
std::vector< EigenType, Eigen::aligned_allocator< EigenType > > EigenVector
Definition: eigen_defs.h:32
ObjectSequence::TrackedObjects TrackedObjects
Definition: type_fusion_interface.h:47
Eigen::Matrix< double, VALID_OBJECT_TYPE, 1 > Vectord
Definition: util.h:37
apollo::common::EigenMap< std::string, Matrixd > smooth_matrices_
Definition: ccrf_type_fusion.h:44
CCRFOneShotTypeFusion one_shot_fuser_
Definition: ccrf_type_fusion.h:76
apollo::common::EigenVector< Vectori > state_back_trace_
Definition: ccrf_type_fusion.h:83
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: ccrf_type_fusion.h:48
Definition: type_fusion_interface.h:31
Definition: type_fusion_interface.h:29
std::map< T, EigenType, std::less< T >, Eigen::aligned_allocator< std::pair< const T, EigenType > >> EigenMap
Definition: eigen_defs.h:36
bool FuseOneShotTypeProbs(const std::shared_ptr< perception::base::Object > &object, Vectord *log_prob)
Eigen::Matrix< double, VALID_OBJECT_TYPE, VALID_OBJECT_TYPE > Matrixd
Definition: util.h:39
Definition: type_fusion_interface.h:33
Definition: ccrf_type_fusion.h:31
apollo::common::EigenVector< Vectord > fused_sequence_probs_
Definition: ccrf_type_fusion.h:82
bool TypeFusion(const TypeFusionOption &option, std::shared_ptr< perception::base::Object > object) override
Matrixd transition_matrix_
Definition: ccrf_type_fusion.h:78
std::string Name() const override
Definition: ccrf_type_fusion.h:38
Matrixd confidence_smooth_matrix_
Definition: ccrf_type_fusion.h:45
ObjectType
Definition: object_types.h:26
apollo::common::EigenVector< Vectord > fused_oneshot_probs_
Definition: ccrf_type_fusion.h:81
std::string Name() const override
Definition: ccrf_type_fusion.h:55
EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool Init(const TypeFusionInitOption &option) override
Definition: type_fusion_interface.h:45