Commit 6f9dffdea0db95e47b88b475fd0467c19cbdb073

Authored by Hu Chunming
1 parent cee436d5

返回prob

src/PicAnalysis.cpp
@@ -316,16 +316,16 @@ vector<AnalysisResult> PicAnalysis::analysis_img(vector<sy_img> vec_img){ @@ -316,16 +316,16 @@ vector<AnalysisResult> PicAnalysis::analysis_img(vector<sy_img> vec_img){
316 vector<sy_img> vec_motor_img; 316 vector<sy_img> vec_motor_img;
317 vec_motor_img.push_back(img); 317 vec_motor_img.push_back(img);
318 318
319 - vector<int> vec_rainshed_result = m_motor_rainshed_algorithm.detect(vec_motor_img);  
320 - if (vec_rainshed_result.size() > 0)  
321 - {  
322 - result_info.rainshed = vec_rainshed_result[0]; 319 + vector<MotorRainshedResult> vec_rainshed_result = m_motor_rainshed_algorithm.detect(vec_motor_img);
  320 + if (vec_rainshed_result.size() > 0) {
  321 + result_info.rainshed = vec_rainshed_result[0].rainshed;
  322 + result_info.rainshed_prob = vec_rainshed_result[0].prob;
323 } 323 }
324 324
325 - vector<int> vec_phone_result = m_motor_phone_algorithm.detect(vec_motor_img);  
326 - if (vec_phone_result.size() > 0)  
327 - {  
328 - result_info.phoning = vec_phone_result[0]; 325 + vector<MotorPhoneResult> vec_phone_result = m_motor_phone_algorithm.detect(vec_motor_img);
  326 + if (vec_phone_result.size() > 0) {
  327 + result_info.phoning = vec_phone_result[0].phoning;
  328 + result_info.phoning_prob = vec_phone_result[0].prob;
329 } 329 }
330 330
331 std::vector<HumanCarResult> vec_hcp_result = m_human_car_algorithm.detect(vec_motor_img); 331 std::vector<HumanCarResult> vec_hcp_result = m_human_car_algorithm.detect(vec_motor_img);
src/ai_engine_module/MotorPhoneAnalysis.cpp
@@ -29,9 +29,9 @@ int MotorPhoneAnalysis::init(int devId){ @@ -29,9 +29,9 @@ int MotorPhoneAnalysis::init(int devId){
29 return SY_SUCCESS; 29 return SY_SUCCESS;
30 } 30 }
31 31
32 -vector<int> MotorPhoneAnalysis::detect(vector<sy_img> vec_img){ 32 +vector<MotorPhoneResult> MotorPhoneAnalysis::detect(vector<sy_img> vec_img){
33 33
34 - vector<int> vec_result; 34 + vector<MotorPhoneResult> vec_result;
35 35
36 const int batchsize = vec_img.size(); 36 const int batchsize = vec_img.size();
37 37
@@ -55,10 +55,20 @@ vector&lt;int&gt; MotorPhoneAnalysis::detect(vector&lt;sy_img&gt; vec_img){ @@ -55,10 +55,20 @@ vector&lt;int&gt; MotorPhoneAnalysis::detect(vector&lt;sy_img&gt; vec_img){
55 } 55 }
56 56
57 for(int batchIdx = 0; batchIdx < batchsize; batchIdx ++){ 57 for(int batchIdx = 0; batchIdx < batchsize; batchIdx ++){
58 - printf("debug det num:%d\n",results[batchIdx].objcount); 58 + MotorPhoneResult one_result;
  59 + one_result.phoning = -1;
  60 + one_result.prob = 0;
59 for (int i = 0; i < results[batchIdx].objcount; i++) { 61 for (int i = 0; i < results[batchIdx].objcount; i++) {
60 printf(" %d:%.2f \n", results[batchIdx].objinfo[i].index,results[batchIdx].objinfo[i].confidence); 62 printf(" %d:%.2f \n", results[batchIdx].objinfo[i].index,results[batchIdx].objinfo[i].confidence);
  63 + if (results[batchIdx].objinfo[i].index == 1) {
  64 + // 骑车打电话
  65 + one_result.phoning = results[batchIdx].objinfo[i].index;
  66 + one_result.prob = results[batchIdx].objinfo[i].confidence;
  67 + break;
  68 + }
61 } 69 }
  70 +
  71 + vec_result.push_back(one_result);
62 } 72 }
63 } while (0); 73 } while (0);
64 74
src/ai_engine_module/MotorPhoneAnalysis.h
1 #include "include.h" 1 #include "include.h"
2 2
  3 +struct MotorPhoneResult {
  4 + int phoning;
  5 + float prob;
  6 +};
  7 +
3 class MotorPhoneAnalysis 8 class MotorPhoneAnalysis
4 { 9 {
5 public: 10 public:
@@ -8,7 +13,7 @@ public: @@ -8,7 +13,7 @@ public:
8 13
9 int init(int devId); 14 int init(int devId);
10 15
11 - vector<int> detect(vector<sy_img> vec_img); 16 + vector<MotorPhoneResult> detect(vector<sy_img> vec_img);
12 17
13 private: 18 private:
14 int release(); 19 int release();
src/ai_engine_module/MotorRainshedAnalysis.cpp
@@ -29,9 +29,9 @@ int MotorRainshedAnalysis::init(int devId){ @@ -29,9 +29,9 @@ int MotorRainshedAnalysis::init(int devId){
29 return SY_SUCCESS; 29 return SY_SUCCESS;
30 } 30 }
31 31
32 -vector<int> MotorRainshedAnalysis::detect(vector<sy_img> vec_img){ 32 +vector<MotorRainshedResult> MotorRainshedAnalysis::detect(vector<sy_img> vec_img){
33 33
34 - vector<int> vec_result; 34 + vector<MotorRainshedResult> vec_result;
35 35
36 const int batchsize = vec_img.size(); 36 const int batchsize = vec_img.size();
37 37
@@ -55,8 +55,12 @@ vector&lt;int&gt; MotorRainshedAnalysis::detect(vector&lt;sy_img&gt; vec_img){ @@ -55,8 +55,12 @@ vector&lt;int&gt; MotorRainshedAnalysis::detect(vector&lt;sy_img&gt; vec_img){
55 } 55 }
56 56
57 for(int batchIdx = 0;batchIdx<batchsize;batchIdx++){ 57 for(int batchIdx = 0;batchIdx<batchsize;batchIdx++){
58 - printf("index:%d,confidence:%f\n",results[batchIdx].index,results[batchIdx].score);  
59 - vec_result.push_back(results[batchIdx].index); 58 + // printf("index:%d,confidence:%f\n",results[batchIdx].index,results[batchIdx].score);
  59 +
  60 + MotorRainshedResult one_result;
  61 + one_result.rainshed = results[batchIdx].index;
  62 + one_result.prob = results[batchIdx].score;
  63 + vec_result.push_back(one_result);
60 } 64 }
61 } while (0); 65 } while (0);
62 66
src/ai_engine_module/MotorRainshedAnalysis.h
1 #include "include.h" 1 #include "include.h"
2 2
  3 +struct MotorRainshedResult {
  4 + int rainshed;
  5 + float prob;
  6 +};
  7 +
3 class MotorRainshedAnalysis 8 class MotorRainshedAnalysis
4 { 9 {
5 public: 10 public:
@@ -8,7 +13,7 @@ public: @@ -8,7 +13,7 @@ public:
8 13
9 int init(int devId); 14 int init(int devId);
10 15
11 - vector<int> detect(vector<sy_img> vec_img); 16 + vector<MotorRainshedResult> detect(vector<sy_img> vec_img);
12 17
13 private: 18 private:
14 int release(); 19 int release();
src/village_inc.h
@@ -37,8 +37,9 @@ typedef struct VehicleInfo { @@ -37,8 +37,9 @@ typedef struct VehicleInfo {
37 37
38 int type; 38 int type;
39 39
40 - int vpt_type; 40 + int vpt_type; // person 人;bike 自行车 ; motor 摩托车;tricycle 三轮车;car 汽车; bigbus 大巴;lorry 货车;tractor 拖拉机;midibus 面包/中巴
41 int rainshed; //是否安装雨棚, 0 有雨棚 1 无雨棚 41 int rainshed; //是否安装雨棚, 0 有雨棚 1 无雨棚
  42 + float rainshed_prob;
42 int truck_manned; 43 int truck_manned;
43 int motor_manned; 44 int motor_manned;
44 45
@@ -46,7 +47,8 @@ typedef struct VehicleInfo { @@ -46,7 +47,8 @@ typedef struct VehicleInfo {
46 int human_lower_color; 47 int human_lower_color;
47 48
48 int reverse_driving; // 0 正常行驶 1 逆行 -1 未知 49 int reverse_driving; // 0 正常行驶 1 逆行 -1 未知
49 - int phoning; // 骑车打电话 50 + int phoning; // 骑车打电话 1 为是,其他为否
  51 + float phoning_prob;
50 52
51 int cross_line; // 压实线, 1 黄实线 2 白实线 -1 其他 53 int cross_line; // 压实线, 1 黄实线 2 白实线 -1 其他
52 int cross_diversion_line; // 压导流线 1 压了 -1 未压 54 int cross_diversion_line; // 压导流线 1 压了 -1 未压