Computer Vision Engineer Interview Question

How does non-maximum suppression work, and how would you implement it?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Sort detections by confidence, keep the highest, remove every remaining box of the same class whose IoU with it exceeds a threshold, and repeat until none remain. The worst case is quadratic, so vectorise the IoU computation against all remaining boxes at each step. It fails in crowded scenes, where genuinely overlapping objects get suppressed, and soft suppression, which decays scores instead of deleting boxes, or detectors that predict sets directly can help.

Why interviewers ask this

This is one of the most common live coding questions for vision roles, because it combines geometry, algorithmic thinking and practical knowledge. Interviewers want a correct algorithm with the per class detail, a clean IoU function, awareness of complexity and vectorisation, and an understanding of when it breaks. Explaining the crowded scene failure and its alternatives shows you have debugged real detections, not just called a library function.

How to structure your answer

  • Describe the greedy algorithm step by step.
  • Write a clean, vectorised IoU computation.
  • State the complexity and the per class handling.
  • Explain where it fails and the alternatives.

Example answer

Spoken example, first person

It is a greedy algorithm. I sort the boxes by score, keep the top one, compute its IoU with every remaining box, and drop the ones above the threshold, often around 0.5. Then I repeat with the next highest remaining box until the list is empty. In code, I would write IoU as a vectorised function that takes one box and an array of boxes: compute the intersection corners with element-wise maximum and minimum, clamp width and height at zero so non-overlapping boxes give zero, then divide by the union. Each iteration is one vectorised call, and the worst case is quadratic in the number of boxes, which is fine for a few hundred detections. I run it per class, or offset the boxes by class so a single pass handles everything. The weakness is crowded scenes. In a dense crowd, two people genuinely overlap, and plain suppression deletes one of them. Soft suppression, which lowers the scores of overlapping boxes rather than removing them, helped on a pedestrian dataset I worked on, and set prediction detectors avoid the step entirely.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • How would you choose the IoU threshold?
  • How would you make it faster for thousands of boxes?
  • Why do set prediction detectors not need this step?

Related computer vision engineer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot