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

[TOPI] Fix data race of batch multibox detection #14343

Merged
merged 4 commits into from
Apr 7, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
skip copy of box coord
wrongtest-intellif committed Apr 5, 2023
commit 5b48efae105e1f32a68c14a39118448b97dfd0d0
13 changes: 6 additions & 7 deletions python/tvm/topi/vision/ssd/multibox.py
Original file line number Diff line number Diff line change
@@ -137,12 +137,12 @@ def multibox_prior(data, sizes=(1,), ratios=(1,), steps=(-1, -1), offsets=(0.5,


@hybrid.script
def _hybridy_transform_loc(box, pred_loc, variance, clip, batch_idx):
def _hybridy_transform_loc(anchor, pred_loc, variance, clip, batch_idx, anchor_idx):
"""Transform prior anchor box to output box through location predictions."""
al = box[batch_idx, 0]
at = box[batch_idx, 1]
ar = box[batch_idx, 2]
ab = box[batch_idx, 3]
al = anchor[0, anchor_idx, 0]
at = anchor[0, anchor_idx, 1]
ar = anchor[0, anchor_idx, 2]
ab = anchor[0, anchor_idx, 3]

px = pred_loc[batch_idx, 0]
py = pred_loc[batch_idx, 1]
@@ -242,9 +242,8 @@ def hybrid_multibox_transform_loc(cls_prob, loc_pred, anchor, clip, threshold, v
out_loc[i, valid_count[i], 0] = cls_id - 1.0
out_loc[i, valid_count[i], 1] = score
for l in range(4):
box_coord[i, l] = anchor[0, j, l]
pred_coord[i, l] = loc_pred[i, j * 4 + l]
out_coord = _hybridy_transform_loc(box_coord, pred_coord, variances, clip, i)
out_coord = _hybridy_transform_loc(anchor, pred_coord, variances, clip, i, j)
out_loc[i, valid_count[i], 2] = out_coord[0]
out_loc[i, valid_count[i], 3] = out_coord[1]
out_loc[i, valid_count[i], 4] = out_coord[2]