Commit a1a053f23331af2a55bb36bc190991265b94f373

Authored by Hu Chunming
1 parent 6f9dffde

修正人骑车逻辑错误

src/PicAnalysis.cpp
... ... @@ -330,7 +330,7 @@ vector<AnalysisResult> PicAnalysis::analysis_img(vector<sy_img> vec_img){
330 330  
331 331 std::vector<HumanCarResult> vec_hcp_result = m_human_car_algorithm.detect(vec_motor_img);
332 332 if (vec_hcp_result.size() > 0 && road_info.vec_direct.size() > 0) {
333   - int head_or_tail = vec_hcp_result[11].type;
  333 + int head_or_tail = vec_hcp_result[0].orient;
334 334 if (head_or_tail == 0 || head_or_tail == 1) {
335 335 result_info.reverse_driving = m_road_seg_algorithm.check_reverse_driving(road_info.vec_direct, vehicle_rect, src.width, src.height, head_or_tail);
336 336 }
... ...
src/ai_engine_module/HumanCarAnalysis.cpp
... ... @@ -52,12 +52,37 @@ std::vector&lt;HumanCarResult&gt; HumanCarAnalysis::detect(vector&lt;sy_img&gt; vec_img){
52 52 }
53 53  
54 54 for(int batchIdx = 0;batchIdx<batchsize;batchIdx++){
55   - for (int i = 0; i < HCP_ATTRI_INDEX_SIZE; i++) {
56   - HumanCarResult one_result;
57   - one_result.type = results[batchIdx].res_objs[i].res_index;
58   - one_result.prob = results[batchIdx].res_objs[i].res_prob;
59   - vec_result.push_back(one_result);
60   - }
  55 + HumanCarResult one_result;
  56 + one_result.head = results[batchIdx].res_objs[0].res_index;
  57 + one_result.head_prob = results[batchIdx].res_objs[0].res_prob;
  58 + one_result.eye = results[batchIdx].res_objs[1].res_index;
  59 + one_result.eye_prob = results[batchIdx].res_objs[1].res_prob;
  60 + one_result.mouth = results[batchIdx].res_objs[2].res_index;
  61 + one_result.mouth_prob = results[batchIdx].res_objs[2].res_prob;
  62 + one_result.weibo = results[batchIdx].res_objs[3].res_index;
  63 + one_result.weibo_prob = results[batchIdx].res_objs[3].res_prob;
  64 + one_result.up_wear = results[batchIdx].res_objs[4].res_index;
  65 + one_result.up_wear_prob = results[batchIdx].res_objs[4].res_prob;
  66 + one_result.up_color = results[batchIdx].res_objs[5].res_index;
  67 + one_result.up_color_prob = results[batchIdx].res_objs[5].res_prob;
  68 + one_result.up_tex = results[batchIdx].res_objs[6].res_index;
  69 + one_result.up_tex_prob = results[batchIdx].res_objs[6].res_prob;
  70 + one_result.bag = results[batchIdx].res_objs[7].res_index;
  71 + one_result.bag_prob = results[batchIdx].res_objs[7].res_prob;
  72 + one_result.sex = results[batchIdx].res_objs[8].res_index;
  73 + one_result.sex_prob = results[batchIdx].res_objs[8].res_prob;
  74 + one_result.age = results[batchIdx].res_objs[9].res_index;
  75 + one_result.age_prob = results[batchIdx].res_objs[9].res_prob;
  76 + one_result.carColor = results[batchIdx].res_objs[10].res_index;
  77 + one_result.carColor_prob = results[batchIdx].res_objs[10].res_prob;
  78 + one_result.orient = results[batchIdx].res_objs[11].res_index;
  79 + one_result.orient_prob = results[batchIdx].res_objs[11].res_prob;
  80 + one_result.dasan = results[batchIdx].res_objs[12].res_index;
  81 + one_result.dasan_prob = results[batchIdx].res_objs[12].res_prob;
  82 + one_result.take = results[batchIdx].res_objs[13].res_index;
  83 + one_result.take_prob = results[batchIdx].res_objs[13].res_prob;
  84 +
  85 + vec_result.push_back(one_result);
61 86 }
62 87 } while (0);
63 88  
... ...
src/ai_engine_module/HumanCarAnalysis.h
... ... @@ -2,8 +2,34 @@
2 2 #include "human_car_parsing.h"
3 3  
4 4 struct HumanCarResult {
5   - int type;
6   - float prob;
  5 + int head; // 0 – (长发) , 1 - (短发) , 2 - (光头) , 3 -( 帽子), 4- (头盔), 5– (其他)
  6 + float head_prob;
  7 + int eye; // 0 – (未戴眼镜) , 1 - (戴眼镜)
  8 + float eye_prob;
  9 + int mouth; // 0 – (未戴口罩) , 1 - (戴口罩)
  10 + float mouth_prob;
  11 + int weibo; // 0 – (未戴围巾) , 1 - (戴围巾)
  12 + float weibo_prob;
  13 + int up_wear; // 0 – (T恤/背心) , 1 - (衬衫) , 2 - (毛衣) , 3 - (羽绒服) , 4 – (大衣/风衣) , 5 – (外套/夹克/西服) , 6 - (连衣裙) , 7 - (无上衣) , 8 – (其他)
  14 + float up_wear_prob;
  15 + int up_color; // 0 – (黑) , 1 - (白) , 2 - (红) , 3 - (黄) , 4 – (蓝) , 5 – (绿) , 6 – (灰) , 7 – (多色) , 8 – (其他)
  16 + float up_color_prob;
  17 + int up_tex; // 0 – (纯色) , 1 - (碎花) , 2 - (条纹) , 3 - (格子) , 4 – (其他)
  18 + float up_tex_prob;
  19 + int bag; // 0 – (无包) , 1 - (背包)
  20 + float bag_prob;
  21 + int sex; // 0 – (男) , 1 - (女) , 2 - (其他)
  22 + float sex_prob;
  23 + int age; // 0 – (小孩) , 1 - (青年) , 2 - (中年) , 3 - (老年) , 4 – (其他)
  24 + float age_prob;
  25 + int carColor; // 0 – (黑) , 1 - (白) , 2 - (红) , 3 - (黄) , 4 – (蓝) , 5 – (绿) , 6 – (灰/银) , 7 – (多色) , 8 – (其他)
  26 + float carColor_prob;
  27 + int orient; // 0 – (正面) , 1 - (背面) , 2 - (侧面)
  28 + float orient_prob;
  29 + int dasan; // 0 – (无) , 1 - (有)
  30 + float dasan_prob;
  31 + int take; // 0 – (无) , 1 - (有)
  32 + float take_prob;
7 33 };
8 34  
9 35 class HumanCarAnalysis
... ...
src/village_inc.h
... ... @@ -40,8 +40,8 @@ typedef struct VehicleInfo {
40 40 int vpt_type; // person 人;bike 自行车 ; motor 摩托车;tricycle 三轮车;car 汽车; bigbus 大巴;lorry 货车;tractor 拖拉机;midibus 面包/中巴
41 41 int rainshed; //是否安装雨棚, 0 有雨棚 1 无雨棚
42 42 float rainshed_prob;
43   - int truck_manned;
44   - int motor_manned;
  43 + int truck_manned{0};
  44 + int motor_manned{0};
45 45  
46 46 int human_upper_color;
47 47 int human_lower_color;
... ...