Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Linux build #451

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading