# If two objects are too close to each other, would an object detector do a poor job of correctly classifying them?

Suppose we have an object detector that is trained to detect $$20$$ products. If two objects are too close to each other, in general, would an object detector do a poor job of correctly classifying them? If they were far apart in the scene, would the object detector to a better job of correctly classifying them?

As you ask, "in general...", I will answer generally, however this changes a lot from model to model and the way they handle close objects.

In general, yes, they would do a poor job detecting very close objects, switch to segmentation models for that (for class or better, instance segmentation).

In general, objects detectors learn to tell an object from other based in 2 criterion:

• Intersection over union: for object of the same class
• Class probability: for objects of different class

So, if two objects of the same class are very close, the 2 detected bounding boxes will be highly overlapping, then, the Non Maximal Suppression filter will remove one of them. This is where objects detector, in general, perform worse.

Similarly, if two objects belong to different classes the 2 detected bounding boxes will be highly overlapping but the NMS filter won't remove them (again, in general, NMS is set only for same class objects). However when 2 objects are very close, there is a high chance they are partially occluded. Objects detectors, in general, don't handle occlusions very well.

So, in conclusion, objects detectors will perform better detecting far-away objects.