Apollo  v5.5.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 <map>
18 #include <memory>
19 #include <string>
20 #include <vector>
21 
24 
25 namespace apollo {
26 namespace perception {
27 namespace lidar {
28 
30  public:
31  bool Init(const TypeFusionInitOption& option) override;
32  bool TypeFusion(const TypeFusionOption& option,
33  std::shared_ptr<perception::base::Object> object) override;
34  std::string Name() const override { return "CCRFOneShotTypeFusion"; }
36  const std::shared_ptr<perception::base::Object>& object,
37  Vectord* log_prob);
38 
39  protected:
40  std::map<std::string, Matrixd> smooth_matrices_;
42 };
43 
45  public:
46  bool Init(const TypeFusionInitOption& option) override;
47  bool TypeFusion(const TypeFusionOption& option,
48  TrackedObjects* tracked_objects) override;
49  std::string Name() const override { return "CCRFSequenceTypeFusion"; }
50 
51  protected:
52  // The fusion problem is modeled
53  // as inferring the discrete state in a chain CRFs.
54  // Note, log(P({X}|O)) =
55  // sigma_i{E_unary(X_i,O)} + sigma_ij{E_pairwise(X_i,X_j)} - logZ;
56  // E_unary(X_i,O) = sigma{logP(classifier)},
57  // E_pairwise(X_i,X_j) = logTransition(X_i,X_j)
58  // a) Maximize the sequence probability P(X_t|{X}^opt,O)
59  // based on optimal state inference.
60  // b) (did not use) Maximize the marginal probability P(X_t|O)
61  // with history state integrated.
62 
63  // window version of Chain-CRFs inference
64  bool FuseWithConditionalProbabilityInference(TrackedObjects* tracked_objects);
65  // util
66  bool RecoverFromLogProbability(Vectord* prob, std::vector<float>* dst,
68 
69  protected:
71  // Note all in the log space
73 
74  // data member for window inference version
75  std::vector<Vectord> fused_oneshot_probs_;
76  std::vector<Vectord> fused_sequence_probs_;
77  std::vector<Vectori> state_back_trace_;
78 
79  protected:
80  double s_alpha_ = 1.8;
81 };
82 
83 } // namespace lidar
84 } // namespace perception
85 } // namespace apollo
std::map< std::string, Matrixd > smooth_matrices_
Definition: ccrf_type_fusion.h:40
ObjectSequence::TrackedObjects TrackedObjects
Definition: type_fusion_interface.h:47
std::vector< Vectord > fused_oneshot_probs_
Definition: ccrf_type_fusion.h:75
Eigen::Matrix< double, VALID_OBJECT_TYPE, 1 > Vectord
Definition: util.h:35
CCRFOneShotTypeFusion one_shot_fuser_
Definition: ccrf_type_fusion.h:70
Definition: blob.h:72
Definition: ccrf_type_fusion.h:44
std::vector< Vectori > state_back_trace_
Definition: ccrf_type_fusion.h:77
Definition: type_fusion_interface.h:31
Definition: type_fusion_interface.h:29
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:37
Definition: type_fusion_interface.h:33
Definition: ccrf_type_fusion.h:29
bool TypeFusion(const TypeFusionOption &option, std::shared_ptr< perception::base::Object > object) override
Matrixd transition_matrix_
Definition: ccrf_type_fusion.h:72
std::string Name() const override
Definition: ccrf_type_fusion.h:34
std::vector< Vectord > fused_sequence_probs_
Definition: ccrf_type_fusion.h:76
Matrixd confidence_smooth_matrix_
Definition: ccrf_type_fusion.h:41
ObjectType
Definition: object_types.h:26
bool Init(const TypeFusionInitOption &option) override
std::string Name() const override
Definition: ccrf_type_fusion.h:49
Definition: type_fusion_interface.h:45