Skip to content
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

Custom Model export for simulation app #65

Open
bibekdhakal opened this issue Nov 9, 2024 · 3 comments
Open

Custom Model export for simulation app #65

bibekdhakal opened this issue Nov 9, 2024 · 3 comments
Labels
exports Model exports (ONNX, TensorRT, TFLite, etc.) question Further information is requested solutions Ultralytics Solutions issues, PR's, Discussions

Comments

@bibekdhakal
Copy link

Do we need a specific output format to detect the object using the same code base? I tried importing my custom model to the application and was able to import the .mlpackage as well, but unable to detect anything.

Model conversion

from ultralytics import YOLO
import coremltools as ct
import os

model = YOLO('./corrosionModel.pt')
model.export(format="coreml", data="./data.data.yaml",)

Initially, I had an issue referring to the class label missing, but I fixed the issue by using names from additional metadata as class labels. I was able to build the application, but it detected nothing.

Did I miss something?

Thanks

@UltralyticsAssistant UltralyticsAssistant added exports Model exports (ONNX, TensorRT, TFLite, etc.) question Further information is requested labels Nov 9, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @bibekdhakal, thank you for opening this ultralytics/yolo-ios-app 🚀 Issue. To help us address your concern more efficiently, please make sure you've provided the following information:

  1. For bug reports:
    • A clear and concise description of the issue you're experiencing
    • A minimum reproducible example (MRE) see here that demonstrates the problem
    • Details about your environment, such as iOS version and device details
    • The expected behavior vs. the actual behavior you're facing
    • Any error messages or logs related to the issue

👏 Thank you for mentioning that you managed to import the .mlpackage and addressed the class label issue. It sounds like the conversion part is mostly working, but let's dig deeper to understand why detection isn't happening.

  1. Have you verified the following?
    • Ensured the input size for the model matches the expected input size in the app
    • Double-checked that the class labels are correctly set in your Core ML model

Feel free to update this issue with any additional info, and please ensure you've checked similar issues to avoid duplicates. An Ultralytics engineer will review your issue soon to provide further assistance. Thank you for contributing and helping us improve! 🤖✨

@pderrenger
Copy link
Member

@bibekdhakal ensure that your input image dimensions match those used during training and that the model's input and output specifications align with your application requirements. Additionally, verify that the class labels are correctly mapped in your application. If the issue persists, try testing the model with a simple script to confirm its functionality outside the app environment.

@john-rocky john-rocky added the solutions Ultralytics Solutions issues, PR's, Discussions label Dec 17, 2024
@john-rocky
Copy link
Contributor

@bibekdhakal
To use your custom model with the code in this repository, add nms (Non Max Suppression) to your CoreML model when exporting, which will automatically add the class labels as well.

from ultralytics import YOLO

model = YOLO("custom_model.pt")
model.export(format="coreml", nms=True, imgsz=[640, 640])
スクリーンショット 2024-12-17 21 18 27

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.) question Further information is requested solutions Ultralytics Solutions issues, PR's, Discussions
Projects
None yet
Development

No branches or pull requests

4 participants