Skip to content

Conversation

Abdul-Mukit
Copy link

Description

Closes: #401
When exporting RFDETRSegPreview model, the output_names doesn't contain "masks" in

output_names = ['features'] if backbone_only else ['dets', 'labels']

Fixes:

If args.segmentation_head == True add "masks" to output_names before calling export_onnx.

Type of change

Please delete options that are not relevant.

  • 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?

Run the following code snippet. Optionally change RFDETRSegPreview with any other model.

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)

Output with this PR is the same as expected output:

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)
masks [1, 200, 108, 108] tensor(float)

Any specific deployment considerations

None

Docs

None

@Abdul-Mukit
Copy link
Author

I have read the CLA Document and I sign the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When exporting RFDETRSegPreview using export_onnx(), "masks" not added to output_names.

1 participant