Skip to content

Commit

Permalink
update division
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaichemmanam committed Sep 17, 2020
1 parent 9409886 commit 7a6d181
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/models/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def _topk(scores, K=40):
topk_scores, topk_inds = torch.topk(scores.view(batch, cat, -1), K)

topk_inds = topk_inds % (height * width)
topk_ys = (topk_inds / width).int().float()
topk_ys = (topk_inds // width).int().float()
topk_xs = (topk_inds % width).int().float()

topk_score, topk_ind = torch.topk(topk_scores.view(batch, -1), K)
topk_clses = (topk_ind / K).int()
topk_clses = (topk_ind // K).int()
topk_inds = _gather_feat(
topk_inds.view(batch, -1, 1), topk_ind).view(batch, K)
topk_ys = _gather_feat(topk_ys.view(batch, -1, 1), topk_ind).view(batch, K)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/models/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def forward(self, seg_feat, conv_weight, mask, ind, target):
batch_size = seg_feat.size(0)
weight = _transpose_and_gather_feat(conv_weight, ind)
h, w = seg_feat.size(-2), seg_feat.size(-1)
x, y = ind % w, ind/w
x, y = ind % w, ind//w
x_range = torch.arange(w).float().to(device=seg_feat.device)
y_range = torch.arange(h).float().to(device=seg_feat.device)
y_grid, x_grid = torch.meshgrid([y_range, x_range])
Expand Down

0 comments on commit 7a6d181

Please sign in to comment.