Apollo 10.0
自动驾驶开放平台
apollo::perception::camera::BEVObstacleDetector类 参考

#include <bev_obstacle_detector.h>

类 apollo::perception::camera::BEVObstacleDetector 继承关系图:
apollo::perception::camera::BEVObstacleDetector 的协作图:

Public 成员函数

 BEVObstacleDetector ()=default
 
virtual ~BEVObstacleDetector ()=default
 
bool Init (const ObstacleDetectorInitOptions &options=ObstacleDetectorInitOptions()) override
 Init ObstacleDetector constructor.
 
bool Detect (CameraFrame *frame) override
 Get obstacles detection result
 
std::string Name () const override
 Interface for obstacle detector name
 
- Public 成员函数 继承自 apollo::perception::camera::BaseObstacleDetector
 BaseObstacleDetector ()=default
 
virtual ~BaseObstacleDetector ()=default
 
virtual bool InitNetwork (const common::ModelInfo &model_info, const std::string &model_root)
 Interface for network initialization
 
 BaseObstacleDetector ()=default
 
virtual ~BaseObstacleDetector ()=default
 
virtual bool InitNetwork (const common::ModelInfo &model_info, const std::string &model_root)
 Interface for network initialization
 
 BaseObstacleDetector ()=default
 
virtual ~BaseObstacleDetector ()=default
 
virtual bool Detect (onboard::CameraFrame *frame)=0
 Interface for obstacle detector main part
 
virtual bool InitNetwork (const common::ModelInfo &model_info, const std::string &model_root)
 Interface for network initialization
 

额外继承的成员函数

- Protected 成员函数 继承自 apollo::perception::camera::BaseObstacleDetector
 DISALLOW_COPY_AND_ASSIGN (BaseObstacleDetector)
 
 DISALLOW_COPY_AND_ASSIGN (BaseObstacleDetector)
 
 DISALLOW_COPY_AND_ASSIGN (BaseObstacleDetector)
 
- Protected 属性 继承自 apollo::perception::camera::BaseObstacleDetector
int gpu_id_ = 0
 
std::shared_ptr< inference::Inferencenet_
 

详细描述

在文件 bev_obstacle_detector.h35 行定义.

构造及析构函数说明

◆ BEVObstacleDetector()

apollo::perception::camera::BEVObstacleDetector::BEVObstacleDetector ( )
default

◆ ~BEVObstacleDetector()

virtual apollo::perception::camera::BEVObstacleDetector::~BEVObstacleDetector ( )
virtualdefault

成员函数说明

◆ Detect()

bool apollo::perception::camera::BEVObstacleDetector::Detect ( CameraFrame frame)
overridevirtual

Get obstacles detection result

参数
framecamera frame
返回
true
false

实现了 apollo::perception::camera::BaseObstacleDetector.

在文件 bev_obstacle_detector.cc152 行定义.

152 {
153 if (frame == nullptr) {
154 return false;
155 }
156
157 // Inputs
158 auto model_inputs = model_param_.info().inputs();
159 auto input_img_blob = net_->get_blob(model_inputs[0].name());
160 auto input_img2lidar_blob = net_->get_blob(model_inputs[1].name());
161
162 ImagePreprocess(frame, input_img_blob);
163 ImageExtrinsicPreprocess(input_img2lidar_blob);
164
165 // Net forward
166 net_->Infer();
167
168 // Outputs
169 auto model_outputs = model_param_.info().outputs();
170 auto output_bbox_blob = net_->get_blob(model_outputs[0].name());
171 auto output_score_blob = net_->get_blob(model_outputs[1].name());
172 auto output_label_blob = net_->get_blob(model_outputs[2].name());
173
174 float threshold = model_param_.score_threshold();
175 GetObjects(output_bbox_blob, output_label_blob, output_score_blob, types_,
176 threshold, &frame->detected_objects);
177
178 Nuscenes2Apollo(&frame->detected_objects);
179
180 return true;
181}
std::shared_ptr< inference::Inference > net_
void GetObjects(const base::BlobPtr< float > &box3ds, const base::BlobPtr< float > &labels, const base::BlobPtr< float > &scores, const std::vector< base::ObjectSubType > &types, float score_threshold, std::vector< base::ObjectPtr > *objects)
Get the Objects objects from blob

◆ Init()

bool apollo::perception::camera::BEVObstacleDetector::Init ( const ObstacleDetectorInitOptions options = ObstacleDetectorInitOptions())
overridevirtual

Init ObstacleDetector constructor.

参数
optionsthe option object of obstacle
返回
true
false

实现了 apollo::perception::camera::BaseObstacleDetector.

在文件 bev_obstacle_detector.cc73 行定义.

73 {
74 options_ = options;
75
76 std::string config_file =
77 GetConfigFile(options_.config_path, options_.config_file);
78 if (!cyber::common::GetProtoFromFile(config_file, &model_param_)) {
79 AERROR << "Read model param failed!";
80 return false;
81 }
82
83 InitTypes(model_param_);
84 InitImageSize(model_param_);
85
86 const auto &model_info = model_param_.info();
87 std::string model_path = GetModelPath(model_info.name());
88 if (!InitNetwork(model_param_.info(), model_path)) {
89 AERROR << "Init network failed!";
90 return false;
91 }
92 return true;
93}
virtual bool InitNetwork(const common::ModelInfo &model_info, const std::string &model_root)
Interface for network initialization
#define AERROR
Definition log.h:44
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
Definition util.cc:80
std::string GetModelPath(const std::string &model_name)
Get the model path by model name, search from APOLLO_MODEL_PATH
Definition util.cc:44

◆ Name()

std::string apollo::perception::camera::BEVObstacleDetector::Name ( ) const
inlineoverridevirtual

Interface for obstacle detector name

返回
std::string

实现了 apollo::perception::camera::BaseObstacleDetector.

在文件 bev_obstacle_detector.h57 行定义.

57{ return "BEVObstacleDetector"; }

该类的文档由以下文件生成: