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

Can we add null images (images without any label) in training and validation set for training any model? #16305

Open
1 task done
Haseeeb21 opened this issue Sep 16, 2024 · 8 comments
Labels
question Further information is requested Stale Stale and schedule for closing soon

Comments

@Haseeeb21
Copy link

Haseeeb21 commented Sep 16, 2024

Search before asking

  • I have searched the Ultralytics YOLO issues and discussions and found no similar questions.

Question

Let say I am training a model on specific single class and to reduce false positives can I add extra images without any labels in it like of background or something that the model will usually see.

@RizwanMunawar
@glenn-jocher
I have a few questions. Please answer them thoroughly. Thanks

  1. Null images can be of anything yes? like if my task is of detecting a single class or multi class but for null image I should add an image in which that class / classes are not present right?
  2. Is it necessary to add labels of the same name as of images (which do not contain any class that we are training on) and if yes should it be empty (nothing in the .txt file)?
  3. Where should we add null images, in train dataset, or valid dataset, or can be added in both?
  4. Can we add null images in every task, such as detection, segmentation, pose, etc..? and same format to follow as question 1?
  5. Does YOLOv8 / v9 / v10 automatically ignores / removes null images from the dataset during training? If yes how can I set to not remove them and train the model including null images?
  6. What does adding null images benefits for the model? performance? accuracy? what other advantages?
  7. Any disadvantage or risk by adding null images? except for time?

Additional

No response

@Haseeeb21 Haseeeb21 added the question Further information is requested label Sep 16, 2024
@UltralyticsAssistant
Copy link
Member

UltralyticsAssistant commented Sep 16, 2024

👋 Hello @Haseeeb21, thank you for reaching out with your questions on Ultralytics 🚀!

It seems you're exploring the nuances of adding null images in your datasets. For new users, we recommend checking out the Docs where you can find many helpful examples and explanations.

If this is a 🐛 Bug Report:

Please ensure you provide a minimum reproducible example to help us understand the issue more clearly.

For your ❓ Question:

Please provide any additional context, such as sample images or configurations, to help us assist you better. It's also helpful to review our Tips for Best Training Results to ensure optimal performance.

For a lively discussion and real-time support, you can join our Discord 🎧. For an in-depth exchange of ideas, the Discourse forum might be more suitable. You are also welcome to share insights and participate on our Subreddit.

Upgrade

To ensure your issue isn't related to a version mismatch, please upgrade to the latest ultralytics package with:

pip install -U ultralytics

Make sure all requirements are satisfied in a Python>=3.8 environment with PyTorch>=1.8.

Environments

YOLOv8 runs smoothly in these verified environments (all dependencies like CUDA/CUDNN, Python, PyTorch are preinstalled):

Status

Ultralytics CI

This badge indicates the current passing status of our CI tests, verifying functionality across supported platforms and tasks.

An Ultralytics engineer will assist you further shortly. Thanks for being part of our community! 🌟

Copy link
Collaborator

Sep 16, 2024

  1. Yes.
  2. Both are correct. You may add an empty label file or you can just not add any label file and it will be considered background.
  3. Up to you. If you have some images that have no objects and yet produce FPs, you can add to validation so that the metrics consider FPs on those images.
  4. Yes.
  5. No
  6. It reduces recall slightly, while improving precision.
  7. It shouldn't be a lot. Follow the guidelines here. It's called "background images" in Ultralytics docs.

@Haseeeb21
Copy link
Author

Haseeeb21 commented Sep 17, 2024

  1. Yes.
  2. Both are correct. You may add an empty label file or you can just not add any label file and it will be considered background.
  3. Up to you. If you have some images that have no objects and yet produce FPs, you can add to validation so that the metrics consider FPs on those images.
  4. Yes.
  5. No
  6. It reduces recall slightly, while improving precision.
  7. It shouldn't be a lot. Follow the guidelines here. It's called "background images" in Ultralytics docs.

Here it says the model skips the null images
#7981 (comment)

  • I need the answers thoroughly.

Copy link
Collaborator

@Haseeeb21 It doesn't. You can check the logs when it starts training. It will display the number of images it detected as "background".

@Haseeeb21
Copy link
Author

@Haseeeb21 It doesn't. You can check the logs when it starts training. It will display the number of images it detected as "background".

According to this it does, but if I add txt files it wouldn't skip.
#7981 (comment)

Copy link
Collaborator

@Haseeeb21 Well, it doesn't. And you can check it for yourself pretty easily by checking the logs like I said.

Copy link
Collaborator

In the above setup, img2.jpg is your background image with no labels, either represented by an absence of img2.txt or by an empty img2.txt file.

#11027 (comment)

Copy link

github-actions bot commented Dec 9, 2024

👋 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 Stale and schedule for closing soon label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale Stale and schedule for closing soon
Projects
None yet
Development

No branches or pull requests

3 participants