Apollo 11.0
自动驾驶开放平台
smoke_obstacle_detector.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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#pragma once
17
18#include <memory>
19#include <string>
20#include <vector>
21
22#include "modules/perception/camera_detection_single_stage/detector/smoke/proto/model_param.pb.h"
23
29
30namespace apollo {
31namespace perception {
32namespace camera {
33
35 public:
37 virtual ~SmokeObstacleDetector() = default;
45 bool Init(const ObstacleDetectorInitOptions &options) override;
53 bool Detect(onboard::CameraFrame *frame) override;
54
55 std::string Name() const override { return "SmokeObstacleDetector"; }
56
57 protected:
58 void InitImageOffset(const smoke::ModelParam &model_param);
59 void InitImageSize(const smoke::ModelParam &model_param);
60 void InitParam(const smoke::ModelParam &model_param);
61 void InitObstacleTypes();
62
63 bool Preprocess(const base::Image8U *image,
64 std::shared_ptr<base::Blob<float>> input_blob);
65
66 private:
67 smoke::ModelParam model_param_;
69 std::vector<base::ObjectSubType> types_;
70
71 int width_ = 0;
72 int height_ = 0;
73 int offset_y_ = 0;
74
75 int ori_cycle_ = 1;
76 float confidence_threshold_ = 0.f;
77 float border_ratio_ = 0.f;
78
79 smoke::MinDims min_dims_;
80
81 std::shared_ptr<base::Image8U> image_;
82};
83
84} // namespace camera
85} // namespace perception
86} // namespace apollo
A wrapper around SyncedMemory holders serving as the basic computational unit for images,...
Definition blob.h:88
A wrapper around Blob holders serving as the basic computational unit for images.
Definition image_8u.h:44
std::string Name() const override
Interface for obstacle detector name
bool Preprocess(const base::Image8U *image, std::shared_ptr< base::Blob< float > > input_blob)
void InitParam(const smoke::ModelParam &model_param)
bool Detect(onboard::CameraFrame *frame) override
Main part to detect obstacle
void InitImageSize(const smoke::ModelParam &model_param)
void InitImageOffset(const smoke::ModelParam &model_param)
bool Init(const ObstacleDetectorInitOptions &options) override
Init function for SmokeObstacleDetector
class register implement
Definition arena_queue.h:37