Blame view

src/ai_engine_module/truck_manned_process.h 3.28 KB
9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
1
2
3
4
5
6
7
8
9
10
  #pragma once

  #include <deque>

  #include <map>

  #include <vector>

  #include <memory>

  #include "../util/vpc_util.h"

  #include "../ai_platform/task_param_manager.h"

  #include "../ai_platform/macro_definition.h"

  #include "ai_engine_header.h"

  #include "hs_det_truck.h"

27f0a463   Zhao Shuaihua   玩手机模型升级 货车载人增加关键点辅助
11
  #include "vehicle_pose.h"

9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
12
13
14
  #include "acl/acl.h"

  #include "acl/ops/acl_dvpp.h"

  

d51ea997   Zhao Shuaihua   升级玩手机、雨棚模型;模型批处理;...
15
  #define MAX_BATCH 16

9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
16
17
18
19
20
21
22
23
24
25
26
  #define IMAGE_CROP_EXPAND_RATIO 0

  #define MAX_OBJ_BOX_COUNT 100

  

  namespace ai_engine_module

  {

      namespace truck_manned_process

      {

          // typedef long id_t;

          using id_t = obj_key_t;

          using task_id_t = std::string;

          using algor_param_type = algor_config_param_manned_incident*;

27f0a463   Zhao Shuaihua   玩手机模型升级 货车载人增加关键点辅助
27
          #define IMG_RES 224

9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
28
29
30
31
32
  

          typedef struct input_data_wrap_t

          {

              id_t id;

              long objId;

fa818303   Zhao Shuaihua   增加闯红灯功能(特定场景);优化货...
33
              int person_motocycle_cnt;

9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
34
              std::string taskId;

27f0a463   Zhao Shuaihua   玩手机模型升级 货车载人增加关键点辅助
35
36
37
38
39
              box_t box; // 记录检测框

              box_t vpose_box; // 记录预处理后的检测框

              int x_center;    // 外扩前的中心点及长边信息

              int y_center;

              float llength;

9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
          } input_data_wrap_t;

  

  

          typedef struct mn_frame_t

          {

              uint m_frame;

              uint n_frame;

  

              // explicit

              mn_frame_t(uint m = 0, uint n = 0)

                  : m_frame(m)

                  , n_frame(n)

              {}

  

              void reset()

              {

                  m_frame = 0;

                  n_frame = 0;

              }

  

          } mn_frame_t;

  

  

          typedef struct results_data_t 

          {

              box_t box;

              acldvppPicDesc* origin_img_desc{nullptr};

              acldvppPicDesc* roi_img_desc{nullptr};

              id_t id;

              long objId;

              std::string taskId;

          } results_data_t;

  

          class TruckMannedProcess

          {

              /**

               * @brief

               *  1. move able

               */

          public:

              TruckMannedProcess();

  

              ~TruckMannedProcess();

  

              bool check_initied();

15398c62   Hu Chunming   模型路径兼容
85
              bool init(int gpu_id, string models_dir);

d281e3a2   Zhao Shuaihua   -增加非机动车逆行(513)、机动...
86
87
              // bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results); 

              bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, map<OBJ_KEY, OBJ_INDEX> &m_total_obj_info, const std::vector<onelevel_det_result> &det_results);

9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
88
89
90
91
92
93
94
95
96
97
98
99
100
              std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true);

  

              void force_release_result(const task_id_t& task_id);

  

              TruckMannedProcess(const TruckMannedProcess&) = delete;

              TruckMannedProcess& operator=(const TruckMannedProcess&) = delete;

  

          private:

              static algorithm_type_t algor_type_;

              int m_devId; 

              aclrtContext m_algorthim_ctx;

  

              bool init_;

27f0a463   Zhao Shuaihua   玩手机模型升级 货车载人增加关键点辅助
101
102
              void* hs_tools_;

              void* vpose_tools_;

9c03cbe4   Zhao Shuaihua   增加三轮车/货车载人 二轮车超员/...
103
104
105
106
107
108
109
              task_param_manager* task_param_manager_;

              std::map<id_t, mn_frame_t> id_to_mn_;

              std::map<id_t, results_data_t> id_to_result_;

          };

      }  // namespace truck_manned_process

  } // namespace ai_engine_module