title: TensorFlow Object Detection API Weird Behavior
body: <p>I was playing with TensorFlow's brand new <a href="https://github.com/tensorflow/models/tree/master/research/object_detection" rel="noreferrer">Object Detection API</a> and decided to train it on some other publicly available datasets.</p>
  
  <p>I happened to stumble upon <a href="https://github.com/gulvarol/grocerydataset" rel="noreferrer">this</a> grocery dataset which consists of images of various brands of cigarette boxes on the supermarket shelf along with a text file which lists out the bounding boxes of each cigarette box in each image. 10 major brands have been labeled in the dataset and all other brands fall into the 11th "miscellaneous" category.</p>
  
  <p>I followed their <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_pets.md" rel="noreferrer">tutorial</a> and managed to train the model on this dataset. Due to limitations on processing power, I used only a third of the dataset and performed a 70:30 split for training and testing data. I used the faster_rcnn_resnet101 model. All parameters in my config file are the same as the default parameters provided by TF.</p>
  
  <p>After 16491 global steps, I tested the model on some images but I am not too happy with the results -</p>
  
  <p><a href="https://i.stack.imgur.com/vJSm1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vJSm1.png" alt=""></a>
  Failed to detect the Camels in top-shelf whereas it detects the product in other images</p>
  
  <p><a href="https://i.stack.imgur.com/cc6hV.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/cc6hV.jpg" alt=""></a>
  Why does it fail to detect the Marlboros in the top row?</p>
  
  <p><a href="https://i.stack.imgur.com/bsiCP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bsiCP.png" alt=""></a>
  Another issue I had is that the model never detected any other label except for label 1</p>
  
  <p><a href="https://i.stack.imgur.com/AKKsx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AKKsx.png" alt=""></a></p>
  
  <p>Doesn't detected a crop instance of the product from the training data</p>
  
  <p><a href="https://i.stack.imgur.com/oi4Ax.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oi4Ax.png" alt=""></a></p>
  
  <p>It detects cigarette boxes with 99% confidence even in negative images!</p>
  
  <p>Can somebody help me with what is going wrong? What can I do to improve the accuracy? And why does it detect all products to belong in category 1 even though I have mentioned that there are 11 classes in total?</p>
  
  <p><strong>Edit</strong> Added my label map:</p>
  
  <pre><code>item {
    id: 1
    name: '1'
  }
  
  item {
    id: 2
    name: '2'
  }
  
  item {
    id: 3
    name: '3'
  }
  
  item {
    id: 4
    name: '4'
  }
  
  item {
    id: 5
    name: '5'
  }
  
  item {
    id: 6
    name: '6'
  }
  
  item {
    id: 7
    name: '7'
  }
  
  item {
    id: 8
    name: '8'
  }
  
  item {
    id: 9
    name: '9'
  }
  
  item {
    id: 10
    name: '10'
  }
  
  item {
    id: 11
    name: '11'
  }
  </code></pre>