Apollo  6.0
Open source self driving car software
semantic_lstm_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 <string>
20 #include <utility>
21 #include <vector>
22 
25 #include "torch/extension.h"
26 #include "torch/script.h"
27 
28 namespace apollo {
29 namespace prediction {
30 
32  public:
36  SemanticLSTMEvaluator() = delete;
37  explicit SemanticLSTMEvaluator(SemanticMap* semantic_map);
38 
42  virtual ~SemanticLSTMEvaluator() = default;
43 
47  void Clear();
48 
54  bool Evaluate(Obstacle* obstacle_ptr,
55  ObstaclesContainer* obstacles_container) override;
56 
63  Obstacle* obstacle_ptr,
64  std::vector<std::pair<double, double>>* pos_history);
65 
69  std::string GetName() override { return "SEMANTIC_LSTM_EVALUATOR"; }
70 
71  private:
75  void LoadModel();
76 
77  private:
78  torch::jit::script::Module torch_vehicle_model_;
79  torch::jit::script::Module torch_pedestrian_model_;
80  at::Tensor torch_default_output_tensor_;
81  torch::Device device_;
82  SemanticMap* semantic_map_;
83 };
84 
85 } // namespace prediction
86 } // namespace apollo
SemanticLSTMEvaluator()=delete
Constructor.
Prediction obstacle.
Definition: obstacle.h:52
bool Evaluate(Obstacle *obstacle_ptr, ObstaclesContainer *obstacles_container) override
Override Evaluate.
Definition: obstacles_container.h:39
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool ExtractObstacleHistory(Obstacle *obstacle_ptr, std::vector< std::pair< double, double >> *pos_history)
Extract obstacle history.
Definition: semantic_map.h:30
std::string GetName() override
Get the name of evaluator.
Definition: semantic_lstm_evaluator.h:69
Definition: semantic_lstm_evaluator.h:31
void Clear()
Clear obstacle feature map.
virtual ~SemanticLSTMEvaluator()=default
Destructor.
Definition: evaluator.h:39
Define the data container base class.