refactor: add a function for preprocessing image#59
Merged
Conversation
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Contributor
There was a problem hiding this comment.
Pull Request Overview
Refactors image preprocessing pipeline by introducing a unified preprocess_image function and reorganizing GPU kernel declarations for better code maintainability and reduced duplication.
- Introduced
process::preprocess_imagefunction to replace duplicated preprocessing code across detector modules - Moved low-level GPU kernel declarations from
image.hppto newimage_kernel.hppfor better separation of concerns - Simplified all detector modules by removing manual buffer management and direct kernel calls
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| mmros/src/process/image.cpp | New implementation of unified preprocessing function |
| mmros/include/mmros/process/image.hpp | Refactored to include new preprocessing function and remove kernel declarations |
| mmros/include/mmros/process/image_kernel.hpp | New header containing all GPU kernel function declarations |
| mmros/src/process/image_kernel.cu | Updated include to reference new kernel header |
| mmros/src/detector/*.cpp | Simplified preprocessing by using new unified function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request refactors the image preprocessing pipeline for various detector modules in the project. The main change is the introduction of a new unified preprocessing function,
preprocess_image, which streamlines and replaces the previous manual, repetitive preprocessing code across multiple detectors. This improves maintainability and reduces code duplication. Additionally, the low-level GPU kernel function declarations have been moved to a dedicated header file for better organization.Refactoring and code organization:
process::preprocess_imagefunction inmmros/process/image.hppto provide a unified interface for image preprocessing on the GPU. This function replaces the manual memory allocation and kernel calls previously present in each detector module.image.hppto the newmmros/process/image_kernel.hppfile for better separation of concerns and code clarity.Detector module simplification:
preprocessmethods inDetector2D,InstanceSegmenter2D,PanopticSegmenter2D, andSemanticSegmenter2Dto use the newprocess::preprocess_imagefunction, removing manual buffer management and direct kernel calls. [1] [2] [3]License and header updates:
image.hppto reflect the new author and year.These changes collectively improve code maintainability, readability, and modularity, making it easier to extend or modify preprocessing logic in the future.
How was this PR tested?
Notes for reviewers
None.
Effects on system behavior
None.