[Feature] rocCV + MIGraphX classification sample#149
Open
zacharyvincze wants to merge 21 commits intoROCm:developfrom
Open
[Feature] rocCV + MIGraphX classification sample#149zacharyvincze wants to merge 21 commits intoROCm:developfrom
zacharyvincze wants to merge 21 commits intoROCm:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a GPU image-classification sample demonstrating rocCV preprocessing feeding directly into MIGraphX (zero-copy via raw GPU pointer + shared HIP stream), alongside Python-binding ergonomics improvements (dtype/layout flexibility, interop helpers) and corresponding Python test updates.
Changes:
- Added new Python classification samples: MIGraphX (ONNX) and PyTorch (ResNet50).
- Updated Python bindings to accept NumPy dtypes and layout strings, reordered
Tensorctor args, and exposedTensor.data_ptr()+Stream.handle(). - Updated existing Python operator tests to use the new
Tensorconstructor argument order.
Reviewed changes
Copilot reviewed 34 out of 36 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/roccv/python/test_op_warp_perspective.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_warp_affine.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_thresholding.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_rotate.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_resize.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_remap.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_reformat.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_normalize.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_non_max_suppression.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_histogram.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_gamma_contrast.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_flip.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_cvt_color.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_custom_crop.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_copy_make_border.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_convert_to.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_composite.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_center_crop.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_bnd_box.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_bilateral_filter.py | Update Tensor(...) ctor arg order in test. |
| tests/roccv/python/test_op_adv_cvt_color.py | Update Tensor(...) ctor arg order in test. |
| samples/pytorch-classification/pytorch_classification.py | New sample: rocCV preprocessing + PyTorch inference. |
| samples/pytorch-classification/README.md | Docs for the PyTorch sample. |
| samples/migraphx-classification/migraphx_classification.py | New sample: rocCV preprocessing + MIGraphX inference, zero-copy buffer + shared stream. |
| samples/migraphx-classification/README.md | Docs for MIGraphX sample usage + interop details. |
| python/src/rocpycv.pyi | Updated stubs/docs, new interop methods, relaxed dtype/layout typing. |
| python/src/py_tensor.cpp | Reordered ctor args; accept NumPy dtype/layout strings; add data_ptr; update reshape/from_dlpack to accept layout strings. |
| python/src/py_stream.cpp | Add Stream.handle() returning hipStream_t as integer. |
| python/src/py_helpers.cpp | Add LayoutFromPyObject / DataTypeFromPyObject parsing helpers. |
| python/src/py_enums.cpp | Adjust exported Python enums (notably eDataType). |
| python/src/operators/py_op_reformat.cpp | Allow reformat(..., out_layout) to accept layout strings. |
| python/src/operators/py_op_convert_to.cpp | Allow convert_to(..., dtype) to accept NumPy dtype/scalar types. |
| python/src/main.cpp | Expanded module docstring/quick-start documentation. |
| python/include/py_tensor.hpp | Match ctor arg reorder; declare getDataPtr. |
| python/include/py_stream.hpp | Declare getHandle. |
| python/include/py_helpers.hpp | Declare new dtype/layout parsing helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Added additional tests for PyStream/PyTensor since they've added functionality. |
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 PR adds an MIGraphX image classification sample to demonstrate interoperability between rocCV (as the image preprocessor) and MIGraphX as the inference engine. Also in this PR are some quality of life improvements to the Python bindings.
Technical Details
Sample Application
Changes to Python Bindings
dtypeandlayoutinrocpycv.Tensorconstructors to match existing computer vision libraries.dtypeparameters now accept numpy scalar types (e.g.np.uint8).layoutparameters now accept string representations (e.g."NHWC").rocpycv.Tensor.data_ptr()to facilitate interoperability with other ROCm libraries such as MIGraphX.hipStream_treference can now be exposed usingrocpycv.Stream.handle().