Clear Filters
Clear Filters

Object Detection with Blank labels

10 views (last 30 days)
Hi,
I am training a YOLO object detector to detect people in an image. When I test the model on unseen data, there are certain false detections that keep on coming up. I want to include images in my training set that have no people in (ie: the labelled bounding box will be blank) so that the model can learn what a person is not.
However, an error is thrown when there are blank labels.
As a work around, I have taken the types of images that typically produce false detectens and I have synthetically pasted a person in the image. The idea is that the model will now see that the label is not where it typically detects it. However, this is time consuming.
Is there a way around this or any suggestions?

Accepted Answer

Ayush Anand
Ayush Anand on 10 Jan 2024
Edited: Ayush Anand on 10 Jan 2024
Hi Doron,
Some object detection frameworks might not handle empty labels or annotations smoothly. Here are some alternatives to synthetically pasting a person in the images and training the model which could be more effective:
  1. Modify the Labeling: You can modify the data preprocessing or labeling script to include a "background" or "negative" class. Instead of leaving the label blank, you can label the whole image as background, which would explicitly teach the model what is not a person.
  2. Augment the Data: Instead of manually pasting a person into the images, you could use data augmentation techniques to programmatically add people to those images.
  3. Custom Loss Modification: You can modify the loss function to ignore the contribution of images without any bounding boxes to the localization loss. This way, the model can still learn from the negative samples for the classification part without being penalized for the absence of bounding boxes.
You can refer to the following links for more information:
  1. https://www.mathworks.com/help/deeplearning/ug/image-augmentation-using-image-processing-toolbox.html (Workflow on image augmentation using image processing toolbox)
  2. https://www.mathworks.com/help/vision/ug/object-detection-using-yolo-v3-deep-learning.html (Example on how to train a YOLO model for object detection. This example also demonstrates several data augmentation techniques)
I hope this helps!

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!