Commit 15398c6238a0dc73c5caa9f5cfb87a1c9041e160

Authored by Hu Chunming
1 parent fbdee5c4

模型路径兼容

src/ai_engine_module/motocycle_hs_process.cpp
... ... @@ -81,11 +81,11 @@ namespace ai_engine_module
81 81 }
82 82 }
83 83  
84   - bool MotorHsProcess::init(int gpu_id)
  84 + bool MotorHsProcess::init(int gpu_id, string models_dir)
85 85 {
86 86 init_ = false;
87 87  
88   - string model_path = "./models/hs/hs_motor_310p.om" ;
  88 + string model_path = models_dir + "/models/hs/hs_motor_310p.om" ;
89 89 LOG_INFO("hs_motor 版本:{} 模型路径:{}", hs_motor_getversion(), model_path);
90 90  
91 91 hs_motor_param param;
... ...
src/ai_engine_module/motocycle_hs_process.h
... ... @@ -84,7 +84,7 @@ namespace ai_engine_module
84 84 ~MotorHsProcess();
85 85  
86 86 bool check_initied();
87   - bool init(int gpu_id);
  87 + bool init(int gpu_id, string models_dir);
88 88 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results);
89 89 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true);
90 90  
... ...
src/ai_engine_module/tricycle_manned_process.cpp
... ... @@ -29,11 +29,11 @@ namespace ai_engine_module
29 29 }
30 30 }
31 31  
32   - bool TricycleMannedProcess::init(int gpu_id)
  32 + bool TricycleMannedProcess::init(int gpu_id, string models_dir)
33 33 {
34 34 init_ = false;
35 35  
36   - string model_path = "./models/hs/hs_tricycle_310p.om" ;
  36 + string model_path = models_dir + "/models/hs/hs_tricycle_310p.om" ;
37 37 LOG_INFO("hs_tri 版本:{} 模型路径:{}", hs_tri_getversion(), model_path);
38 38  
39 39 hs_tri_param param;
... ...
src/ai_engine_module/tricycle_manned_process.h
... ... @@ -75,7 +75,7 @@ namespace ai_engine_module
75 75 ~TricycleMannedProcess();
76 76  
77 77 bool check_initied();
78   - bool init(int gpu_id);
  78 + bool init(int gpu_id, string models_dir);
79 79 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results);
80 80 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true);
81 81  
... ...
src/ai_engine_module/truck_manned_process.cpp
... ... @@ -29,11 +29,11 @@ namespace ai_engine_module
29 29 }
30 30 }
31 31  
32   - bool TruckMannedProcess::init(int gpu_id)
  32 + bool TruckMannedProcess::init(int gpu_id, string models_dir)
33 33 {
34 34 init_ = false;
35 35  
36   - string model_path = "./models/hs/hs_truck_310p.om" ;
  36 + string model_path = models_dir + "/models/hs/hs_truck_310p.om" ;
37 37 LOG_INFO("hs_truck 版本:{} 模型路径:{}", hs_truck_getversion(), model_path);
38 38  
39 39 hs_truck_param param;
... ...
src/ai_engine_module/truck_manned_process.h
... ... @@ -75,7 +75,7 @@ namespace ai_engine_module
75 75 ~TruckMannedProcess();
76 76  
77 77 bool check_initied();
78   - bool init(int gpu_id);
  78 + bool init(int gpu_id, string models_dir);
79 79 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results);
80 80 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true);
81 81  
... ...
src/ai_platform/MultiSourceProcess.cpp
... ... @@ -109,19 +109,19 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){
109 109 }
110 110  
111 111 //三轮车头肩检测
112   - if (!tricycle_manned_.init(vptParam.gpuid)) {
  112 + if (!tricycle_manned_.init(vptParam.gpuid, models_dir)) {
113 113 LOG_FATAL("Init tricycle_hs failed");
114 114 return -1;
115 115 }
116 116  
117 117 //货车头肩检测
118   - if (!truck_manned_.init(vptParam.gpuid)) {
  118 + if (!truck_manned_.init(vptParam.gpuid, models_dir)) {
119 119 LOG_FATAL("Init truck_hs failed");
120 120 return -1;
121 121 }
122 122  
123 123 //二轮车头肩检测
124   - if (!motor_hsprocess_.init(vptParam.gpuid)) {
  124 + if (!motor_hsprocess_.init(vptParam.gpuid, models_dir)) {
125 125 LOG_FATAL("Init motor_hs failed");
126 126 return -1;
127 127 }
... ...