Skip to content

Commit

Permalink
fix(trace_yolox): bbox shifted by 1 when training yolox
Browse files Browse the repository at this point in the history
  • Loading branch information
Bycob authored and mergify[bot] committed Jan 31, 2023
1 parent 53d0c39 commit 487bad7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/torch/trace_yolox.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ def forward(self, x, ids=None, bboxes=None, labels=None):
bboxes[start:stop]
targ = torch.cat(
(
labels[start:stop].unsqueeze(1),
# dd uses 0 as background class, not YOLOX
labels[start:stop].unsqueeze(1) - 1,
self.convert_targs(bboxes[start:stop]),
),
dim=1,
)
# dd uses 0 as background class, not YOLOX
targ = targ - 1

l_targs.append(targ)
max_count = max(max_count, targ.shape[0])

Expand Down Expand Up @@ -425,7 +425,9 @@ def fill_args_from_repo(repo_path, args):
logging.info("Deduced model %s with suffix %s" % (args.model, suffix))

if not model_found:
raise RuntimeError("Could not deduce the model from repository name %s" % repo_name)
raise RuntimeError(
"Could not deduce the model from repository name %s" % repo_name
)


if __name__ == "__main__":
Expand Down

0 comments on commit 487bad7

Please sign in to comment.