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

Add legacy ssd-like IRs support #1970

Merged
merged 2 commits into from
Apr 6, 2023
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All notable changes to this project will be documented in this file.

### Bug fixes

-
- Fix backward compatibility with OpenVINO SSD-like detection models from OTE 0.5 (<https://github.com/openvinotoolkit/training_extensions/pull/1970>)

### Known issues

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ def __init__(self, layers, input_size, labels_layer="labels", default_label=0):
self.labels_layer = None
self.default_label = default_label

self.bboxes_layer = self.find_layer_bboxes_output(layers)
try:
self.bboxes_layer = self.find_layer_bboxes_output(layers)
except ValueError:
self.bboxes_layer = find_layer_by_name("boxes", layers)

self.input_size = input_size

@staticmethod
Expand All @@ -146,7 +150,8 @@ def __call__(self, outputs):
"""Parse bboxes."""
# FIXME: here, batch dim of IR must be 1
bboxes = outputs[self.bboxes_layer]
bboxes = bboxes.squeeze(0)
if bboxes.shape[0] == 1:
cih9088 marked this conversation as resolved.
Show resolved Hide resolved
bboxes = bboxes.squeeze(0)
assert bboxes.ndim == 2
scores = bboxes[:, 4]
bboxes = bboxes[:, :4]
Expand All @@ -156,7 +161,8 @@ def __call__(self, outputs):
labels = outputs[self.labels_layer]
else:
labels = np.full(len(bboxes), self.default_label, dtype=bboxes.dtype)
labels = labels.squeeze(0)
if labels.shape[0] == 1:
cih9088 marked this conversation as resolved.
Show resolved Hide resolved
labels = labels.squeeze(0)

detections = [Detection(*bbox, score, label) for label, score, bbox in zip(labels, scores, bboxes)]
return detections