Skip to content

Commit

Permalink
Merge pull request #451 from Nuzhny007/master
Browse files Browse the repository at this point in the history
Fix Linux build
  • Loading branch information
Nuzhny007 authored Jun 10, 2024
2 parents 7ba7d8a + da4467c commit fe8746c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 9 deletions.
19 changes: 17 additions & 2 deletions src/Detector/OCVDNNDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<float>(maxClassScore));
}
}
else // yolov5
else if (m_netType == ModelType::YOLOV5)
{
float confidence = data[4];

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Detector/tensorrt_yolo/YoloONNXv10_bb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class YOLOv10_bb_onnx : public YoloONNX
/// \param output
/// \return
///
std::vector<tensor_rt::Result> YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
std::vector<tensor_rt::Result> GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
{
std::vector<tensor_rt::Result> resBoxes;

Expand Down
2 changes: 1 addition & 1 deletion src/Detector/tensorrt_yolo/YoloONNXv6_bb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class YOLOv6_bb_onnx : public YoloONNX
/// \param output
/// \return
///
std::vector<tensor_rt::Result> YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
std::vector<tensor_rt::Result> GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
{
std::vector<tensor_rt::Result> resBoxes;

Expand Down
2 changes: 1 addition & 1 deletion src/Detector/tensorrt_yolo/YoloONNXv7_bb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class YOLOv7_bb_onnx : public YoloONNX
/// \param output
/// \return
///
std::vector<tensor_rt::Result> YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
std::vector<tensor_rt::Result> GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
{
std::vector<tensor_rt::Result> resBoxes;

Expand Down
2 changes: 1 addition & 1 deletion src/Detector/tensorrt_yolo/YoloONNXv7_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class YOLOv7_instance_onnx : public YoloONNX
/// \param output
/// \return
///
std::vector<tensor_rt::Result> YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
std::vector<tensor_rt::Result> GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
{
std::vector<tensor_rt::Result> resBoxes;

Expand Down
2 changes: 1 addition & 1 deletion src/Detector/tensorrt_yolo/YoloONNXv8_bb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class YOLOv8_bb_onnx : public YoloONNX
/// \param output
/// \return
///
std::vector<tensor_rt::Result> YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
std::vector<tensor_rt::Result> GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
{
std::vector<tensor_rt::Result> resBoxes;

Expand Down
2 changes: 1 addition & 1 deletion src/Detector/tensorrt_yolo/YoloONNXv8_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class YOLOv8_instance_onnx : public YoloONNX
/// \param output
/// \return
///
std::vector<tensor_rt::Result> YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
std::vector<tensor_rt::Result> GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
{
std::vector<tensor_rt::Result> resBoxes;

Expand Down
2 changes: 1 addition & 1 deletion src/Detector/tensorrt_yolo/YoloONNXv9_bb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class YOLOv9_bb_onnx : public YoloONNX
/// \param output
/// \return
///
std::vector<tensor_rt::Result> YoloONNX::GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
std::vector<tensor_rt::Result> GetResult(size_t imgIdx, int /*keep_topk*/, const std::vector<float*>& outputs, cv::Size frameSize)
{
std::vector<tensor_rt::Result> resBoxes;

Expand Down

0 comments on commit fe8746c

Please sign in to comment.