I have a dataset of object detection (bounding box + class) with 2 classes (excluding "background" class).

I am worried about two things :

First, my dataset counts only 196 samples (I am not too worried about that since I can do some rotations. Still are there some recommanded practices to do some data augmentation in a context of object detection ?)

Secondly, "class1" appears around 350 times over my dataset but "class2" appears only 10 times... So I am worried that my network becomes really dependant on "class1".

So my question os :

What are the best practices to balance my dataset (since on every one of my images where "class2" is there is at least one "class1" object).


This is an old question but since this topic is on going I will give it a try.

You are not very verbose about what type of object do you detect which make great difference in suggesting data augmentation.

Some examples to make it clear. If you are detecting objects like books for example they are expected to appear in all possible orientations but if you are detecting human being the upside down is not so popular (it could happen but I guess you shouldn't augment your data using vertical flip).

The API lacks some features at the moment that might make sense in some cases like, arbitrary rotation for example.

As for your dataset size it also depends on the "difficulty" of the task. If you are trying to detect two different brand of cars for example (I guess you are not but I am giving an extreme example) then your model will fail. In the best of cases you will be able to detect cars in the 1st class (with the 350 samples) but will fail to do the same for the second class. Anyway 10 samples seems too few to do anything. At least any decent problem that is.

If you had a decent amount of data for you second class also but your dataset was also unbalanced. For example if the proportion between the samples was kept the same but the number of both classes was 20x bigger I would say that maybe you could get away with this unbalance.

So, my advices would be:

  1. To surely collect more data from the second class.
  2. Check which data augmentation techniques make more sense for you data.
  3. Consider adding more diverse than just plenty samples. If your lesser class contains a representative amount of different samples appearing in this class you should be OK.

your question addresses a common problem in computer vision. In the first place, having so few data points would never work good enough in deep learning. You are going to overfit even if you use transfer learning. Secondly, data augmentation is a good way to balance your dataset. But consider that those examples might not represent the real distribution so it is unlikely you generalize.

In the case you decide to apply data augmentation think about the augmentations that would be real such as rotations or flips. Here I reference a library that would help you achieve that https://github.com/lozuwa/impy


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.