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

Train and predict multiple classes detecting for single object YOLO8 #704

Closed
1 task done
SutirthaChakraborty opened this issue May 29, 2024 · 3 comments
Closed
1 task done
Labels
question A HUB question that does not involve a bug Stale

Comments

@SutirthaChakraborty
Copy link

Search before asking

Question

How can we train a model to detect multiple class of a single object.
For example :
an image of bee, it should be able to detect bee and 'insect'
an image of rat, it should be able to detect 'rat' and 'rodent'

Additional

Right now, it's detecting either of any labels and then toggling between two classes.

@SutirthaChakraborty SutirthaChakraborty added the question A HUB question that does not involve a bug label May 29, 2024
@SutirthaChakraborty SutirthaChakraborty changed the title Train and predict multiple classes detecting for single object Train and predict multiple classes detecting for single object YOLO8 May 29, 2024
Copy link

👋 Hello @SutirthaChakraborty, thank you for raising an issue about Ultralytics HUB 🚀! Please visit our HUB Docs to learn more:

  • Quickstart. Start training and deploying YOLO models with HUB in seconds.
  • Datasets: Preparing and Uploading. Learn how to prepare and upload your datasets to HUB in YOLO format.
  • Projects: Creating and Managing. Group your models into projects for improved organization.
  • Models: Training and Exporting. Train YOLOv5 and YOLOv8 models on your custom datasets and export them to various formats for deployment.
  • Integrations. Explore different integration options for your trained models, such as TensorFlow, ONNX, OpenVINO, CoreML, and PaddlePaddle.
  • Ultralytics HUB App. Learn about the Ultralytics App for iOS and Android, which allows you to run models directly on your mobile device.
    • iOS. Learn about YOLO CoreML models accelerated on Apple's Neural Engine on iPhones and iPads.
    • Android. Explore TFLite acceleration on mobile devices.
  • Inference API. Understand how to use the Inference API for running your trained models in the cloud to generate predictions.

If this is a 🐛 Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.

If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.

We try to respond to all issues as promptly as possible. Thank you for your patience!

@pderrenger
Copy link
Member

Hello!

Thank you for reaching out with your question. To train a model on YOLO8 that can detect multiple classes for a single object, you'll need to adjust your dataset annotations to reflect these hierarchical class relationships. Each image should have annotations for both the specific class (e.g., 'bee') and its broader category (e.g., 'insect').

Here’s a brief guide on how to proceed:

  1. Annotation Format: Ensure your annotation files list multiple classes for the objects that belong to more than one class. For example, an image with a bee might have annotations for both 'bee' and 'insect'.

  2. Modify Dataset Loading: When loading your dataset in the training script, make sure the loader is configured to handle multiple labels per object.

  3. Model Configuration: In your model configuration file, define all the classes (specific and general) that you want the model to learn.

  4. Training: Train your model with these annotations. The model should learn to recognize objects in both their specific and general classes.

  5. Evaluation: During inference, the model should predict multiple classes for a single object as per the training.

If toggling between two classes still occurs, it might be helpful to look into the confidence thresholds and non-maximum suppression settings to ensure that the model can confidently predict multiple classes for the same object.

Let me know if you need further assistance or specific guidance on any of the steps!

Copy link

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐

@github-actions github-actions bot added the Stale label Jun 29, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A HUB question that does not involve a bug Stale
Projects
None yet
Development

No branches or pull requests

2 participants