Open gustavofuhr opened 4 months ago
@gustavofuhr hello,
Thank you for your kind words and for using our project! 😊
Regarding your issue with exporting YOLO models and missing class labels, it appears that the class labels are not being included in the exported model's metadata. Unfortunately, the current export functionality does not automatically include class labels in the exported model's metadata.
However, you can manually add the class labels to the model's metadata before exporting. Here’s an example of how you can achieve this:
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n.pt") # load an official model
# Define class labels
class_labels = ["class1", "class2", "class3", ...] # replace with your actual class labels
# Add class labels to model's metadata
model.names = class_labels
# Export the model with the updated metadata
model.export(format="coreml", int8=True, nms=True, imgsz=[640, 384])
This way, the class labels will be included in the exported model's metadata, and you should be able to access them in your app as expected.
If you continue to experience issues, please ensure you are using the latest version of the Ultralytics package. If the problem persists, providing a minimum reproducible example would be very helpful for us to diagnose the issue further. You can find more information on creating a reproducible example here: Minimum Reproducible Example.
Feel free to reach out if you have any more questions or need further assistance!
@pderrenger Hi,
Have the same problem with yolov8xobb export to coreml.
I try you solution but have error in Visual Studio Code:
AttributeError: can't set attribute 'names'
How to fix that ? plese help
Hi @VladKovalski,
To fix the error, ensure you're setting model.names
directly after loading the model. If the issue persists, please verify you're using the latest version of the Ultralytics package. Let me know if you need further assistance!
Hello, thanks for this project, it's very useful.
I tried to export the models using the following code:
that did work, but when using it on the app, it fails in the following:
I verified the model and it turns out that the exported model does not include anymore the classLabels as the models in the current release. There is some option in
model.export
to include classLabels or maybe it's possible to readnames
from the model's additional metadata?