Apollo 10.0
自动驾驶开放平台
mlp_evaluator.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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
25#include "modules/prediction/proto/fnn_vehicle_model.pb.h"
26
27namespace apollo {
28namespace prediction {
29
30class MLPEvaluator : public Evaluator {
31 public:
36
40 virtual ~MLPEvaluator() = default;
41
47 bool Evaluate(Obstacle* obstacle_ptr,
48 ObstaclesContainer* obstacles_container) override;
49
55 void ExtractFeatureValues(Obstacle* obstacle_ptr,
56 LaneSequence* lane_sequence_ptr,
57 std::vector<double>* feature_values);
58
62 std::string GetName() override { return "MLP_EVALUATOR"; }
63
67 void Clear();
68
69 private:
75 void SetObstacleFeatureValues(Obstacle* obstacle_ptr,
76 std::vector<double>* feature_values);
77
84 void SetLaneFeatureValues(Obstacle* obstacle_ptr,
85 LaneSequence* lane_sequence_ptr,
86 std::vector<double>* feature_values);
87
92 void LoadModel(const std::string& model_file);
93
97 double ComputeProbability(const std::vector<double>& feature_values);
98
104 void SaveOfflineFeatures(LaneSequence* sequence,
105 const std::vector<double>& feature_values);
106
107 private:
108 static const size_t OBSTACLE_FEATURE_SIZE = 22;
109 static const size_t LANE_FEATURE_SIZE = 40;
110
111 std::unique_ptr<FnnVehicleModel> model_ptr_;
112};
113
114} // namespace prediction
115} // namespace apollo
std::string GetName() override
Get the name of evaluator.
void Clear()
Clear obstacle feature map
bool Evaluate(Obstacle *obstacle_ptr, ObstaclesContainer *obstacles_container) override
Override Evaluate
virtual ~MLPEvaluator()=default
Destructor
void ExtractFeatureValues(Obstacle *obstacle_ptr, LaneSequence *lane_sequence_ptr, std::vector< double > *feature_values)
Extract feature vector
Prediction obstacle.
Definition obstacle.h:52
class register implement
Definition arena_queue.h:37
Obstacles container
Define the data container base class