Search code examples
pythonmachine-learningtensorflowcomputer-visionobject-detection

TensorFlow Object Detection API poor results


I have trained TensorFlow Object Detection API on my own PascalVOC dataset with 7 classes. In each class there are from 100 to 200 images. I was using ssd_mobilenet_v1_pets.config standard configurations, except number of classes and number of steps options.

Before training I did resizing job with images so every image in my set is from 600 up to 1024px. Annotations has been done with LabelImg App.

After train job with 100k steps has been done I tried my model using code from jupyter notebook tutorial on several test images. Unfortunately results were kind of weird.

If test image contains only one object, it works fine:

enter image description here

But if there are a lot of objects on image result is being weird or not even shows up:

enter image description here

You can see it detects almost the whole image for some reasons. So what can you to reach detection of multiple objects on image like on the above one.

Will be very grateful for any help. Thanks in advance!

Here is my label map for any case:

item {
  id: 1
  name: 'chesterfield_blue'
}

item {
  id: 2
  name: 'chesterfield_red'
}

item {
  id: 3
  name: 'lucky_strike_blue'
}

item {
  id: 4
  name: 'lucky_strike_red'
}

item {
  id: 5
  name: 'marlboro_gold'
}

item {
  id: 6
  name: 'marlboro_mentol'
}

item {
  id: 7
  name: 'marlboro_red'
}

Solution

  • Faster RCNN model and it`s configuration helped me to improve results.

    Also I added a couple of images where cigarette boxes are on store stands, so conditions are quite similar to that images I`m trying to process.

    Improved results (note I didn`t add all cigarette instances to the model):

    enter image description here