rf-detr icon indicating copy to clipboard operation
rf-detr copied to clipboard

fix: onnx convert output shape prints

Open y-yang42 opened this issue 2 months ago • 3 comments
trafficstars

Description

When exporting to onnx, current code prints

PyTorch inference output shapes - Boxes: torch.Size([1, 3900, 4]), Labels: torch.Size([1, 3900, 2])

instead of

PyTorch inference output shapes - Boxes: torch.Size([1, 300, 4]), Labels: torch.Size([1, 300, 2])

as self.model is put to eval() instead of model.

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

from rfdetr import RFDETRBase

model = RFDETRBase()
model.export()

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • [ ] Docs updated? What were the changes:

y-yang42 avatar Sep 03 '25 22:09 y-yang42

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 03 '25 22:09 CLAassistant

it's just the print statement that's wrong, correct? the onnx graph actually does have 300 outputs for you?

isaacrob-roboflow avatar Sep 08 '25 17:09 isaacrob-roboflow

it's just the print statement that's wrong, correct? the onnx graph actually does have 300 outputs for you?

Yes, only the print statement is wrong, onnx graph do have 300 outputs.

When running 2 export consecutively,

from rfdetr import RFDETRBase

model = RFDETRBase()
model.export()
model.export()

The first one will print 3900 and the second one will print 300. The model is switched to eval mode somewhere during the conversion process.

y-yang42 avatar Sep 08 '25 20:09 y-yang42