I'm trying to train a Neural Network how to detect cardboard boxes along with multiple classes of persons (people).

Although it's easy to detect persons and correctly classifies them, it's incredibly hard to detect cardboard boxes.

The boxes look like this:

enter image description here

My suspicion is that box is too simple of an object, and the neural network has a hard time detecting it because there are too little features to extract from the object.

The division of the dataset looks like this:

personA: 1160
personB: 1651
personC: 2136
person: 1959
box: 2798

Persons are wearing different safety items, based on the items are classified, while detected as whole person, not just the item.

I tried to use:


All of these are detecting and classifying persons much better than boxes. I cannot provide exact mAP (don't have it).

Any ideas?


  • $\begingroup$ Did you try a shallower network? That should work well with less complex features. $\endgroup$ Jun 5, 2019 at 10:00

3 Answers 3


As you said:

My suspicion is that box is too simple of an object, and the neural network has a hard time detecting it because there are too little features to extract from the object.

... and that is exactly the problem with this task. I suggest you to train your Network using a whole lot of image augmentation. If you are using Keras/TensorFlow 2.0, they have built-in functions that do that.

I also suggest you to train a first model, then study accurately the images that your Network thinks are boxes but aren't (the false positives). At that point, you select the "correct" cases, together with the false positive cases, and build a subset of the dataset that you have. That sub-dataset can be useful to train the Network to distinguish between actual boxes and objects that look like boxes.

Once again: use a massive load of image augmentation. That's my main point, and it's what I would do.


I suggest using a pretrained model.

Here is the full code of a pretrained multiclass image classification I did recently: https://datascience.stackexchange.com/a/52772/71442

There are different pretrained models you can try: https://keras.io/applications/

With pretrained models, you can „reuse“ the convolutional layers of large models and train your classes on top. This may help to find the specific features associated with the boxes.

Boxes should be easy to detect because of the distinct and uniform shape and color of them. So I think trying a pretrained model which is trained on similar (box-like) classes can help.

If all the boxes are brown (like in the example image), you may even be able to detect boxes based on the color patterns. NN is able to do that.

Overall it is hard to say what did go wrong without seeing your model. The model architecture can be relevant here.

  • $\begingroup$ i used coco pretrained model, architectures that i used are mentioned in the question $\endgroup$ Jun 1, 2019 at 14:38
  • $\begingroup$ Yes sure, I saw it. But I dont know what exactly is behing coco. Maybe another model will work better. Also model architecture can matter quite a bit (I mean the model itself, I do not see this in your question). Still it is a bit „interesting“ that you cannot train well on such simple objects. $\endgroup$
    – Peter
    Jun 1, 2019 at 14:56

You can try using existing TensorFlow models that have been pre-trained on a large datasets such as MS-COCO, Kitti, and Open Images etc. You can then fine tune a particular model that you wish on your dataset.

A list of all available models to use can be found here.

A good source on how to set up an object detector. (Don't worry if you are Linux user, the same tutorial can be adapted even in Linux systems).

You can use a tool like labellmg to label your images for training.

Hope this helps.

  • 3
    $\begingroup$ i did that, the question is why boxes are harder to detect $\endgroup$ May 29, 2019 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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