diff --git a/src/Detector/OCVDNNDetector.cpp b/src/Detector/OCVDNNDetector.cpp index 0ba8dadc..82902be0 100644 --- a/src/Detector/OCVDNNDetector.cpp +++ b/src/Detector/OCVDNNDetector.cpp @@ -369,7 +369,7 @@ void OCVDNNDetector::DetectInCrop(const cv::UMat& colorFrame, const cv::Rect& cr for (int i = 0; i < rows; ++i) { - if (m_netType == ModelType::YOLOV8 || m_netType == ModelType::YOLOV9 || m_netType == ModelType::YOLOV10) + if (m_netType == ModelType::YOLOV8 || m_netType == ModelType::YOLOV9) { float* classes_scores = data + 4; @@ -395,7 +395,7 @@ void OCVDNNDetector::DetectInCrop(const cv::UMat& colorFrame, const cv::Rect& cr tmpRegions.emplace_back(cv::Rect(left + crop.x, top + crop.y, width, height), T2T(class_id.x), static_cast(maxClassScore)); } } - else // yolov5 + else if (m_netType == ModelType::YOLOV5) { float confidence = data[4]; @@ -426,6 +426,21 @@ void OCVDNNDetector::DetectInCrop(const cv::UMat& colorFrame, const cv::Rect& cr } } } + else if (m_netType == ModelType::YOLOV10) + { + int left = cvRound(x_factor * data[0]); + int top = cvRound(y_factor * data[1]); + int width = cvRound(x_factor * (data[2] - data[0])); + int height = cvRound(y_factor * (data[3] - data[1])); + float confidence = data[4]; + int classId = cvRound(data[5]); + + if (confidence >= m_confidenceThreshold) + { + if (m_classesWhiteList.empty() || m_classesWhiteList.find(T2T(classId)) != std::end(m_classesWhiteList)) + tmpRegions.emplace_back(cv::Rect(left + crop.x, top + crop.y, width, height), T2T(classId), confidence); + } + } data += dimensions; } diff --git a/src/Detector/tensorrt_yolo/YoloONNXv10_bb.hpp b/src/Detector/tensorrt_yolo/YoloONNXv10_bb.hpp index 1cf4bba5..137dbf8e 100644 --- a/src/Detector/tensorrt_yolo/YoloONNXv10_bb.hpp +++ b/src/Detector/tensorrt_yolo/YoloONNXv10_bb.hpp @@ -13,7 +13,7 @@ class YOLOv10_bb_onnx : public YoloONNX /// \param output /// \return /// - std::vector YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) + std::vector GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) { std::vector resBoxes; diff --git a/src/Detector/tensorrt_yolo/YoloONNXv6_bb.hpp b/src/Detector/tensorrt_yolo/YoloONNXv6_bb.hpp index ce5ad66d..4d6a6268 100644 --- a/src/Detector/tensorrt_yolo/YoloONNXv6_bb.hpp +++ b/src/Detector/tensorrt_yolo/YoloONNXv6_bb.hpp @@ -13,7 +13,7 @@ class YOLOv6_bb_onnx : public YoloONNX /// \param output /// \return /// - std::vector YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) + std::vector GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) { std::vector resBoxes; diff --git a/src/Detector/tensorrt_yolo/YoloONNXv7_bb.hpp b/src/Detector/tensorrt_yolo/YoloONNXv7_bb.hpp index f0cf1961..78a383b4 100644 --- a/src/Detector/tensorrt_yolo/YoloONNXv7_bb.hpp +++ b/src/Detector/tensorrt_yolo/YoloONNXv7_bb.hpp @@ -13,7 +13,7 @@ class YOLOv7_bb_onnx : public YoloONNX /// \param output /// \return /// - std::vector YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) + std::vector GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) { std::vector resBoxes; diff --git a/src/Detector/tensorrt_yolo/YoloONNXv7_instance.hpp b/src/Detector/tensorrt_yolo/YoloONNXv7_instance.hpp index abd57c47..73a5d671 100644 --- a/src/Detector/tensorrt_yolo/YoloONNXv7_instance.hpp +++ b/src/Detector/tensorrt_yolo/YoloONNXv7_instance.hpp @@ -14,7 +14,7 @@ class YOLOv7_instance_onnx : public YoloONNX /// \param output /// \return /// - std::vector YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) + std::vector GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) { std::vector resBoxes; diff --git a/src/Detector/tensorrt_yolo/YoloONNXv8_bb.hpp b/src/Detector/tensorrt_yolo/YoloONNXv8_bb.hpp index 33e6c2a5..9a21e397 100644 --- a/src/Detector/tensorrt_yolo/YoloONNXv8_bb.hpp +++ b/src/Detector/tensorrt_yolo/YoloONNXv8_bb.hpp @@ -13,7 +13,7 @@ class YOLOv8_bb_onnx : public YoloONNX /// \param output /// \return /// - std::vector YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) + std::vector GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) { std::vector resBoxes; diff --git a/src/Detector/tensorrt_yolo/YoloONNXv8_instance.hpp b/src/Detector/tensorrt_yolo/YoloONNXv8_instance.hpp index 875c31bb..dbdf20fd 100644 --- a/src/Detector/tensorrt_yolo/YoloONNXv8_instance.hpp +++ b/src/Detector/tensorrt_yolo/YoloONNXv8_instance.hpp @@ -13,7 +13,7 @@ class YOLOv8_instance_onnx : public YoloONNX /// \param output /// \return /// - std::vector YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) + std::vector GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) { std::vector resBoxes; diff --git a/src/Detector/tensorrt_yolo/YoloONNXv9_bb.hpp b/src/Detector/tensorrt_yolo/YoloONNXv9_bb.hpp index 33023db2..6c821351 100644 --- a/src/Detector/tensorrt_yolo/YoloONNXv9_bb.hpp +++ b/src/Detector/tensorrt_yolo/YoloONNXv9_bb.hpp @@ -13,7 +13,7 @@ class YOLOv9_bb_onnx : public YoloONNX /// \param output /// \return /// - std::vector YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) + std::vector GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector& outputs, cv::Size frameSize) { std::vector resBoxes;