Blame view

tsl_aiplatform/ai_engine_module/fight_fall_cls.hpp 3.06 KB
85cc8cb9   Hu Chunming   ๅŽŸ็‰ˆไปฃ็ 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  /*
   * @Author: yangzilong
   * @Date: 2021-12-02 14:22:31
   * @Last Modified by: yangzilong
   * @Last Modified time: Do not edit
   * @Email: yangzilong@objecteye.com
   * @Description:
   */
  
  #pragma once
  #include <vector>
  #include <unordered_map>
  
  #include "include.h"
  #include "fight_det.h"
  
  namespace ai_engine_module
  {
      namespace fight_fall_cls
      {
  
  
  
          typedef algor_config_param_pedestrian_fight* fight_algor_param_type;
          typedef algor_config_param_pedestrian_fall* fall_algor_param_type;
  
          #define DEFAULT_MIN_WIDTH 100
          #define DEFAULT_MIN_HEIGHT 100
          #define DEFAULT_PTHRESHOLD 0.8
  
          #define FIGHT_IOU_THRESH 0.1
          #define MAX_BATCH 20
          #define IMAGE_CROP_EXPAND_RATIO 0
  
          enum class category_t
          {
              FIGHT = 1,
              fall = 2,
          };
  
          typedef long id_t;
          typedef std::string taskid_t;
  
          typedef struct input_data_wrap_t
          {
              // about id.
              id_t objId;
              std::string taskId;
  
              // about gpu/cpu image data
              // sy_img img;
  
              // about box.
              box_t box;
          } input_data_wrap_t;
  
  
          typedef struct result_fight_data_t
          {
              box_t box;
              sy_img ori_img;
              sy_img roi_img;
              taskid_t taskid;
              std::set<id_t> objectids;
              long long id;
          } result_fight_data_t;
  
          typedef struct result_fall_data_t
          {
              sy_img ori_img;
              sy_img roi_img;
              id_t objectid;
              taskid_t taskid;
              box_t box;
              long long id;
          } result_fall_data_t;
  
          typedef struct result_data_t
          {
              std::vector<result_fight_data_t> fight_data;
              std::vector<result_fall_data_t> fall_data;
          } result_data_t;
  
          class FightfallCls
          {
              /**
               * @brief
               *  1. moveonly
               */
          public:
  
              FightfallCls();
              ~FightfallCls();
  
              bool init(int gpu_id, char *trt_serialize_file = "serialize_file/");
  
              /**
               * @brief taskIds and det_input_images must be orderly.
               *
               * @param taskIds
               * @param det_input_images
               * @param det_result
               * @param results
               * @return true
               * @return false
               */
              bool process_mstreams(const std::set<taskid_t> &taskIds, const sy_img *det_input_images, const std::vector<onelevel_det_result> &det_result,
                                    std::vector<result_data_t> &results);
  
              FightfallCls(const FightfallCls&) = delete;
              FightfallCls& operator=(const FightfallCls&) = delete;
  
          private:
              bool check_initied();
  
              bool init_;
              void *tools_;
              static algorithm_type_t fight_algor_type_, fall_algor_type_;
              static long long gid_;
              task_param_manager* task_param_manager_;
          };
      }  // namespace fight_fall_cls
  } // namespace ai_engine_module