-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Training with negative and positive data samples #1686
Comments
👋 Hello @JaninaMattes, thank you for your interest in 🚀 YOLOv3! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv3 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv3 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv3 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@JaninaMattes the default training already incorporates all negative and positive samples in all images. To get started see https://docs.ultralytics.com/yolov5/tutorials/train_custom_data |
Hi @glenn-jocher thank you very much. I had overlooked the update of the instructions. However, one question that still occurs to me. When I output my batches, it looks like I have no negative samples in either a training nor a test batch. My negative and positive samples are stored in my training.txt file as paths to the images, the negative samples do not get a .txt annotation. When I load the data sets, I can see that data sets are loaded without annotation (empty tensors). However, I do not get any negative samples in my training batch. Could this be due to the sampler? I had previously used a RandomWeightedSampler, but now I use the InfiniteSampler. Do you have any idea how I could solve this problem? Thank you very much! |
@JaninaMattes I don't understand what you're asking. A 'negative sample' is a gridpoint in an image that is not assigned to a particular label/target. Every image has negative samples. |
@glenn-jocher due to the type of my dataset I would like to train my network with 'positive samples', meaning images that contain objects and 'negative samples', images without objects. |
@JaninaMattes you're describing every dataset basically. COCO has images with labels and images without labels. You don't have any special requirements, simply train following the normal steps in the Train Custom Data tutorial: Tutorials |
For each image, labelled region in the image is treated as positive sample. unlabelled region in the image is treated as negative sample. if there is no labelled region in the image which is input to the network for training, all region in the image is treated as negative sample. That is to say, the region in image is either treated as positive or negative. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
How can I calculate the loss if I train negative and positive samples?
My negative samples don't come with a label and thus are empty tensor values in my batches. This on the other hand is problematic as anchor boxes, image indices and target classes etc. are required in the current calculation of the loss value for the targets. I read that you have tried training with negative and positive samples. Could you provide some hints on how you solved this? Many thanks in advance!
The text was updated successfully, but these errors were encountered: