Skip to content

Comments

First version#1

Merged
MatthijsBurgh merged 51 commits intomasterfrom
first_version
Nov 27, 2025
Merged

First version#1
MatthijsBurgh merged 51 commits intomasterfrom
first_version

Conversation

@MatthijsBurgh
Copy link
Member

No description provided.

MatthijsBurgh and others added 30 commits June 24, 2025 21:16
…ssion in case of multiple inputs (to avoid necessary initializations).
@MatthijsBurgh MatthijsBurgh marked this pull request as ready for review November 25, 2025 21:14
@MatthijsBurgh MatthijsBurgh requested review from IasonTheodorou and Copilot and removed request for IasonTheodorou November 25, 2025 21:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR transforms a standalone YOLOv8 ONNX inference C++ implementation into a ROS (Robot Operating System) package called yolo_onnx_ros. The changes refactor the codebase to follow ROS conventions, improve modularity, add comprehensive testing, and update build configuration for catkin integration.

Key Changes:

  • Restructured code into ROS package with proper header organization and catkin build system
  • Refactored member variables to use trailing underscore naming convention
  • Added unit tests using Google Test framework for YOLO inference functionality

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
CMakeLists.txt Complete rebuild system migration from standalone CMake to catkin with testing support and automated model downloads
package.xml New ROS package manifest defining dependencies and metadata
src/yolo_inference.cpp Core inference logic with member variable renaming, input validation, and dimension order fixes
include/yolo_onnx_ros/yolo_inference.hpp Header refactored with trailing underscore convention and CUDA macro updates
src/detection.cpp New detection utilities extracted from main, including YAML parsing and initialization functions
include/yolo_onnx_ros/detection.hpp New header exposing detection API functions
src/main.cpp Simplified main function using new detection API
test/yolo_test.cpp New comprehensive unit tests for YOLO inference pipeline
include/yolo_onnx_ros/config.hpp.in CMake-generated configuration template for CUDA feature detection
data/open-images-v7.yaml Reference dataset configuration with 601 class definitions
README.md Updated documentation for ROS integration and CUDA version requirements
.vscode/* VSCode configuration files for development environment
.github/workflows/main.yml GitHub Actions CI workflow using TUe robotics infrastructure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

cv::RNG rng(cv::getTickCount());
cv::Scalar color(rng.uniform(0, 256), rng.uniform(0, 256), rng.uniform(0, 256));

cv::rectangle(img, re.box, color, 3);
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function draws on a const-qualified cv::Mat. The img parameter is passed as const cv::Mat& (line 8), but cv::rectangle modifies the image. This will cause a compilation error. Change the parameter to cv::Mat& to allow modification.

Copilot uses AI. Check for mistakes.
cv::randu(testImage_realistic, cv::Scalar(0, 0, 0), cv::Scalar(255, 255, 255));

// Setup common parameters
std::tie(yolo, params) = Initialize("./yolo11m.onnx");
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Initialize function expects a std::filesystem::path but is called with a C-string literal. While this may work due to implicit conversion, it's more explicit to construct the path: Initialize(std::filesystem::path(\"./yolo11m.onnx\")).

Copilot uses AI. Check for mistakes.

template<typename N>
char* YOLO_V8::TensorProcess(clock_t& starttime_1, const cv::Mat& iImg, N& blob, std::vector<int64_t>& inputNodeDims,
char* YOLO_V8::TensorProcess(clock_t& starttime_1, const cv::Mat&, N& blob, std::vector<int64_t>& inputNodeDims,
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unnamed parameter (const cv::Mat&) is confusing. If the parameter is intentionally unused, name it with a comment explaining why, or use [[maybe_unused]] attribute: [[maybe_unused]] const cv::Mat& iImg.

Suggested change
char* YOLO_V8::TensorProcess(clock_t& starttime_1, const cv::Mat&, N& blob, std::vector<int64_t>& inputNodeDims,
char* YOLO_V8::TensorProcess(clock_t& starttime_1, [[maybe_unused]] const cv::Mat& iImg, N& blob, std::vector<int64_t>& inputNodeDims,

Copilot uses AI. Check for mistakes.
cv::dnn::NMSBoxes(boxes, confidences, rectConfidenceThreshold, iouThreshold, nmsResult);
for (int i = 0; i < nmsResult.size(); ++i)
cv::dnn::NMSBoxes(boxes, confidences, rectConfidenceThreshold_, iouThreshold_, nmsResult);
for (uint i = 0; i < nmsResult.size(); ++i)
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using uint instead of size_t for vector iteration is non-standard. Replace with size_t or use a range-based for loop to avoid type mismatch warnings and ensure portability.

Suggested change
for (uint i = 0; i < nmsResult.size(); ++i)
for (size_t i = 0; i < nmsResult.size(); ++i)

Copilot uses AI. Check for mistakes.

DL_RESULT result;
for (int i = 0; i < this->classes.size(); i++)
for (uint i = 0; i < this->classes.size(); i++)
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using uint instead of size_t for vector iteration is non-standard. Replace with size_t or use a range-based for loop to avoid type mismatch warnings and ensure portability.

Suggested change
for (uint i = 0; i < this->classes.size(); i++)
for (size_t i = 0; i < this->classes.size(); i++)

Copilot uses AI. Check for mistakes.
#include "yolo_onnx_ros/yolo_inference.hpp"

#include <filesystem>

Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out #define LOGGING suggests this is used for conditional compilation, but there's no documentation explaining when/why a developer should enable it. Add a comment explaining its purpose and usage.

Suggested change
// Uncomment the following line to enable additional logging output for debugging purposes.
// When LOGGING is defined, diagnostic messages will be printed to help trace execution and troubleshoot issues.
// Enable this during development or debugging; leave it commented out in production for better performance and less verbosity.

Copilot uses AI. Check for mistakes.
{
int signalResultNum = outputNodeDims[1];//84
int strideNum = outputNodeDims[2];//8400
int signalResultNum = outputNodeDims[1]; // Should be 605 for OIV7 (4 bbox + 601 classes)
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions OIV7 with 605 (4 bbox + 601 classes), but this appears to be dataset-specific. Add clarification that this value varies by dataset (e.g., 84 for COCO: 4 bbox + 80 classes).

Suggested change
int signalResultNum = outputNodeDims[1]; // Should be 605 for OIV7 (4 bbox + 601 classes)
int signalResultNum = outputNodeDims[1]; // Dataset-specific: e.g., 605 for OIV7 (4 bbox + 601 classes), 84 for COCO (4 bbox + 80 classes)

Copilot uses AI. Check for mistakes.
IasonTheodorou and others added 3 commits November 25, 2025 22:21
…(flexible onnx dims) on muptiple pretrained datasets (flexible yaml reading files)
IasonTheodorou
IasonTheodorou previously approved these changes Nov 25, 2025
@MatthijsBurgh MatthijsBurgh merged commit 3d32ce6 into master Nov 27, 2025
2 checks passed
@IasonTheodorou IasonTheodorou deleted the first_version branch November 27, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants