Get the App
SLTechnology News&Howtos  ›  Servers  › 

How does apollo add a new evaluator to the prediction module

Shulou Source: shulou.com Published: 2022-05-31 18:13:52 10月03日 Update

This article will explain in detail how apollo adds a new evaluator to the prediction module. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Brief introduction

The evaluator uses a pre-trained deep learning model to generate features (raw information from obstacles and cars) to obtain model output.

To add an evaluator

Follow these steps to add an evaluator named NewEvaluator:

Add a file to proto

Define a new class NewEvaluator by inheriting the Evaluator class

Implement the NewEvaluator class

Update Forecast profile

Update Evaluation Manager

Define a new class that inherits Evaluator

Create the file new_evaluator.h under the modules/prediction/evaluator/vehicle folder

The contents of the document are as follows:

# 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 implements the newly defined class NewEvaluator

Create a file called new_evaluator.cc in the same folder to implement the newly defined class. The implementation of the new class is as follows:

# 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 adds an evaluator to proto

Add a type to the file prediction_conf.proto to represent the new evaluator, as follows:

Enum EvaluatorType {MLP_EVALUATOR = 0 * forecasting EVALUATOR = 1;} Update Forecast profile

In the configuration file modules/prediction/conf/prediction_conf.pb.txt, update the evaluator_ field, as shown below:

Obstacle_conf {obstacle_type: VEHICLEobstacle_status: ON_LANEevaluator_type: NEW_EVALUATORpredictor_type: NEW_PREDICTOR} Update Evaluation Configurator

Update the function CreateEvluator (...) as shown in the following code example:

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

Update the function RegisterEvaluators () as shown in the following code example:

RegisterEvaluator (ObstacleConf::NEW_EVALUATOR)

After completing the above steps, a new evaluator has been created.

Add new attributes

If you want to add new attributes, please refer to the following instructions:

Add a new field to the proto file

Assume that the new evaluation output is new_output and its type is int32.

If the output is directly related to the obstacle, refer to the following code to add a new field to the modules/prediction/proto/feature.proto file:

Message Feature {/ / Other existing featuresoptional int32 new_output = 1000;}

If the output is related to the lane sequence, refer to the following code to add a new field to the modules/prediction/proto/lane_graph.proto file:

Message LaneSequence {/ / Other existing featuresoptional int32 new_output = 1000;} this is the end of the article on "how to add a new evaluator to the prediction module". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Files evaluations updates code output configurations steps articles Zhongxin references modules content functions properties folders more models examples types obstacles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB OPPO Reno Microsoft Redmi