Skip to content

Commit

Permalink
update rtdetr
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene123tw committed Sep 9, 2024
1 parent 10f7058 commit 96eec3a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/otx/algo/detection/rtdetr.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ def _customize_inputs(
# prepare bboxes for the model
for bb, ll in zip(entity.bboxes, entity.labels):
# convert to cxcywh if needed
converted_bboxes = (
box_convert(bb, in_fmt="xyxy", out_fmt="cxcywh") if bb.format == BoundingBoxFormat.XYXY else bb
)
# normalize the bboxes
scaled_bboxes = converted_bboxes / torch.tensor(bb.canvas_size[::-1]).tile(2)[None].to(
converted_bboxes.device,
)
scaled_bboxes = bb
if len(bb):
converted_bboxes = (

Check warning on line 80 in src/otx/algo/detection/rtdetr.py

View check run for this annotation

Codecov / codecov/patch

src/otx/algo/detection/rtdetr.py#L78-L80

Added lines #L78 - L80 were not covered by tests
box_convert(bb, in_fmt="xyxy", out_fmt="cxcywh") if bb.format == BoundingBoxFormat.XYXY else bb
)
# normalize the bboxes
scaled_bboxes = converted_bboxes / torch.tensor(bb.canvas_size[::-1]).tile(2)[None].to(

Check warning on line 84 in src/otx/algo/detection/rtdetr.py

View check run for this annotation

Codecov / codecov/patch

src/otx/algo/detection/rtdetr.py#L84

Added line #L84 was not covered by tests
converted_bboxes.device,
)
targets.append({"boxes": scaled_bboxes, "labels": ll})

return {
Expand Down

0 comments on commit 96eec3a

Please sign in to comment.