ultralytics/yolov5

how to reduce false postives in yolov5

yAlqubati opened this issue ยท 2 comments

Search before asking

Question

Hello everyone,

I'm currently training YOLOv5s to detect three objects: phone, cigarette, and vape. My original dataset contained 9,000 images, with 3,000 images for each class. After training the model for 100 epochs, I've noticed a high number of false positives.

To address this, I've added 3,000 negative images (images that don't contain any of the target objects) to the dataset. I've also experimented with adjusting the conf_thres and iou_thres settings a bit. I plan to train the model for more epochs in the future.

Are there any additional strategies or techniques you recommend to further reduce the number of false positives? Any insights would be greatly appreciated!

thanks in advance.

Additional

training info
pochs 100, --img-size 640, --batch-size 16, --optimizer SGD --cache ram --hyp /content/yolov5/data/hyps/hyp.scratch-low.yaml

the content of hyp.scratch-low.yaml file is set to default

๐Ÿ‘‹ Hello @yAlqubati, thank you for your interest in YOLOv5 ๐Ÿš€! It's great to hear you're working on training a model for detecting phones, cigarettes, and vapes. Reducing false positives can indeed be challenging, and it seems like you're already taking some good steps.

To further improve your results, consider these strategies:

  • Data Augmentation: Augment your training data with transformations like rotation, scaling, and flipping to help your model generalize better.
  • Advanced Hyperparameter Tuning: Experiment with different learning rates, momentum values, and other hyperparameters. You might want to check out techniques like learning rate scheduling or adaptive optimizers.
  • Increase Training Epochs: Since you've mentioned planning to train for more epochs, be sure to monitor for overfitting as well as improvements.
  • Anchor Box Adjustment: Ensure that your anchor boxes are appropriate for the object sizes in your dataset. You might use k-means clustering to find optimal anchor box settings.
  • Class Balance: Ensure that your dataset is balanced. It seems you have balanced classes, but verifying this won't hurt.

If this is a ๐Ÿ› Bug Report, please provide a minimum reproducible example to help us debug it.

An Ultralytics engineer will also assist you soon, and their insights could provide additional valuable guidance! ๐Ÿ˜Š

@yAlqubati to further reduce false positives, ensure your dataset is well-labeled and diverse, and consider using data augmentation techniques like Mosaic or Copy-Paste. Additionally, you might want to experiment with different models like YOLOv5m or YOLOv5l for potentially better performance.