Commit d2ab26d1f30410c3bd3bc0ae7a8e1930e70eea8c

Authored by Hu Chunming
1 parent 0b320fbd

代码优化

src/ai_engine_module/road_seg_statistics.cpp
... ... @@ -299,7 +299,8 @@ int RoadSegProcess::process_gpu(sy_img * batch_img, vector<DeviceMemory*> vec_se
299 299 int lane_cls = cats[i];
300 300 vector<int> cur_region;
301 301 for (int j = 0; j < points.size(); ++j) {
302   - int px = points[j].x*width_ratio; int py = points[j].y*height_ratio;
  302 + int px = points[j].x*width_ratio;
  303 + int py = points[j].y*height_ratio;
303 304 cur_region.push_back(px); cur_region.push_back(py);
304 305 }
305 306 traffic_region[b].push_back(cur_region); // 存储区域
... ... @@ -311,8 +312,10 @@ int RoadSegProcess::process_gpu(sy_img * batch_img, vector&lt;DeviceMemory*&gt; vec_se
311 312 int seg_cls = region_classes[i];
312 313 vector<int> cur_region;
313 314 for (int j = 0; j < points.size(); ++j) {
314   - int px = points[j].x*width_ratio; int py = points[j].y*height_ratio;
315   - cur_region.push_back(px); cur_region.push_back(py);
  315 + int px = points[j].x*width_ratio;
  316 + int py = points[j].y*height_ratio;
  317 + cur_region.push_back(px);
  318 + cur_region.push_back(py);
316 319 }
317 320 traffic_region[b].push_back(cur_region); // 存储区域
318 321 labels[b].push_back(seg_cls); // 存储类别
... ...
src/ai_platform/header.h
... ... @@ -37,6 +37,7 @@ enum class algorithm_type_t {
37 37 VEHICLE_SNAPSHOT = 301,
38 38 VEHICLE_RETROGRADE = 310,
39 39 VEHICLE_TRESPASS = 311,
  40 + VEHICLE_GATHER = 312, // 车辆聚集
40 41  
41 42 NONMOTOR_VEHICLE_SNAPSHOT = 401,
42 43 TAKEAWAY_MEMBER_CLASSIFICATION = 402,
... ...
src/util/JpegUtil.cpp
... ... @@ -18,11 +18,17 @@ int JpegUtil::jpeg_init(int32_t devId){
18 18 // channel 准备
19 19 dvppChannelDesc_ = acldvppCreateChannelDesc();
20 20 ret = acldvppCreateChannel(dvppChannelDesc_);
  21 + if(ret != ACL_ERROR_NONE){
  22 + LOG_ERROR("acldvppCreateChannel failed!");
  23 + exit(-2);
  24 + }
21 25  
22 26 // 创建图片编码配置数据,设置编码质量
23 27 // 编码质量范围[0, 100],其中level 0编码质量与level 100差不多,而在[1, 100]内数值越小输出图片质量越差。
24 28 jpegeConfig_ = acldvppCreateJpegeConfig();
25 29 acldvppSetJpegeConfigLevel(jpegeConfig_, 100);
  30 +
  31 + return 0;
26 32 }
27 33  
28 34 void JpegUtil::jpeg_release(){
... ...
src/util/vpc_util.cpp
... ... @@ -200,6 +200,12 @@ int VPCUtil::init(int32_t devId){
200 200 // channel 准备
201 201 dvppChannelDesc_ = acldvppCreateChannelDesc();
202 202 ret = acldvppCreateChannel(dvppChannelDesc_);
  203 + if(ret != ACL_ERROR_NONE){
  204 + LOG_ERROR("acldvppCreateChannel failed!");
  205 + exit(-2);
  206 + }
  207 +
  208 + return 0;
203 209 }
204 210  
205 211 vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_object_info> objs){
... ...