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

Refactor detection FMetric #4130

Merged
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ All notable changes to this project will be documented in this file.
(<https://github.com/openvinotoolkit/training_extensions/pull/4073>)
- Upgrade OpenVINO to 2024.5 and NNCF to 2.14.0
(<https://github.com/openvinotoolkit/training_extensions/pull/4123>)
- Improve FMetric computation
(<https://github.com/openvinotoolkit/training_extensions/pull/4130>)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def postprocess(
for i, (pred, scale_factor, ori_shape) in enumerate(zip(result, scale_factors, ori_shapes)):
boxes = pred["boxes"]
labels = pred["labels"]
scores = pred["scores"]
_scale_factor = [1 / s for s in scale_factor] # (H, W)
boxes = boxes * boxes.new_tensor(_scale_factor[::-1]).repeat((1, int(boxes.size(-1) / 2)))
h, w = ori_shape
Expand All @@ -99,8 +100,10 @@ def postprocess(
keep_indices = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1]) > 0
boxes = boxes[keep_indices > 0]
labels = labels[keep_indices > 0]
scores = scores[keep_indices > 0]
result[i]["boxes"] = boxes
result[i]["labels"] = labels - 1 # Convert back to 0-indexed labels
result[i]["scores"] = scores
if "masks" in pred:
masks = pred["masks"][keep_indices]
masks = paste_masks_in_image(masks, boxes, ori_shape)
Expand Down
Loading
Loading