Blame view

src/ai_engine_module/VehicleHeadTail.h 882 Bytes
20396d5c   Hu Chunming   添加车头车尾算法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #include "sy_errorinfo.h"
  #include "cnn_cls.h"
  #include "dvpp_processx.h"
  #include <time.h>
  #include <sys/time.h>
  #include "stream_data.h"
  #include <string.h>
  #include <vector>
  
  using namespace atlas_utils;
  using namespace std;
  
  typedef struct head_tail_param
  {
      int devId;              //ָ指定显卡id
      int max_batch;
581a68a4   Hu Chunming   修正parse_road无返回值导...
17
      std::string sdk_root;
20396d5c   Hu Chunming   添加车头车尾算法
18
19
20
21
      head_tail_param() :devId(0), max_batch(8){};
  } head_tail_param;
  
  struct HeadTailResult {
10667f7c   Hu Chunming   违法载人判断的优化
22
      int cls;        // {'车尾': 0, '车侧': 1, '车头': 2}
20396d5c   Hu Chunming   添加车头车尾算法
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
      float confidence;
  };
  
  class VehicleHeadTail
  {
  
  public:
      VehicleHeadTail(/* args */);
      ~VehicleHeadTail();
  
      int init(head_tail_param param);
  
      int detect(vector<sy_img>, vector<HeadTailResult>&);
  
  private:
      int release();
  
  private:
      aclrtContext m_ctx;
      aclrtStream stream;
      CnnCls*  m_cnn_cls;
      DvppProcessx* m_dvpp;
      int max_batch;
  };