Yolov3: Training with empty labels produces error

Created on 14 Nov 2019  路  7Comments  路  Source: ultralytics/yolov3

Hi @glenn-jocher I realised that the code throws error when there is no object in the image implying no labels for it in my dataset. Is there a way to incorporate that into the code so that it can skip over the images where there is no label for it?
Could you please direct which part in the model should be modified to get the desired result? Thanks a lot for your help!

bug

All 7 comments

@Pari-singh the model should train fine with unlabelled images, we already do this for our clients.

For some reason, it was throwing error for my data and I had to create a pipeline to remove those labels conpletely from data file. I was getting dimensionality error in load_mosaic call function and it was only for the images which had txt file empty, others worked fine.

@Pari-singh ah I see. I thought you meant that images with no label files were causing errors. We only include a label file when the image has labels. So you have an empty label file that was causing errors? This is a use case we have not tested. I recently implemented a fix for load_mosaic caused by np.concatenate, is this the same error you were seeing? You can access the fix simply by running git pull in your yolov3 dir.

Hi @glenn-jocher ,

I have a related question. I understand that if my training image doesn't have an existing associated label file, then the code won't throw an error.
I am trying to understand what that effectively means (in all scenarios - training (mosaic) and not training). Let's say I have 50 images in my training set and 10 do not have associated label files.

  1. Does that mean YOLO doesn't consume those 10 images in training at all hence there is no loss contribution from these images? In that case, it's helpful to filter out the training set text file so that I know that my effective training set size is 40.
  2. The model actually benefits from images which don't have labels. Maybe those are background examples?

Which of these two is happening?

@anisaha1 all images are used. Labels are loaded if they are found.

@glenn-jocher Thanks for the reply.
I have a related question which you were discussing with @Pari-singh.
What about images with an empty label file? You said you have incorporated a fix. I just wanted to double-check.
I am training a 1-cls detector on custom data. In that case, should I assume that in both training and validation phases no associated label file for an image is equivalent to an empty label file?

@anisaha1 either way should be fine for background images!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kaaier picture kaaier  路  3Comments

Sibozhu picture Sibozhu  路  4Comments

mehrdadazizi72 picture mehrdadazizi72  路  3Comments

Aria20155 picture Aria20155  路  3Comments

yoga-0125 picture yoga-0125  路  4Comments