Update #2

Merged
msk_admin merged 2 commits from update_ into main 2026-06-24 09:16:18 +00:00
Contributor

Summary by CodeRabbit

  • New Features

    • Added end-to-end inference test scripts for single-model and ensemble prediction flows.
    • Supports image preprocessing, request submission to the inference service, and result decoding into readable predictions.
    • Processes batches of images from test folders and saves aggregated outcomes to a results file.
  • Bug Fixes

    • Improved the deployment script to run from the correct working directory before deploying.
  • Chores

    • Added configuration values for the inference service endpoint and model name.
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added end-to-end inference test scripts for single-model and ensemble prediction flows. * Supports image preprocessing, request submission to the inference service, and result decoding into readable predictions. * Processes batches of images from test folders and saves aggregated outcomes to a results file. * **Bug Fixes** * Improved the deployment script to run from the correct working directory before deploying. * **Chores** * Added configuration values for the inference service endpoint and model name. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2026-06-24 09:16:23 +00:00 (Migrated from github.com)

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b82d6f30-7e72-48f5-90bc-7c702dfb29e0

📥 Commits

Reviewing files that changed from the base of the PR and between 43f5c0f7da and 8de0c5e844.

Files ignored due to path filters (17)
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/other_angle/med-lat_1.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/other_angle/med_lat_2.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/other_angle/trans_flex.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_negative/72bb1476-f020-11ed-b527-0a580a5f736a_17.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_negative/72bb322d-f020-11ed-b527-0a580a5f736a_17.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_positive/72bb41ed-f020-11ed-b527-0a580a5f736a_17.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_positive/72bb4c47-f020-11ed-b527-0a580a5f736a_17.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_negative/53a31572-4380-11ee-9e9a-0a580a5f5f0e_11.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_negative/58e7a90f-de3e-11ee-97e2-0a580a5f5b60_11.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_negative/72bb0a8a-f020-11ed-b527-0a580a5f736a_11.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/58e7a7ef-de3e-11ee-97e2-0a580a5f5b60_11.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/58e7aa6d-de3e-11ee-97e2-0a580a5f5b60_11.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb0b3a-f020-11ed-b527-0a580a5f736a_21.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb1aaf-f020-11ed-b527-0a580a5f736a_11.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb1ac0-f020-11ed-b527-0a580a5f736a_11.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb1c1e-f020-11ed-b527-0a580a5f736a_21.png is excluded by !**/*.png
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/NGUYEN THI DO_raw_0_1.jpg is excluded by !**/*.jpg
📒 Files selected for processing (5)
  • workspace/LEGACY/VKIST_ML/codebase-vkist-ultrasound-legacy/ML/app.py
  • workspace/sprint_1_2/CODEBASE/infra/implementation/triton_run/run.sh
  • workspace/sprint_1_2/CODEBASE/infra/tests/test.py
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_1_model.py
  • workspace/sprint_1_2/CODEBASE/infra/tests/test_config.py

📝 Walkthrough

Walkthrough

A cd command is prepended to run.sh to fix the working directory for modal deploy. New test files are added: test_config.py with shared Triton URL and model name constants; test_1_model.py for single sub-model KServe v2 binary inference; and test.py for full ensemble inference with angle/inflammation decoding and batch result output to result.json.

Changes

Triton Inference Test Infrastructure

Layer / File(s) Summary
Config constants and deployment script fix
workspace/sprint_1_2/CODEBASE/infra/tests/test_config.py, workspace/sprint_1_2/CODEBASE/infra/implementation/triton_run/run.sh
Adds TRITON_URL and MODEL_NAME module-level constants to test_config.py; prepends a cd to run.sh so modal deploy executes from the correct directory.
Image loading and preprocessing utilities
workspace/sprint_1_2/CODEBASE/infra/tests/test.py
Adds script-level imports, Triton URL/model constants, ensemble output-name lists, load_image for RGB conversion, preprocess_224 and preprocess_512 for NCHW FP32 tensor preparation at both resolutions.
KServe v2 binary request/response protocol
workspace/sprint_1_2/CODEBASE/infra/tests/test.py, workspace/sprint_1_2/CODEBASE/infra/tests/test_1_model.py
build_ensemble_request serializes JSON metadata joined with dual-resolution tensor bytes; parse_kserve_v2_response reads Inference-Header-Content-Length, decodes the JSON header, and slices the binary payload into named NumPy arrays with a fallback for absent binary_data_size. test_1_model.py is a self-contained demonstration of the same KServe v2 binary protocol for a single sub-model.
Ensemble decoding and batch orchestration
workspace/sprint_1_2/CODEBASE/infra/tests/test.py
Adds softmax, decode_angle_from_ensemble (averaged multi-head logits), decode_inflammation (0.5 threshold), infer_ensemble (end-to-end POST to Triton), analyze_image_flow (conditional inflammation based on angle class), and main (folder scan, per-image inference, error capture, result.json output).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 A hop to the right directory,
then tensors fly across the wire!
Softmax soothes logits' mystery,
inflammation meets the threshold fire.
Results land in a JSON file,
the rabbit grins a satisfied smile.

Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update_

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/DTJ-Tran/pilot_msk_ultrasound_stack/pull/2?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: failure by coderabbit.ai --> > [!CAUTION] > ## Review failed > > The pull request is closed. <!-- end of auto-generated comment: failure by coderabbit.ai --> <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: defaults **Review profile**: CHILL **Plan**: Pro **Run ID**: `b82d6f30-7e72-48f5-90bc-7c702dfb29e0` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 43f5c0f7da2bef23ada5973bf944b72e08c69be9 and 8de0c5e8446f746e64f7081dea9c670d42988770. </details> <details> <summary>⛔ Files ignored due to path filters (17)</summary> * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/other_angle/med-lat_1.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/other_angle/med_lat_2.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/other_angle/trans_flex.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_negative/72bb1476-f020-11ed-b527-0a580a5f736a_17.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_negative/72bb322d-f020-11ed-b527-0a580a5f736a_17.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_positive/72bb41ed-f020-11ed-b527-0a580a5f736a_17.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/post_trans_positive/72bb4c47-f020-11ed-b527-0a580a5f736a_17.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_negative/53a31572-4380-11ee-9e9a-0a580a5f5f0e_11.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_negative/58e7a90f-de3e-11ee-97e2-0a580a5f5b60_11.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_negative/72bb0a8a-f020-11ed-b527-0a580a5f736a_11.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/58e7a7ef-de3e-11ee-97e2-0a580a5f5b60_11.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/58e7aa6d-de3e-11ee-97e2-0a580a5f5b60_11.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb0b3a-f020-11ed-b527-0a580a5f736a_21.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb1aaf-f020-11ed-b527-0a580a5f736a_11.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb1ac0-f020-11ed-b527-0a580a5f736a_11.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/72bb1c1e-f020-11ed-b527-0a580a5f736a_21.png` is excluded by `!**/*.png` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_images/sup-up-long_positive/NGUYEN THI DO_raw_0_1.jpg` is excluded by `!**/*.jpg` </details> <details> <summary>📒 Files selected for processing (5)</summary> * `workspace/LEGACY/VKIST_ML/codebase-vkist-ultrasound-legacy/ML/app.py` * `workspace/sprint_1_2/CODEBASE/infra/implementation/triton_run/run.sh` * `workspace/sprint_1_2/CODEBASE/infra/tests/test.py` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_1_model.py` * `workspace/sprint_1_2/CODEBASE/infra/tests/test_config.py` </details> </details> --- <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough A `cd` command is prepended to `run.sh` to fix the working directory for `modal deploy`. New test files are added: `test_config.py` with shared Triton URL and model name constants; `test_1_model.py` for single sub-model KServe v2 binary inference; and `test.py` for full ensemble inference with angle/inflammation decoding and batch result output to `result.json`. ## Changes **Triton Inference Test Infrastructure** | Layer / File(s) | Summary | |---|---| | **Config constants and deployment script fix** <br> `workspace/sprint_1_2/CODEBASE/infra/tests/test_config.py`, `workspace/sprint_1_2/CODEBASE/infra/implementation/triton_run/run.sh` | Adds `TRITON_URL` and `MODEL_NAME` module-level constants to `test_config.py`; prepends a `cd` to `run.sh` so `modal deploy` executes from the correct directory. | | **Image loading and preprocessing utilities** <br> `workspace/sprint_1_2/CODEBASE/infra/tests/test.py` | Adds script-level imports, Triton URL/model constants, ensemble output-name lists, `load_image` for RGB conversion, `preprocess_224` and `preprocess_512` for NCHW FP32 tensor preparation at both resolutions. | | **KServe v2 binary request/response protocol** <br> `workspace/sprint_1_2/CODEBASE/infra/tests/test.py`, `workspace/sprint_1_2/CODEBASE/infra/tests/test_1_model.py` | `build_ensemble_request` serializes JSON metadata joined with dual-resolution tensor bytes; `parse_kserve_v2_response` reads `Inference-Header-Content-Length`, decodes the JSON header, and slices the binary payload into named NumPy arrays with a fallback for absent `binary_data_size`. `test_1_model.py` is a self-contained demonstration of the same KServe v2 binary protocol for a single sub-model. | | **Ensemble decoding and batch orchestration** <br> `workspace/sprint_1_2/CODEBASE/infra/tests/test.py` | Adds `softmax`, `decode_angle_from_ensemble` (averaged multi-head logits), `decode_inflammation` (0.5 threshold), `infer_ensemble` (end-to-end POST to Triton), `analyze_image_flow` (conditional inflammation based on angle class), and `main` (folder scan, per-image inference, error capture, `result.json` output). | ## Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~20 minutes ## Poem > 🐇 A hop to the right directory, > then tensors fly across the wire! > Softmax soothes logits' mystery, > inflammation meets the threshold fire. > Results land in a JSON file, > the rabbit grins a satisfied smile. ✨ </details> <!-- walkthrough_end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> <details> <summary>📝 Generate docstrings</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> Create stacked PR - [ ] <!-- {"checkboxId": "3e1879ae-f29b-4d0d-8e06-d12b7ba33d98"} --> Commit on current branch </details> <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests - [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Commit unit tests in branch `update_` </details> </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=DTJ-Tran/pilot_msk_ultrasound_stack&utm_content=2)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Sign in to join this conversation.
No description provided.