@@ -98,7 +98,7 @@ void YoloDarknetDetector::Detect(const cv::UMat& colorFrame)
9898 for (size_t i = 0 ; i < crops.size (); ++i)
9999 {
100100 const auto & crop = crops[i];
101- std::cout << " Crop " << i << " : " << crop << std::endl;
101+ // std::cout << "Crop " << i << ": " << crop << std::endl;
102102 DetectInCrop (colorMat, crop, tmpRegions);
103103 }
104104
@@ -112,10 +112,10 @@ void YoloDarknetDetector::Detect(const cv::UMat& colorFrame)
112112 [](const CRegion& reg) { return reg.m_confidence ; },
113113 [](const CRegion& reg) { return reg.m_type ; },
114114 0 , 0 .f );
115- std::cout << " nms for " << tmpRegions.size () << " objects - result " << m_regions.size () << std::endl;
115+ // std::cout << "nms for " << tmpRegions.size() << " objects - result " << m_regions.size() << std::endl;
116116 }
117117 }
118- // std::cout << "Finally " << m_regions.size() << " objects" << std::endl;
118+ // std::cout << "Finally " << m_regions.size() << " objects, " << colorMat.u->refcount << ", " << colorMat.u->urefcount << std::endl;
119119}
120120
121121// /
@@ -144,9 +144,11 @@ void YoloDarknetDetector::DetectInCrop(const cv::Mat& colorFrame, const cv::Rect
144144 for (const bbox_t & bbox : detects)
145145 {
146146 if (m_classesWhiteList.empty () || m_classesWhiteList.find (m_classNames[bbox.obj_id ]) != std::end (m_classesWhiteList))
147- tmpRegions.emplace_back (cv::Rect (wk * bbox.x + crop.x , hk * bbox.y + crop.y , wk * bbox.w , hk * bbox.h ), m_classNames[bbox.obj_id ], bbox.prob );
147+ tmpRegions.emplace_back (cv::Rect (cvRound ( wk * bbox.x ) + crop.x , cvRound ( hk * bbox.y ) + crop.y , cvRound ( wk * bbox.w ), cvRound ( hk * bbox.h ) ), m_classNames[bbox.obj_id ], bbox.prob );
148148 }
149- std::cout << " Detected " << detects.size () << " objects" << std::endl;
149+ if (crop.width == netSize.width && crop.height == netSize.height )
150+ m_tmpImg.release ();
151+ // std::cout << "Detected " << detects.size() << " objects" << std::endl;
150152}
151153
152154// /
@@ -174,9 +176,9 @@ void YoloDarknetDetector::Detect(const cv::Mat& colorFrame, regions_t& tmpRegion
174176 for (const bbox_t & bbox : detects)
175177 {
176178 if (m_classesWhiteList.empty () || m_classesWhiteList.find (m_classNames[bbox.obj_id ]) != std::end (m_classesWhiteList))
177- tmpRegions.emplace_back (cv::Rect (wk * bbox.x , hk * bbox.y , wk * bbox.w , hk * bbox.h ), m_classNames[bbox.obj_id ], bbox.prob );
179+ tmpRegions.emplace_back (cv::Rect (cvRound ( wk * bbox.x ), cvRound ( hk * bbox.y ), cvRound ( wk * bbox.w ), cvRound ( hk * bbox.h ) ), m_classNames[bbox.obj_id ], bbox.prob );
178180 }
179- std::cout << " Detected " << detects.size () << " objects" << std::endl;
181+ // std::cout << "Detected " << detects.size() << " objects" << std::endl;
180182}
181183
182184// /
0 commit comments