Apollo  6.0
Open source self driving car software
junction_map_evaluator.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 
17 #pragma once
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
26 #include "torch/extension.h"
27 #include "torch/script.h"
28 
29 namespace apollo {
30 namespace prediction {
31 
33  public:
37  JunctionMapEvaluator() = delete;
38  explicit JunctionMapEvaluator(SemanticMap* semantic_map);
39 
43  virtual ~JunctionMapEvaluator() = default;
44 
48  void Clear();
49 
55  bool Evaluate(Obstacle* obstacle_ptr,
56  ObstaclesContainer* obstacles_container) override;
57 
63  bool ExtractFeatureValues(Obstacle* obstacle_ptr,
64  std::vector<double>* feature_values);
65 
69  std::string GetName() override { return "JUNCTION_MAP_EVALUATOR"; }
70 
71  private:
75  void LoadModel();
76 
77  private:
78  // junction exit mask
79  static const size_t JUNCTION_FEATURE_SIZE = 12;
80  torch::jit::script::Module torch_model_;
81  torch::Device device_;
82  SemanticMap* semantic_map_;
83 };
84 
85 } // namespace prediction
86 } // namespace apollo
Prediction obstacle.
Definition: obstacle.h:52
Definition: obstacles_container.h:39
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
virtual ~JunctionMapEvaluator()=default
Destructor.
Definition: semantic_map.h:30
JunctionMapEvaluator()=delete
Constructor.
std::string GetName() override
Get the name of evaluator.
Definition: junction_map_evaluator.h:69
Obstacles container.
bool Evaluate(Obstacle *obstacle_ptr, ObstaclesContainer *obstacles_container) override
Override Evaluate.
bool ExtractFeatureValues(Obstacle *obstacle_ptr, std::vector< double > *feature_values)
Extract feature vector.
Definition: evaluator.h:39
Definition: junction_map_evaluator.h:32
void Clear()
Clear obstacle feature map.
Define the data container base class.