fix: modify data type of output segmentation mask to int64_t#49
Merged
fix: modify data type of output segmentation mask to int64_t#49
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the SemanticSegmenter2D class to use 64-bit integers (int64_t) consistently throughout the CUDA memory pipeline and postprocessing operations, replacing the previous 32-bit integer (int) implementation.
- Changed CUDA device memory allocation and operations to use
int64_tinstead ofint - Updated postprocessing to explicitly convert
int64_tclass IDs tounsigned charfor OpenCV compatibility - Added standard library headers for future use
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| mmros/src/detector/semantic_segmenter2d.cpp | Updated CUDA memory operations to use int64_t, refactored postprocessing conversion logic, and added standard library includes |
| mmros/include/mmros/detector/semantic_segmenter2d.hpp | Changed output_d_ member variable type from int[] to int64_t[] |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
db2d492 to
8a31da7
Compare
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 updates the
SemanticSegmenter2Dclass to handle output masks asint64_t(64-bit integers) instead ofint(typically 32-bit), ensuring consistency in data types across CUDA device memory, host memory, and postprocessing. It also updates the way output masks are converted for use with OpenCV.Data type consistency and memory handling:
output_d_inSemanticSegmenter2Dfromint[]toint64_t[]to ensure the output mask uses 64-bit integers throughout the CUDA pipeline.int64_tinstead ofint, both in device memory allocation (cuda::make_unique<int64_t[]>) and host-side vectors (std::vector<int64_t>), and adjusted thecudaMemcpysize accordingly. [1] [2]Postprocessing and OpenCV compatibility:
int64_tclass IDs tounsigned charwhen creating OpenCVcv::Matmasks, replacing the previous method of casting a vector and usingmemcpywith an explicit per-element conversion loop. This ensures correct conversion and avoids issues with direct memory reinterpretation.Code hygiene:
<chrono>,<map>,<sstream>,<thread>) tosemantic_segmenter2d.cpp, likely for future use or consistency.How was this PR tested?
Notes for reviewers
None.
Effects on system behavior
None.