Skip to content

Issues With Compiling Package In Xcode 16.1 #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
paulmeddaugh opened this issue Apr 3, 2025 · 5 comments
Open

Issues With Compiling Package In Xcode 16.1 #96

paulmeddaugh opened this issue Apr 3, 2025 · 5 comments
Labels
exports Model exports (ONNX, TensorRT, TFLite, etc.) OBB Oriented Bounding Box (OBB) models question Further information is requested

Comments

@paulmeddaugh
Copy link

paulmeddaugh commented Apr 3, 2025

I am quite new to the Ultralytics world, and have been following the tutorial on the README here to run a YOLO segmentation model. After cloning the repository, I am creating a yolo11n-seg.mlpackage file with the following python code:

pip install ultralytics

from ultralytics import YOLO
model = YOLO('yolo11n-seg.pt')
model.export(format="coreml", int8=True, nms=False, imgsz=[640, 640])

The exported yolo11n-seg.mlpackage file displays in Xcode with the following prediction inputs and outputs:
Image

Upon opening either the YOLOiOSApp.xcodeproj file or any example projects in the ExampleApps folder however, I have been initially met with these compiler errors in the ObbDetector.swift file:

  • Line 133: Capture of 'pointer' with non-sendable type 'UnsafeMutablePointer<Float>' in a @sendable closure
  • Line 156 mentions two errors:
    -- Capture of 'rawDetections' with non-sendable type '[Detection?]' in a @sendable closure
    -- Mutation of captured var 'rawDetections' in concurrently-executing code
Image

I first edited the ObbDetector.swift file with some temporary changes to get around these issues, but it eventually seems to reveal around 15 compiler errors total in the YOLO folder before being able to run any Xcode project in the repository. Nearly all errors seem to have to do with some kind of @sendable or concurrency issue similar to the ones above.

I noticed the README has an image mentioning Xcode version 15.2, so my thought was that it had to do with Swift 5 -> 6 migration issues, but even after setting the Swift Language Version to 4.2 in the Build Settings of a project, the errors persist.

Am I possibly setting up the Xcode projects incorrectly? My environment details are additionally as follows:

  • macOS version: 15.0.1
  • Xcode version: 16.1
  • Swift version on my mac: 6.0.2

I truly do appreciate any time taken to resolve this. Thanks.

@UltralyticsAssistant UltralyticsAssistant added exports Model exports (ONNX, TensorRT, TFLite, etc.) OBB Oriented Bounding Box (OBB) models question Further information is requested labels Apr 3, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @paulmeddaugh, thank you for submitting a ultralytics/yolo-ios-app 🚀 Issue. To help us address your concern efficiently, please ensure you've provided the following information:

  1. For bug reports:

    • A clear and concise description of the bug (✅ provided, thank you!)
    • A minimum reproducible example MRE that demonstrates the issue. If possible, please share the exact steps or code you used to generate the .mlpackage file and any modifications you made to the Xcode project to bypass the errors.
    • Your environment details (✅ provided, thank you!)
    • Expected behavior vs. actual behavior
    • Any error messages or logs related to the issue (✅ provided, thank you!)
  2. For feature requests:

    • A clear and concise description of the proposed feature
    • The problem this feature would solve
    • Any alternative solutions you've considered
  3. For questions:

    • Provide as much context as possible about your question
    • Include any research you've already done on the topic
    • Specify which parts of the documentation, if any, you've already consulted

From your description, it seems you're encountering compiler errors when trying to run the Xcode projects with the .mlpackage file generated from the YOLO model export. Your suspicion regarding potential Swift concurrency changes or Xcode version differences is interesting and could indeed play a role. To assist us further, could you confirm:

  • If you’ve tried running the project without any modifications to the source code (e.g., the temporary changes mentioned)?
  • If the .mlpackage file functions correctly when tested independently?
  • If there are any specific logs or warnings during the .mlpackage export process?

Please make sure you've searched existing issues to avoid duplicates. If you need to add any additional information, feel free to comment on this issue. An Ultralytics engineer will review your report soon and provide further assistance. Thank you for helping us improve the project! 🙌

@john-rocky
Copy link
Contributor

@paulmeddaugh
Thank you for reporting the issue. To clarify the solution, please tell us more about the situation in which the error occurred.

  1. Which sample app were you using when the error occurred?

  2. When using the sample app, what was the task in the initialization arguments for YOLO or YOLOView (YOLOCamera)?

(If you are using the yolo11n-seg model but the task is .obb, please change the task to .seg and try again.)

@paulmeddaugh
Copy link
Author

Hi @john-rocky,

Thanks for responding so quickly. I have used both the YOLOSingleImageSwiftUI and the main app sample apps, though I particularly would like to get the YOLOSingleImageSwiftUI app working. It looks like most of the sample apps use the same local YOLO package, so my assumption has been that errors in that folder would effect most sample apps though.

In my YOLOSingleImageSwiftUI sample app, the YOLO class is initialized as follows:
let yolo = YOLO("yolo11n-seg", task: .segment)

The compiler errors for the ObbDetector.swift file mentioned above are still present though.

@john-rocky
Copy link
Contributor

@paulmeddaugh
Thank you for the detailed information.
We will try to reproduce the error and investigate the cause.
Please wait.

@Intiserahmed
Copy link

@john-rocky Hi, Is there any Update on the solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exports Model exports (ONNX, TensorRT, TFLite, etc.) OBB Oriented Bounding Box (OBB) models question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants