Skip to content

Conversation

@taharh
Copy link

@taharh taharh commented Feb 2, 2026

What does this PR do?

Fixes ONNX export for segmentation models.

Issues fixed:

  1. Export failed with AttributeError: 'dict' object has no attribute 'shape' because pred_masks can be a dictionary (containing spatial_features, query_features, bias) rather than a tensor. Added a check to handle both cases in main.py and deploy/export.py.

  2. Pinned onnx>=1.16.0,<1.20 in pyproject.toml to avoid compatibility issues with onnx_graphsurgeon (onnx 1.20+ removed float32_to_bfloat16).

Related Issue(s): Related to PR #578 and to Issue #580

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

  • I have tested this change locally

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have updated the documentation accordingly (if applicable)

@CLAassistant
Copy link

CLAassistant commented Feb 2, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 22%. Comparing base (35ac6ab) to head (1e0d31c).

❌ Your patch check has failed because the patch coverage (0%) is below the target coverage (95%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (22%) is below the target coverage (95%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@          Coverage Diff           @@
##           develop   #626   +/-   ##
======================================
- Coverage       22%    22%   -0%     
======================================
  Files           46     46           
  Lines         6182   6188    +6     
======================================
  Hits          1343   1343           
- Misses        4839   4845    +6     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@probicheaux
Copy link
Collaborator

lgtm!

Comment on lines +43 to +46
try:
from rfdetr import RFDETRSegNano
except ImportError:
pytest.skip("rfdetr not installed")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
from rfdetr import RFDETRSegNano
except ImportError:
pytest.skip("rfdetr not installed")

what is the case this is missing?

Comment on lines +48 to +51
try:
import onnx # noqa: F401
except ImportError:
pytest.skip("onnx not installed, run: pip install rfdetr[onnxexport]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use rather a decorator pytest.mark.skipif(...)

[project.optional-dependencies]
onnxexport = [
"onnx",
"onnx>=1.16.0,<1.20",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"onnx>=1.16.0,<1.20",
"onnx>=1.16.0",

Won't it work with versions above 1.20?

@Borda Borda added the bug Something isn't working label Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants