-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Exporting yolo models does not include Class Labels #43
Comments
@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, How to fix that ? plese help |
Hi @VladKovalski, To fix the error, ensure you're setting |
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?The text was updated successfully, but these errors were encountered: