Core ML nms=True' is not available for end2end models. Forcing 'nms=False'.
Search before asking
- [X] I have searched the Ultralytics YOLO issues and found no similar bug report.
Ultralytics YOLO Component
Model Export
Bug
Ultralytics 8.3.3 π Python-3.11.6 torch-2.4.0 CPU (Apple M1 Max) YOLOv10m summary (fused): 369 layers, 16,451,542 parameters, 0 gradients, 63.4 GFLOPs
PyTorch: starting from '/Users/premy/PycharmProjects/weeds-onions/models/hemp-yolov10-medium-20240708/weights.pt' with input shape (1, 3, 1024, 1024) BCHW and output shape(s) (1, 300, 6) (32.0 MB)
CoreML: starting export with coremltools 8.0... CoreML: WARNING β οΈ 'nms=True' is not available for end2end models. Forcing 'nms=False'.
Does someone know why? It's a YOLO v10 medium model for object detection with just one class.
Does it mean all YOLO v10 can't be exported?
Environment
Python 3.11 Mac OS
Minimal Reproducible Example
model = YOLO(weights)
model_dir = model.export(format='mlpackage', nms=True) # creates 'yolo11n.mlpackage'
Additional
No response
Are you willing to submit a PR?
- [ ] Yes I'd like to help by submitting a PR!
YOLOv10 doesn't use NMS.
π Hello @philipperemy, thank you for reaching out and using Ultralytics π!
For your query regarding the Core ML export issue where 'nms=True' is not available for end2end models, it sounds like a concern with the integration between Core ML tools and YOLO. This is an automated response to guide you through some initial steps while an Ultralytics engineer also looks into your issue soon.
If this is a π Bug Report, thank you for already providing a minimum reproducible example. It's helpful for diagnosing the problem more efficiently.
Here are some suggestions while we investigate:
-
Ensure youβre running the latest version of the
ultralyticspackage and dependencies. You can upgrade with:pip install -U ultralytics -
Double-check that you're using an appropriate environment. YOLO models should be run in environments that adhere to all requirements. It's also a good idea to test in different environments, such as Google Colab or a verified Docker setup.
-
Explore further documentation:
- For exporting models, take a look at our export guide.
- For understanding non-maximum suppression in exports, this Core ML section might be useful.
Join our community channels for real-time discussions and support:
Feel free to follow up or provide additional details as necessary. Your patience is appreciated while we work on finding a resolution!
@Y-T-G okay gotcha but do you know how can I get the preview with MacOS? I was using NMS with yolo v8 before for that. Otherwise the preview is not available and the model is unusable.
That's probably a CoreML issue. The model should still work if it works in ultralytics
yes it does work seamlessly with ultralytics. The issue is the export to Core ML. I will leave it open for this reason.
You can run the Core ML model in ultralytics too. If it works, then there isn't an issue with export.
It appears that the ONNX conversion might have the same issue.
In the screenshot, the left side shows the ONNX model without the nms=True option, while the right side includes the nms=True option. The results seem to have the same architecture.
@DenDen047 ONNX export in ultralytics doesn't support nms=True. Only arguments listed in the table for the format is supported.
https://docs.ultralytics.com/modes/export/#export-formats
Well, long story short, you'll have to implement the NMS yourself with Swift because it is no longer supported. It used to be up to Yolo v8 (if my memory is correct).
Thank you for your input. Implementing NMS in Swift is indeed a viable solution for handling post-processing in Core ML models. If you need further assistance, feel free to ask.
π Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO π and Vision AI β
Well ideally it should be part of the ultralytics framework.
Thank you for the suggestion. While NMS functionality for exported models is not currently integrated, it remains a feature request for potential future development. Contributions via PRs are always welcome!
nms is supported for CoreMLTools. YOLOv10 doesn't use or need NMS, so it doesn't export with nms. YOLO11 is similar to YOLOv8 and also uses NMS.
For preview, maybe try exporting with format="mlmodel"
π Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO π and Vision AI β