Add OpenVINO model inference when models are run on CPU #72
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.
Following up here on some of the work I did at PW41 (https://projectweek.na-mic.org/PW41_2024_MIT/Projects/IntegrateCpuFriendlyAutoSegmentationAndCtUtilityModelsIntoMhub/)
The main idea would be to provide OpenVINO optimized models for each of the trained models provided in this repo. When run on CPU, these models would be fetched (which are half the size) and optimized inference would be run with the OpenVINO inference API.
Sending this PR in early so we can discuss how to best integrate this.
What I've done so far is:
Take every model url from
Models.json
and convert themodel.pt
to an OpenVINOmodel.xml
andmodel.bin
. These are for now repackaged among the zip files and hosted on my fork here: https://github.com/surajpaib/SlicerMONAIAuto3DSeg/releases/Models The conversion script is rather simple and could be added to a Github action or so if needed. https://gist.github.com/surajpaib/74600da3c2ad4e983f4d5022301bf568I've edited the inference script in the Slicer extension and run the OpenVINO inference using these models (code changes in the PR)
Ran the testing suite from the slicer extension (disabling the GPU). You can see the results here: https://github.com/surajpaib/SlicerMONAIAuto3DSeg/releases/ModelsTestResults
These might not be one to one comparisons with the previous (as I use a different CPU) so maybe these need to be re-run on the machine used for the original benchmark. On my machine, I see a speedup of between 1.5x to 2x. You can refer to the PW page where I put up some comparisons.