1 Star 0 Fork 1K

my_intellegent_team / apollo

forked from ApolloAuto / apollo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
how_to_add_a_new_evaluator_in_prediction_module.md 3.01 KB
一键复制 编辑 原始数据 按行查看 历史
Natasha Dsouza 提交于 2018-06-20 17:05 . updating how-tos

How to add a new evaluator in Prediction module

Introduction

The Evaluator generates features (from the raw information of obstacles and the ego vehicle) to get the model output by applying the pre-trained deep learning model.

Steps to add a new evaluator

Please follow the steps to add a new evaluator named NewEvaluator.

  1. Add a field in proto
  2. Define a class that inherits Evaluator
  3. Implement the class NewEvaluator
  4. Update prediction conf
  5. Upate the evaluator manager

Define a class that inherits Evaluator

Create a new file named new_evaluator.h in the folder modules/prediction/evaluator/vehicle. And define it like this:

#include "modules/prediction/evaluator/evaluator.h"

namespace apollo {
namespace prediction {

class NewEvaluator : public Evaluator {
 public:
  NewEvaluator();
  virtual ~NewEvaluator();
  void Evaluate(Obstacle* obstacle_ptr) override;
  // Other useful functions and fields.
};

}  // namespace prediction
}  // namespace apollo

Implement the class NewEvaluator

Create a new file named new_evaluator.cc in the same folder as that of new_evaluator.h. Implement it like this:

#include "modules/prediction/evaluator/vehicle/new_evaluator.h"

namespace apollo {
namespace prediction {

NewEvaluator::NewEvaluator() {
  // Implement
}

NewEvaluator::NewEvaluator() {
  // Implement
}

NewEvaluator::Evaluate(Obstacle* obstacle_ptr)() {
  // Extract features
  // Compute new_output by applying pre-trained model
}

// Other functions

}  // namespace prediction
}  // namespace apollo

Add a new evaluator in proto

Add a new type of evaluator in prediction_conf.proto:

  enum EvaluatorType {
    MLP_EVALUATOR = 0;
    NEW_EVALUATOR = 1;
  }

Update prediction_conf file

In the file modules/prediction/conf/prediction_conf.pb.txt, update the field evaluator_type like this:

obstacle_conf {
  obstacle_type: VEHICLE
  obstacle_status: ON_LANE
  evaluator_type: NEW_EVALUATOR
  predictor_type: NEW_PREDICTOR
}

Step 5: Upate the evaluator manager

Update CreateEvluator( ... ) like this:

  case ObstacleConf::NEW_EVALUATOR: {
      evaluator_ptr.reset(new NewEvaluator());
      break;
    }

Update RegisterEvaluators() like this:

  RegisterEvaluator(ObstacleConf::NEW_EVALUATOR);

After following the steps above, the new evaluator should be created.

Adding new features

If you would like to add new features, follow the instructions that follow:

Add a field in proto

Assume the new evaluating result named new_output and also assume its type is int32. If the output is related directly to the obstacles, you can add it into modules/prediction/proto/feature.proto like this:

message Feature {
    // Other existing features
    optional int32 new_output = 1000;
}

If the output is related to the lane sequences, please add it into modules/prediction/proto/lane_graph.proto like this:

message LaneSequence {
    // Other existing features
    optional int32 new_output = 1000;
}
C++
1
https://gitee.com/davidwangys/apollo.git
git@gitee.com:davidwangys/apollo.git
davidwangys
apollo
apollo
master

搜索帮助