Apollo  6.0
Open source self driving car software
singlestage_obstacle_transformer.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2020 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 <algorithm>
19 #include <map>
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
27 #include "modules/perception/camera/lib/obstacle/transformer/singlestage/proto/singlestage.pb.h"
29 
30 namespace apollo {
31 namespace perception {
32 namespace camera {
33 
34 // hyper parameters
37 
38  void set_default();
39 
42  float k_min_cost;
43  float eps_cost;
44 };
45 
47  public:
49 
51  bool Init(const ObstacleTransformerInitOptions &options =
53 
54  // @brief: transform 2D detections to 3D bounding box
55  // @param [in]: frame
56  // @param [out]: frame
57  bool Transform(const ObstacleTransformerOptions &options,
58  CameraFrame *frame) override;
59 
60  std::string Name() const override;
61 
62  private:
63  int MatchTemplates(base::ObjectSubType sub_type, float *dimension_hwl);
64  void FillResults(float object_center[3], float dimension_hwl[3],
65  float rotation_y, Eigen::Affine3d camera2world_pose,
66  float theta_ray, base::ObjectPtr obj);
67  float CenterPointFromBbox(const float *bbox, const float *hwl,
68  float ry, float *center, float *center2d,
69  const float* k_mat, int height, int width);
70  void ConstraintCenterPoint(const float *bbox, const float &z_ref,
71  const float &ry, const float *hwl,
72  const float* k_mat, float *center,
73  float *x, int height, int width);
74 
75  private:
76  singlestage::SinglestageParam singlestage_param_;
77  int image_width_ = 0;
78  int image_height_ = 0;
79  TransformerParams params_;
80 
81  protected:
82  ObjectTemplateManager *object_template_manager_ = nullptr;
83 };
84 
85 } // namespace camera
86 } // namespace perception
87 } // namespace apollo
Definition: base_obstacle_transformer.h:31
Definition: transform_server.h:29
Definition: camera_frame.h:33
float k_min_cost
Definition: singlestage_obstacle_transformer.h:42
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
float eps_cost
Definition: singlestage_obstacle_transformer.h:43
int max_nr_iter
Definition: singlestage_obstacle_transformer.h:40
TransformerParams()
Definition: singlestage_obstacle_transformer.h:36
SingleStageObstacleTransformer()
Definition: singlestage_obstacle_transformer.h:48
Definition: object_template_manager.h:49
Definition: singlestage_obstacle_transformer.h:46
Definition: singlestage_obstacle_transformer.h:35
Definition: base_obstacle_transformer.h:29
bool Init(const char *binary_name)
float learning_rate
Definition: singlestage_obstacle_transformer.h:41
Definition: base_obstacle_transformer.h:38
Eigen::Affine3d Affine3d
Definition: base_map_fwd.h:34
virtual ~SingleStageObstacleTransformer()
Definition: singlestage_obstacle_transformer.h:50
ObjectSubType
Definition: object_types.h:63
std::shared_ptr< Object > ObjectPtr
Definition: object.h:123