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

Draft/check ci #7175

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
30467aa
feat(traffic_light_fine_detector): update function for waited IoU
Shin-kyoto May 20, 2024
8c28620
test(traffic_light_fine_detector): add test for util function
Shin-kyoto May 20, 2024
fa31134
test(traffic_light_fine_detector): update CMakeLists.txt with short e…
Shin-kyoto May 20, 2024
b929b13
chore(traffic_light_fine_detector): apply pre-commit
Shin-kyoto May 20, 2024
3365dcb
chore(traffic_light_fine_detector): remove misspelling
Shin-kyoto May 20, 2024
761a221
feat(traffic_light_fine_detector): move definition of util function t…
Shin-kyoto May 21, 2024
aa071cc
Merge branch 'main' into feat/update-tlr-util-function
Shin-kyoto May 21, 2024
981217a
Merge branch 'main' into feat/update-tlr-util-function
Shin-kyoto May 21, 2024
a948ae3
test(traffic_light_fine_detector): make CMakeLists shorter by using a…
Shin-kyoto May 24, 2024
9f1ab61
test(traffic_light_fine_detector): remove unnecessary compiling
Shin-kyoto May 26, 2024
a4160d5
test(traffic_light_fine_detector): disable test that fails now
Shin-kyoto May 29, 2024
c76b5fd
test(traffic_light_fine_detector): add const to variables that do not…
Shin-kyoto May 29, 2024
441a6ff
test(traffic_light_fine_detector): add const to the arguments
Shin-kyoto May 29, 2024
327c358
chore: set CUDA_ARCHITECTURE. This commit should not be merged.
Shin-kyoto May 30, 2024
3cabf12
Revert "chore: set CUDA_ARCHITECTURE. This commit should not be merged."
Shin-kyoto May 30, 2024
a2477c7
chore: remove test code to check CI. this commit should not be merged
Shin-kyoto May 30, 2024
0ff8bed
Revert "chore: remove test code to check CI. this commit should not b…
Shin-kyoto May 30, 2024
145bf55
feat(traffic_light_fine_detector): add link library for test
Shin-kyoto May 30, 2024
7777709
feat(traffic_light_fine_detector): add target directories for test
Shin-kyoto May 30, 2024
85aeaa4
Revert "feat(traffic_light_fine_detector): move definition of util fu…
Shin-kyoto May 30, 2024
0ffe4db
Revert "feat(traffic_light_fine_detector): update function for waited…
Shin-kyoto May 30, 2024
0129f28
Revert "feat(traffic_light_fine_detector): add target directories for…
Shin-kyoto May 30, 2024
f54a2bb
Revert "feat(traffic_light_fine_detector): add link library for test"
Shin-kyoto May 30, 2024
db9db2a
feat(traffic_light_fine_detector): remove test cases
Shin-kyoto May 30, 2024
a542a98
feat(traffic_light_fine_detector): add test function
Shin-kyoto May 30, 2024
2f6f80c
Revert "Revert "feat(traffic_light_fine_detector): update function fo…
Shin-kyoto May 30, 2024
4c941e3
Revert "Revert "feat(traffic_light_fine_detector): move definition of…
Shin-kyoto May 30, 2024
afb9953
feat(traffic_light_fine_detector): add test case
Shin-kyoto May 30, 2024
ff5aed1
feat(traffic_light_fine_detector): add code for checking ci
Shin-kyoto May 31, 2024
9870ac9
feat(traffic_light_fine_detector): add code for checking ci
Shin-kyoto May 31, 2024
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
6 changes: 6 additions & 0 deletions perception/traffic_light_fine_detector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
EXECUTABLE traffic_light_fine_detector_node
)

if(BUILD_TESTING)
ament_auto_add_gtest(traffic_light_fine_detector_tests
test/test_nodelet.cpp
)
endif()

ament_auto_package(INSTALL_TO_SHARE
launch
config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ typedef struct Detection

namespace traffic_light
{
float calWeightedIou(
const sensor_msgs::msg::RegionOfInterest & bbox1, const tensorrt_yolox::Object & bbox2);

class TrafficLightFineDetectorNodelet : public rclcpp::Node
{
using TrafficLightRoi = tier4_perception_msgs::msg::TrafficLightRoi;
Expand Down
8 changes: 2 additions & 6 deletions perception/traffic_light_fine_detector/src/nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace fs = ::std::experimental::filesystem;
#include <utility>
#include <vector>

namespace
namespace traffic_light
{
float calWeightedIou(
const sensor_msgs::msg::RegionOfInterest & bbox1, const tensorrt_yolox::Object & bbox2)
Expand All @@ -44,10 +44,6 @@ float calWeightedIou(
return bbox2.score * area1 / area2;
}

} // namespace

namespace traffic_light
{
inline std::vector<float> toFloatVector(const std::vector<double> double_vector)
{
return std::vector<float>(double_vector.begin(), double_vector.end());
Expand Down Expand Up @@ -225,7 +221,7 @@ float TrafficLightFineDetectorNodelet::evalMatchScore(
float max_score = 0.0f;
const sensor_msgs::msg::RegionOfInterest & expected_roi = roi_p.second.roi;
for (const tensorrt_yolox::Object & detection : id2detections[tlr_id]) {
float score = ::calWeightedIou(expected_roi, detection);
float score = calWeightedIou(expected_roi, detection);
if (score >= max_score) {
max_score = score;
id2bestDetection[tlr_id] = detection;
Expand Down
55 changes: 55 additions & 0 deletions perception/traffic_light_fine_detector/test/test_nodelet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2024 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "traffic_light_fine_detector/nodelet.hpp"

#include <gtest/gtest.h>

sensor_msgs::msg::RegionOfInterest createMapBasedBbox(
const uint32_t x_offset, const uint32_t y_offset, const uint32_t width, const uint32_t height)
{
sensor_msgs::msg::RegionOfInterest bbox;
bbox.x_offset = x_offset;
bbox.y_offset = y_offset;
bbox.width = width;
bbox.height = height;
return bbox;
}

tensorrt_yolox::Object createYoloxBbox(
const int32_t x_offset, const int32_t y_offset, const int32_t width, const int32_t height,
const float score, const int32_t type)
{
tensorrt_yolox::Object bbox;
bbox.x_offset = x_offset;
bbox.y_offset = y_offset;
bbox.width = width;
bbox.height = height;
bbox.score = score;
bbox.type = type;
return bbox;
}

Check warning on line 42 in perception/traffic_light_fine_detector/test/test_nodelet.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Excess Number of Function Arguments

createYoloxBbox has 6 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

TEST(CalWeightedIouTest, NoOverlap)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 10, 10);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.9f, 0);

// check size of map_based_bbox and yolox_bbox
EXPECT_EQ(map_based_bbox.width, 10);
EXPECT_EQ(yolox_bbox.width, 10);
const float iou = traffic_light::calWeightedIou(map_based_bbox, yolox_bbox);
EXPECT_FLOAT_EQ(iou, 0.0f);
// EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}
Loading