Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Sep 3, 2024
1 parent 275492f commit f2fd0db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ class ImageStream
return false;
}
for (uint32_t i = 0; i < batch_size_; ++i) {
auto image =
cv::imread(calibration_images_.at(batch_size_ * current_batch_ + i).c_str(), cv::IMREAD_COLOR);
auto image = cv::imread(
calibration_images_.at(batch_size_ * current_batch_ + i).c_str(), cv::IMREAD_COLOR);
RCLCPP_INFO(
rclcpp::get_logger("autoware_tensorrt_rtmdet_calibrator"), "Preprocess %s",
calibration_images_.at(batch_size_ * current_batch_ + i).c_str());
Expand Down
5 changes: 3 additions & 2 deletions perception/autoware_tensorrt_rtmdet/src/tensorrt_rtmdet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,9 @@ void TrtRTMDet::preprocessWithRoiGpu(
CHECK_CUDA_ERROR(cudaMemcpyAsync(
roi_d_.get(), roi_h_.get(), batch_size * sizeof(Roi), cudaMemcpyHostToDevice, *stream_));
crop_resize_bilinear_letterbox_nhwc_to_nchw32_batch_gpu(
input_d_.get(), image_buf_d_.get(), input_width, input_height, 3, roi_d_.get(), images.at(0).cols,
images.at(0).rows, 3, batch_size, static_cast<float>(norm_factor_), *stream_);
input_d_.get(), image_buf_d_.get(), input_width, input_height, 3, roi_d_.get(),
images.at(0).cols, images.at(0).rows, 3, batch_size, static_cast<float>(norm_factor_),
*stream_);
}

Check warning on line 393 in perception/autoware_tensorrt_rtmdet/src/tensorrt_rtmdet.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Code Duplication

The module contains 4 functions with similar structure: TrtRTMDet::multiScalePreprocess,TrtRTMDet::multiScalePreprocessGpu,TrtRTMDet::preprocessWithRoi,TrtRTMDet::preprocessWithRoiGpu. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 393 in perception/autoware_tensorrt_rtmdet/src/tensorrt_rtmdet.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

TrtRTMDet::preprocessWithRoiGpu has a cyclomatic complexity of 12, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 393 in perception/autoware_tensorrt_rtmdet/src/tensorrt_rtmdet.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Bumpy Road Ahead

TrtRTMDet::preprocessWithRoiGpu has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check warning on line 393 in perception/autoware_tensorrt_rtmdet/src/tensorrt_rtmdet.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Deep, Nested Complexity

TrtRTMDet::preprocessWithRoiGpu has a nested complexity depth of 4, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.

void TrtRTMDet::preprocessWithRoi(
Expand Down

0 comments on commit f2fd0db

Please sign in to comment.