refactor: decouple ClassificationModel from OpenVINO#458
Conversation
There was a problem hiding this comment.
Pull request overview
This PR decouples the ClassificationModel from OpenVINO-specific dependencies by removing direct OpenVINO API usage for runtime model manipulation. The refactoring shifts the TopK and Softmax operations from model graph modifications to pure NumPy implementations, making the classification model more framework-agnostic.
Key changes:
- Removed OpenVINO-specific model graph manipulation (TopK/Softmax insertion)
- Introduced utility functions (
is_softmaxed,topk) for runtime processing - Simplified single-label classification setup by eliminating embedded processing logic
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/model_api/models/classification.py | Removed OpenVINO model graph manipulation code and replaced with NumPy-based TopK/Softmax runtime processing |
| src/model_api/models/utils.py | Added utility functions is_softmaxed and topk to support framework-agnostic classification operations |
| tests/accuracy/test_accuracy.py | Optimized model reading by reusing already-loaded model instance instead of redundant file read |
| tests/accuracy/public_scope.json | Updated expected confidence value reflecting behavioral changes from refactoring |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Remove legacy OVMS support * Simplify labels selection in get_multiclass_predictions * Skip graph modification for models without embedded softmax * Skip not needed model read in tests * Calculate TopK if output is already softmaxed * Don't softmax raw_scores if already done * Rename variables to match python standards * Remove misleading variable names * Remove handholding from internal function
What does this PR do?
This PR decouples the
ClassificationModelfrom OpenVINO-specific dependencies by removing direct OpenVINO API usage for runtime model manipulation. The refactoring shifts the TopK and Softmax operations from model graph modifications to pure NumPy implementations, making the classification model more framework-agnostic.Key changes:
is_softmaxed,topk) for runtime processingFixes #449
Before submitting