| | |
| | | ::YoloDetect::ObjInfos |
| | | YoloDetectServerI::YoloDetect(::Ice::Int w, ::Ice::Int h, const ::std::string &shM, const ::Ice::Current &) { |
| | | 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; |
| | | // } |
| | | // //发现了pid退出循环 |
| | | // 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; |
| | |
| | | //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) |
| | | { |
| | | if (nboxes > 30) { |
| | | DBG("nboxes="<<nboxes); |
| | | return objInfos; |
| | | } |
| | | if (m_nms) do_nms_sort(dets, nboxes, l.classes, m_nms); |