Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert labels to int in det result #272

Merged
merged 3 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/model_api/models/result/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
):
super().__init__()
self._bboxes = bboxes
self._labels = labels
self._labels = labels.astype(np.int32)
self._scores = scores if scores is not None else np.zeros(len(bboxes))
self._label_names = ["#"] * len(bboxes) if label_names is None else label_names
self._saliency_map = saliency_map
Expand Down
2 changes: 1 addition & 1 deletion src/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "openvino_model_api"
version = "0.3.0"
version = "0.3.0.1"
requires-python = ">=3.9"
authors = [
{name = "Intel(R) Corporation"},
Expand Down
17 changes: 17 additions & 0 deletions tests/python/unit/results/test_det_result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

import numpy as np
from model_api.models.result import DetectionResult


def test_cls_result():
tst_vector = np.array([1, 2, 3, 4], dtype=np.float32)
det_result = DetectionResult(
tst_vector, tst_vector, tst_vector, ["a"], tst_vector, tst_vector
)

assert det_result.labels.dtype == np.int32
assert len(det_result.label_names) == 1
Loading