Skip to content

refactor: decouple ClassificationModel from OpenVINO#458

Merged
mgumowsk merged 9 commits intomasterfrom
ttybulew/449-decouple-from-openvino
Dec 17, 2025
Merged

refactor: decouple ClassificationModel from OpenVINO#458
mgumowsk merged 9 commits intomasterfrom
ttybulew/449-decouple-from-openvino

Conversation

@tybulewicz
Copy link
Contributor

@tybulewicz tybulewicz commented Dec 16, 2025

What does this PR do?

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

Fixes #449

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@tybulewicz tybulewicz changed the title refactor: decouple from openvino refactor: decouple ClassificationModel from openvino Dec 16, 2025
@tybulewicz tybulewicz requested a review from Copilot December 16, 2025 08:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions bot added tests Related to tests python python related changes labels Dec 16, 2025
@tybulewicz tybulewicz requested a review from Copilot December 16, 2025 08:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@open-edge-platform open-edge-platform deleted a comment from Copilot AI Dec 16, 2025
@tybulewicz tybulewicz requested a review from Copilot December 16, 2025 08:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tybulewicz tybulewicz requested a review from Copilot December 16, 2025 10:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tybulewicz tybulewicz marked this pull request as ready for review December 16, 2025 10:56
@tybulewicz tybulewicz requested a review from a team as a code owner December 16, 2025 10:56
@tybulewicz tybulewicz enabled auto-merge December 16, 2025 15:14
@tybulewicz tybulewicz changed the title refactor: decouple ClassificationModel from openvino refactor: decouple ClassificationModel from OpenVINO Dec 16, 2025
@tybulewicz tybulewicz added this pull request to the merge queue Dec 17, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 17, 2025
* 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
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 17, 2025
@mgumowsk mgumowsk added this pull request to the merge queue Dec 17, 2025
Merged via the queue into master with commit 6591c07 Dec 17, 2025
36 of 38 checks passed
@mgumowsk mgumowsk deleted the ttybulew/449-decouple-from-openvino branch December 17, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python python related changes tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decouple ClassificationModel from OpenVINO

3 participants