Apollo  6.0
Open source self driving car software
darkSCNN_lane_detector.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 "opencv2/opencv.hpp"
23 
28 #include "modules/perception/camera/lib/lane/common/proto/darkSCNN.pb.h"
31 
32 namespace apollo {
33 namespace perception {
34 namespace camera {
35 
37  public:
39  input_height_ = 0;
40  input_width_ = 0;
41  input_offset_y_ = 0;
42  input_offset_x_ = 0;
43  crop_height_ = 0;
44  crop_width_ = 0;
45  resize_height_ = 0;
46  resize_width_ = 0;
47  image_mean_[0] = 0;
48  image_mean_[1] = 0;
49  image_mean_[2] = 0;
50  confidence_threshold_lane_ = 0;
51  lane_output_height_ = 0;
52  lane_output_width_ = 0;
53  num_lanes_ = 0;
54  }
55 
56  virtual ~DarkSCNNLaneDetector() {}
57 
58  bool Init(const LaneDetectorInitOptions &options =
59  LaneDetectorInitOptions()) override;
60 
61  // @brief: detect lane from image.
62  // @param [in]: options
63  // @param [in/out]: frame
64  // detected lanes should be filled, required,
65  // 3D information of lane can be filled, optional.
66  bool Detect(const LaneDetectorOptions &options, CameraFrame *frame) override;
67  std::string Name() const override;
68 
69  private:
70  std::shared_ptr<inference::Inference> cnnadapter_lane_ = nullptr;
71  std::shared_ptr<base::BaseCameraModel> base_camera_model_ = nullptr;
72  darkSCNN::DarkSCNNParam darkscnn_param_;
73 
74  // parameters for data provider
75  uint16_t input_height_;
76  uint16_t input_width_;
77  uint16_t input_offset_y_;
78  uint16_t input_offset_x_;
79  uint16_t crop_height_;
80  uint16_t crop_width_;
81  uint16_t resize_height_;
82  uint16_t resize_width_;
83  int image_mean_[3];
84  std::vector<float> vpt_mean_;
85  std::vector<float> vpt_std_;
86  // parameters for network output
87  float confidence_threshold_lane_;
88  int lane_output_height_;
89  int lane_output_width_;
90  int num_lanes_;
91 
92  int64_t time_1 = 0;
93  int64_t time_2 = 0;
94  int time_num = 0;
95 
96  DataProvider::ImageOptions data_provider_image_option_;
97  base::Image8U image_src_;
98  std::vector<std::string> net_inputs_;
99  std::vector<std::string> net_outputs_;
100  std::shared_ptr<base::Blob<float>> lane_blob_ = nullptr;
101 };
102 
103 } // namespace camera
104 } // namespace perception
105 } // namespace apollo
DarkSCNNLaneDetector()
Definition: darkSCNN_lane_detector.h:38
Definition: camera_frame.h:33
Definition: darkSCNN_lane_detector.h:36
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
A wrapper around Blob holders serving as the basic computational unit for images. ...
Definition: image_8u.h:44
bool Detect(const LaneDetectorOptions &options, CameraFrame *frame) override
Definition: base_lane_detector.h:37
Definition: base_lane_detector.h:35
bool Init(const LaneDetectorInitOptions &options=LaneDetectorInitOptions()) override
virtual ~DarkSCNNLaneDetector()
Definition: darkSCNN_lane_detector.h:56
Definition: base_lane_detector.h:30