Skip to content

Exported RFDETRSegPreview ONNX model has Addlabels_dim_1 in shape information for masks. #405

@Abdul-Mukit

Description

@Abdul-Mukit

Search before asking

  • I have searched the RF-DETR issues and found no similar bug report.

Bug

After exporting RFDETRSegPreview as an ONNX model, the output shape information for masks is incomplete. When printing out the shape information stored for masks, it prints out as:
[1, 'Addlabels_dim_1', 108, 108]

The expected shape information is:
[1, 200, 108, 108]

This causes further problems when trying to use the ONNX model to run detections.

Environment

  • RF-DETR: 1.3.0
  • Torch: 2.8.0+cu128
  • OS: Debian 11
  • onnxruntime: 1.19.2

Minimal Reproducible Example

from rfdetr import RFDETRSegPreview
import onnxruntime as ort

model = RFDETRSegPreview()
model.export(verbose=False)

session = ort.InferenceSession("output/inference_model.onnx")

inputs = session.get_inputs()
print("ONNX input details: ")
for input in inputs:
    print(input.name, input.shape, input.type)

print("ONNX output details: ")
outputs = session.get_outputs()
for output in outputs:
    print(output.name, output.shape, output.type)

This prints out:

Successfully exported ONNX model: output/inference_model.onnx
Successfully exported ONNX model to: output/inference_model.onnx
ONNX export completed successfully
ONNX input details: 
input [1, 3, 432, 432] tensor(float)
ONNX output details: 
dets [1, 200, 4] tensor(float)
labels [1, 200, 91] tensor(float)
4245 [1, 'Addlabels_dim_1', 108, 108] tensor(float)

Additional

This only happened on Linux (Tried two machines). When trying this on Windows-WSL it didn't happen. For example, the results obtained in this MR (#402 ) was tested on Windows-WSL.
The output was as expected.

Are you willing to submit a PR?

  • Yes, I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions