From a2673edc68a502f9a88ddf8e42f4aded9a8d94ef Mon Sep 17 00:00:00 2001
From: pansen <pansen626@sina.com>
Date: 星期二, 02 四月 2019 18:48:31 +0800
Subject: [PATCH] 修改信息结构

---
 QiaoJiaSystem/YoloServer/YoloDetectServerI.cpp |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/QiaoJiaSystem/YoloServer/YoloDetectServerI.cpp b/QiaoJiaSystem/YoloServer/YoloDetectServerI.cpp
index cb0e612..545bf5f 100644
--- a/QiaoJiaSystem/YoloServer/YoloDetectServerI.cpp
+++ b/QiaoJiaSystem/YoloServer/YoloDetectServerI.cpp
@@ -14,9 +14,43 @@
 
 ::YoloDetect::ObjInfos
 YoloDetectServerI::YoloDetect(::Ice::Int w, ::Ice::Int h, const ::std::string &shM, const ::Ice::Current &) {
-    ClockTimer ct("YoloDetectServerI::YoloDetect");
+//    ClockTimer ct("YoloDetectServerI::YoloDetect");
+
+//    std::thread::id key = std::this_thread::get_id();
+//    DBG("key is " << key);
+//    DnDetect::DnDetect *t_dnDetect = nullptr;
+//    for (auto &item : map_dnDetRes) {
+//        //鏄惁鍙戠幇pid
+//        bool find_pid = false;
+//
+//        auto &pid_map = item.second.map_pid;
+//        for (auto &pid_item : pid_map) {
+//            if (pid_item.second == key) {
+////                鍙戠幇pid锛岃幏鍙栬祫婧愬彞鏌�
+//                find_pid = true;
+//                break;
+//            }
+//        }
+//        int map_pid_size = item.second.map_pid.size();
+//        if (!find_pid && map_pid_size < item.second.i) {
+//            //娌″彂鐜板彞鏌勶紝骞朵笖map瀹归噺瓒冲鏀惧叆鏂扮殑pid
+//            map_pid_size++;
+//            //#todo lock ?
+//            item.second.map_pid[map_pid_size] = key;
+//            find_pid = true;
+//        }
+//        //鍙戠幇浜唒id閫�鍑哄惊鐜�
+//        if (find_pid) {
+//            t_dnDetect = item.second.dnDetect;
+//            break;
+//        }
+//    }
+
     ::YoloDetect::ObjInfos objInfos;
-    if (!m_bInitThd) return objInfos;
+    if (!m_bInitThd /*|| t_dnDetect == nullptr*/) {
+        ERR("error ");
+        return objInfos;
+    }
     QSharedMemory shareMemory(QString(shM.c_str()));
     if (shareMemory.attach()) {
         int channel = 3;
@@ -35,6 +69,12 @@
         //printf("Predicted in %f seconds.\n", what_time_is_it_now()-attime);
         int nboxes = 0;
         detection *dets = get_network_boxes(m_net, im.w, im.h, m_thresh, m_hier_thresh, 0, 1, &nboxes);
+        if (nboxes > 30) {
+            DBG("nboxes="<<nboxes);
+            free_image(im);
+            free_image(sized);
+            return objInfos;
+        }
         if (m_nms) do_nms_sort(dets, nboxes, l.classes, m_nms);
         //  draw_detections(im, dets, nboxes, m_thresh, names, alphabet, l.classes);
         for (int i = 0; i < nboxes; i++) {

--
Gitblit v1.8.0