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

How to find the class labels of the detected objects (img.prediction.labels) only returns the numeric value #930

Closed
maninka123 opened this issue May 5, 2023 · 3 comments
Assignees
Labels
❔ Question Further information is requested

Comments

@maninka123
Copy link

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@dagshub
Copy link

dagshub bot commented May 5, 2023

@Louis-Dupont Louis-Dupont self-assigned this May 5, 2023
@Louis-Dupont
Copy link
Contributor

Each image prediction also includes an attribute class_names with all the classes names that the model tries to predict, here is an example:

images_predictions = model.predict(IMAGES)

for image_prediction in images_predictions:
    class_names = image_prediction.class_names  # List of class names the model tries to predict for in the image
    labels = image_prediction.prediction.labels
    confidence = image_prediction.prediction.confidence
    bboxes = image_prediction.prediction.bboxes_xyxy
    for i, (label, conf, bbox) in enumerate(zip(labels, confidence, bboxes)):
        print("prediction: ", i)
        print("label_id: ", label)
        print("label_name: ", class_names[int(label)])
        print("confidence: ", conf)
        print("bbox: ", bbox)
        print("--" * 10)

@Louis-Dupont
Copy link
Contributor

@maninka123 we just released a new documentation on model.predict() was added, check it out for more information, and feel free to let us know if anything is unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔ Question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants