这篇文章给大家分享的是有关Apollo之怎么在预测模块中添加新评估器的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

创新互联提供成都网站设计、成都做网站、网页设计,品牌网站设计,广告投放等致力于企业网站建设与公司网站制作,10余年的网站开发和建站经验,助力企业信息化建设,成功案例突破1000多家,是您实现网站建设的好选择.
简介
评估器通过应用预训练的深度学习模型生成特征(来自障碍物和当前车辆的原始信息)以获得模型输出。
添加评估器的步骤
请按照下面的步骤添加名称为NewEvaluator的评估器:
在proto中添加一个字段
声明一个从
Evaluator类继承的类NewEvaluator实现类
NewEvaluator更新预测配置
更新评估器管理
下面让我们用上面的方法来添加新的评估器。
一、声明一个从Evaluator类继承的类
NewEvaluator
modules/prediction/evaluator/vehicle目录下新建文件new_evaluator.h。声明如下:
#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二、实现类 NewEvaluator
在new_evaluator.h所在目录下新建文件new_evaluator.cc。实现如下:
#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三、在proto中添加新评估器
在prediction_conf.proto中添加新评估器类型:
enum EvaluatorType {
MLP_EVALUATOR = 0;
NEW_EVALUATOR = 1;
}四、更新prediction_conf文件
在modules/prediction/conf/prediction_conf.pb.txt中,按照如下方式更新字段evaluator_type:
obstacle_conf {
obstacle_type: VEHICLE
obstacle_status: ON_LANE
evaluator_type: NEW_EVALUATOR
predictor_type: NEW_PREDICTOR
}五、更新评估器管理
按照如下方式更新CreateEvluator( ... ):
case ObstacleConf::NEW_EVALUATOR: {
evaluator_ptr.reset(new NewEvaluator());
break;
}按照如下方式更新RegisterEvaluators():
RegisterEvaluator(ObstacleConf::NEW_EVALUATOR);
完成上述步骤后,新评估器便创建成功了。
添加新特性
如果你想添加新特性,请按照如下的步骤进行操作:
在proto中添加一个字段
假设新的评估结果名称是new_output且类型是int32。如果输出直接与障碍物相关,可以将它添加到modules/prediction/proto/feature.proto中,如下所示:
message Feature {
// Other existing features
optional int32 new_output = 1000;
}如果输出与车道相关,请将其添加到modules/prediction/proto/lane_graph.proto中,如下所示:
message LaneSequence {
// Other existing features
optional int32 new_output = 1000;
}感谢各位的阅读!关于“Apollo之怎么在预测模块中添加新评估器”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!