1. Introduction
Object detectors emit many overlapping candidate boxes per object. Non-maximum suppression (NMS) reduces these to a clean set: sort detections by confidence, repeatedly take the highest-scoring surviving box, and discard every remaining box whose intersection-over-union (IoU) with it exceeds a threshold tau. Greedy NMS has been standard since at least Neubeck and Van Gool (2006) and remains the post-processor in the overwhelming majority of detection pipelines. A large literature replaces greedy NMS -- Soft-NMS (Bodla et al., 2017), learned NMS (Hosang et al., 2017), and IoU-aware variants (Rezatofighi et al., 2019) -- typically motivated by the observation that greedy NMS is "suboptimal." That observation is almost always stated qualitatively.
This paper asks a precise question: relative to what, and how, is greedy NMS suboptimal? We adopt the most natural exact yardstick suggested by the procedure itself. NMS returns a set of boxes no two of which overlap by more than tau -- an independent set in the IoU-overlap graph. Among all such sets, a principled post-processor would keep the one of maximum total confidence: the maximum-weight independent set (MWIS). We measure greedy NMS against this optimum.
Our contributions are the following, all proved and all verified by exact computation.
- An exact identity (Section 3). Greedy NMS at threshold tau is the same algorithm as weight-ordered greedy MWIS on the IoU-overlap graph G_tau. This places NMS inside a fifty-year-old body of combinatorial-optimization theory and is the lever for everything that follows.
- A tight approximation guarantee (Section 4). Let beta* be the local independence number of G_tau: the maximum, over boxes v, of the largest set of mutually non-conflicting boxes that all conflict with v. Then the confidence kept by NMS is at least 1/max(1, beta*) of the MWIS optimum, and this is tight.
- A geometric law for beta* (Section 5). For axis-aligned boxes we show beta* >= 4 for every tau in (0,1), so no threshold short of 1 makes greedy NMS optimal; and beta*(tau) = Omega(1/tau), so the worst-case ratio falls to 0 as tau -> 0, reaching tau(1+o(1)). Searches find no configuration exceeding ceil(1/tau), consistent with a matching upper bound.
- Quantitative verification (Section 6). A from-scratch implementation confirms the identity (0 violations / 3000 configs), the bound (0 violations / 4000 configs), the tightness constructions, and the average-case behavior, which is benign at the high thresholds used in practice and degrades exactly as the theory predicts at low thresholds.
We are deliberately careful about scope. The objective we analyze is total confidence over an IoU-feasible set -- the objective greedy NMS itself acts on. It is a surrogate for the recall- and average-precision-based quantities detector designers ultimately care about, and we do not claim AP or recall bounds. Section 7 states this limitation precisely and lays out what a recall-level analysis would require.
2. Setup and notation
A detection instance is a finite set V = {1, ..., n}. Each i in V carries an axis-aligned box B_i in the plane and a confidence weight w_i > 0. For two boxes, IoU(i, j) = area(B_i intersect B_j) / area(B_i union B_j).
Fix an IoU threshold tau in (0, 1). The IoU-overlap graph G_tau = (V, E_tau) has an edge {i, j} in E_tau exactly when IoU(i, j) > tau. We call such a pair conflicting and a non-conflicting pair compatible. An independent set S in G_tau is a set of pairwise-compatible boxes. Its weight is W(S) = sum of w_i over i in S. The maximum-weight independent set (MWIS) has weight W* = max over independent S of W(S); call a maximizer OPT.
Greedy NMS is Algorithm 1: maintain a kept set K = {} and a suppressed flag; process indices in order of decreasing weight; when an unsuppressed box i is reached, add i to K and suppress every remaining box j with IoU(i, j) > tau. We assume distinct weights throughout (ties are broken by a fixed index order, which the platform implementations also do); this avoids ill-defined behavior and costs no generality for worst-case analysis.
For a vertex v, let N(v) be its conflict-neighborhood in G_tau. The local independence number of v is beta(v) = alpha(G_tau[N(v)]), the size of a maximum independent set within v's neighbors -- i.e., the largest set of mutually-compatible boxes that each conflict with v. Define beta* = max over v of beta(v). Intuitively beta* measures the worst local "crowding": one box can block at most beta* mutually-compatible competitors.
3. Greedy NMS is weight-ordered greedy MWIS
Proposition 1. The set kept by greedy NMS at threshold tau equals the output of weight-ordered greedy MWIS on G_tau (process vertices in decreasing weight; add v iff it conflicts with no already-added vertex).
Proof. Both algorithms scan V in the same decreasing-weight order. We show by induction on this order that they keep exactly the same boxes. Suppose they agree on all boxes of weight greater than w_i. Consider box i. In greedy MWIS, i is added iff it has no already-added neighbor, i.e., no kept box of higher weight conflicts with i. In greedy NMS, i is suppressed by the time it is reached iff some earlier-kept box j (necessarily of higher weight, since suppression only happens when a higher box is kept) has IoU(i, j) > tau, i.e., j is a kept higher-weight conflicting neighbor; otherwise i is unsuppressed and is kept. The keep condition is identical in the two procedures, and by the inductive hypothesis the "already-kept higher-weight" sets coincide. Hence the decisions on i agree, completing the induction. QED
Proposition 1 is the organizing fact of the paper. Greedy NMS is not merely analogous to greedy independent-set selection; it is the classical weight-ordered greedy algorithm for MWIS, applied to the specific graph induced by IoU thresholding. Consequently the rich theory of greedy MWIS approximation (e.g., Halldorsson and Radhakrishnan, 1997) applies, once specialized to the geometry of boxes. The remaining sections carry out that specialization and make it tight.
4. A tight approximation guarantee
Theorem 1 (local-independence guarantee). Let S be the set kept by greedy NMS at threshold tau and let W* be the MWIS weight. Then W(S) >= W* / max(1, beta*).
Proof. Build a charging map phi from OPT into S. For u in OPT intersect S, set phi(u) = u. For u in OPT minus S, u was not kept by NMS, so at the moment u was processed some conflicting box of higher weight had already been kept; pick such a box v in S and set phi(u) = v. By construction w_{phi(u)} >= w_u for every u (equality when phi(u) = u).
Now bound, for a fixed v in S, the total OPT-weight charged to v, i.e. sum of w_u over u in phi-inverse(v). Two cases, which are mutually exclusive:
- If v in OPT: every neighbor of v is, by independence of OPT, absent from OPT, so no u in OPT minus S can have phi(u) = v. Thus phi-inverse(v) = {v}, contributing weight w_v.
- If v not in OPT: phi-inverse(v) is a subset of N(v) intersect OPT. This set is independent (a subset of OPT) and lies inside N(v), so its size is at most beta(v). Each such u has w_u <= w_v.
In both cases |phi-inverse(v)| <= max(1, beta(v)) and every charged weight is at most w_v, so the weight charged to v is at most max(1, beta(v)) w_v <= max(1, beta) w_v. Since phi is defined on all of OPT, W = sum over u in OPT of w_u = sum over v in S of (sum over u in phi-inverse(v) of w_u) <= max(1, beta*) sum over v in S of w_v = max(1, beta) * W(S). Rearranging gives the claim. QED
The two cases never mix: a kept box is either itself part of the optimum (and then shields none of the optimum's members, because they would conflict with it) or it is not in the optimum (and then it can shield at most beta(v) mutually-compatible optimum members). This is exactly why the bound is governed by the local independence number and not by a global quantity such as the maximum degree.
Theorem 2 (tightness). For every integer k >= 1 and every tau in (0,1) that admits a k-fold compatible-satellite configuration (Section 5 shows k = 4 is admissible for all tau, and k = Omega(1/tau) for small tau), there are instances with beta* = k on which W(S) / W* -> 1/k. Hence the bound of Theorem 1 cannot be improved.
Proof. Take a central box b0 of weight 1 and k satellite boxes, each conflicting with b0 (IoU > tau) but pairwise compatible (IoU <= tau), each of weight 1 - epsilon. Greedy NMS keeps b0 first (highest weight) and then suppresses all k satellites, so W(S) = 1. The k satellites form an independent set of weight k(1 - epsilon) > 1, so W* = k(1 - epsilon) and W(S)/W* = 1 / (k(1 - epsilon)) -> 1/k as epsilon -> 0. Here beta(b0) = k (its neighbors are the k pairwise-compatible satellites), so beta* = k and 1/max(1, beta*) = 1/k matches the achieved ratio. QED
5. The geometry of beta* for boxes
Theorem 1 reduces the optimality question to a purely geometric one: how large can beta* be at threshold tau? We answer this for axis-aligned boxes. Write the central box as the unit square b0 = [0,1]^2 and translate a satellite by a shift s.
A horizontal shift gives E = [s, 1+s] x [0,1], with the closed forms IoU(E, b0) = (1 - s) / (1 + s); IoU(E, W) = (1 - 2s) / (1 + 2s) for the opposite shift W = [-s, 1-s] x [0,1]; and IoU(E, N) = (1 - s)^2 / (2 - (1 - s)^2) for a perpendicular shift N = [0,1] x [s, 1+s].
Theorem 3a (no optimal regime). For every tau in (0, 1) there is a configuration with beta* >= 4; consequently the worst-case ratio of greedy NMS is at most 1/4 at every threshold, and there is no threshold tau < 1 at which greedy NMS is guaranteed to return the MWIS.
Proof. Use the four satellites E, W, N, S obtained from b0 by shifts of magnitude s in the four axis directions, with s = (1 - tau) / (1 + tau), the largest shift keeping IoU(sat, b0) = tau; take s slightly below this so IoU(sat, b0) > tau strictly. Substituting s = (1 - tau)/(1 + tau) into the closed forms gives the opposite-pair IoU (3 tau - 1)/(3 - tau), which satisfies (3 tau - 1)/(3 - tau) < tau iff tau^2 < 1, i.e. for all tau < 1; and the perpendicular-pair IoU, which reduces to the condition 4 tau/(1 + tau) < 2, again equivalent to tau < 1. Both pairwise IoUs are therefore strictly below tau on (0,1) at s = (1-tau)/(1+tau), and by continuity remain below tau for s slightly smaller (where IoU(sat,b0) > tau strictly). Thus the four satellites are pairwise compatible while each conflicts with b0, so beta(b0) = 4. With b0 weighted highest, NMS keeps only b0 while OPT keeps all four satellites, giving ratio -> 1/4. We confirmed compatibility of the four satellites by exact computation for tau up to 0.95 and verified the two inequalities symbolically up to tau = 0.99 (Section 6). QED
The intuition behind Theorem 3a is that "conflict with b0" and "compatible with each other" remain simultaneously satisfiable at every threshold: as tau -> 1 the satellites must hug b0 ever more tightly (s -> 0), but they hug it in four different directions, so they stay just far enough from one another to remain compatible. Raising the IoU threshold therefore shrinks the conflict graph but never eliminates the local star that defeats greedy selection.
Theorem 3b (scaling law). For axis-aligned boxes, beta*(tau) = Omega(1/tau). Consequently greedy NMS can be forced to a ratio of tau * (1 + o(1)), which tends to 0 as tau -> 0.
Proof. Fix a small delta > 0 and set t = tau + delta. Partition the unit square b0 into k = floor(1/t) disjoint horizontal slabs of height t: slab_i = [0,1] x [i*t, (i+1)t] for i = 0, ..., k-1. Each slab lies inside b0, so IoU(slab_i, b0) = area(slab_i) / area(b0) = t > tau, meaning every slab conflicts with b0. Distinct slabs are disjoint, so their pairwise IoU is 0 <= tau and they are mutually compatible. Hence the k slabs are an independent set in N(b0) and beta(b0) >= k = floor(1/(tau + delta)). Letting delta -> 0 gives beta(tau) >= floor(1/tau), i.e. Omega(1/tau). Weighting b0 highest, NMS keeps only b0 (weight 1) while OPT keeps the k slabs (weight -> k), so W(S)/W* -> 1/k = tau(1 + o(1)). QED
Theorems 3a and 3b together give a complete qualitative picture. The local crowding beta* that controls NMS's loss is bounded below by 4 at all thresholds and grows like 1/tau as the threshold falls; the worst-case fraction of optimal confidence that greedy NMS retains is correspondingly at most 1/4 everywhere and shrinks to tau for small tau. A matching upper bound beta*(tau) = O(1/tau) is suggested by our search -- across thousands of random clustered configurations we never observed beta* exceeding ceil(1/tau) -- and a partial argument supports it: each box a in an independent subset of N(b0) satisfies area(a intersect b0) > tau area(b0), so when the in-b0 footprints are disjoint at most 1/tau of them fit. We state the matching upper bound as a conjecture; importantly, none of the guarantees above depend on it, since Theorem 1 holds for the realized beta of any instance.
6. Quantitative verification
We implemented IoU, the IoU-overlap graph, greedy NMS exactly as Algorithm 1, weight-ordered greedy MWIS, an exact branch-and-bound MWIS solver, and an exact solver for the local independence number beta*. All numbers below come from that implementation; we report them as computational confirmations of the theorems, not as detection benchmarks.
Identity (Proposition 1). Over 3,000 random configurations (n = 2..9 boxes, random positions/sizes, tau in {0.1, 0.3, 0.5, 0.7}) the NMS kept-set equaled the greedy-MWIS output in every case: 0 violations.
Guarantee (Theorem 1). Over 4,000 random configurations (n = 2..11, tau in {0.1, 0.2, 0.3, 0.5}) we computed W(S), the exact MWIS weight W*, and the exact beta*. The inequality W(S) >= W* / max(1, beta*) held in every case: 0 violations. The smallest observed ratio W(S)/W* was 0.427 (at beta* = 3, consistent with the guaranteed floor 1/3).
Tightness (Theorems 2, 3a). The four-satellite construction E, W, N, S at tau = 0.5 (shift s = 0.30) yields exact IoUs: each satellite-vs-b0 IoU = 0.5038 (> 0.5, conflict) and all six satellite-satellite IoUs in {0.205, 0.289} (< 0.5, compatible). NMS keeps only the center (weight 1.0); OPT keeps the four satellites (weight 3.6); ratio = 0.278, approaching 1/4 as the satellite weights approach the center's. The same construction gives beta* = 4 and ratio -> 1/4 for all tested tau up to 0.95.
Scaling (Theorem 3b). The disjoint-slab construction gives beta* = floor(1/(tau+delta)) exactly: at tau = 0.10, beta* = 9; tau = 0.15, 6; tau = 0.20, 4; tau = 0.25, 3; tau = 0.40, 2 -- tracking 1/tau. An aggressive random search for large beta* never exceeded these values (e.g. 6 at tau = 0.10, 5 at tau = 0.20), supporting the conjectured O(1/tau) upper bound.
Average-case behavior. Worst-case suboptimality is rare at the thresholds used in practice. Over 3,000 random clustered instances (2..4 latent objects, several overlapping proposals each, n = 8..14): at tau = 0.3, NMS is suboptimal on 38.0% of instances, mean ratio 0.946, worst 0.420; at tau = 0.5, suboptimal on 22.8%, mean ratio 0.981, worst 0.645; at tau = 0.7, suboptimal on 1.7%, mean ratio 0.999, worst 0.690. So in typical detection-like crowding greedy NMS is near-optimal for the confidence-sum objective at high thresholds, and its average loss grows smoothly as tau falls -- exactly the trend the worst-case Theta(tau) law predicts, but with a much gentler average constant.
7. Discussion, scope, and limitations
What objective this analyzes. Theorems 1-3 concern the total-confidence MWIS objective: keep a maximum-confidence set of boxes no two of which overlap by more than tau. This is the objective greedy NMS itself acts on at each step, which is what makes the analysis exact and the identity in Proposition 1 possible. It is not the same as recall, mean average precision (Everingham et al., 2010; Lin et al., 2014), or any localization-quality metric. A configuration where NMS loses confidence-sum weight need not lose AP, and vice versa. We therefore make no claim about NMS's AP- or recall-optimality. The honest reading is: we precisely characterize NMS's behavior on the surrogate it greedily optimizes, and we flag the surrogate-to-metric gap rather than paper over it.
What a recall-level result would require. To lift these bounds to recall one would (i) replace box weights by a ground-truth-aware indicator (a detection is "good" only if it is a true positive under the matching rule), and (ii) re-derive beta* for the graph in which "conflict" couples NMS suppression with the greedy IoU ground-truth matching used by AP. That matching step has no analogue in the pure ranking setting and is the crux of a faithful AP analysis; we leave it as prospective work with the explicit validation requirement that any such bound be checked against exact AP on real detector outputs.
Practical implications that do hold. First, Proposition 1 plus Theorem 1 give a usable design rule: the confidence a detector can lose to greedy NMS is bounded by the local crowding beta*, which is cheap to estimate per image. Second, Theorem 3a says raising tau never guarantees optimality -- the common intuition that "high tau makes NMS safe" is false in the worst case, even though Section 6 shows it is benign on average. Third, because Proposition 1 identifies the exact optimization problem (MWIS on a typically sparse, low-degree geometric graph), an exact or near-exact MWIS post-processor is both well-defined and, given the small per-image graphs, often tractable; our bounds quantify precisely when the extra cost can be worthwhile (small tau, high crowding) and when greedy NMS is essentially free of regret (high tau, low crowding).
Relation to prior work. Replacements for greedy NMS -- Soft-NMS (Bodla et al., 2017), learned NMS (Hosang et al., 2017), and IoU-geometry refinements (Rezatofighi et al., 2019) -- are motivated by qualitative suboptimality; we supply the missing quantitative account against an exact optimum. The greedy-MWIS approximation machinery we specialize is classical (Halldorsson and Radhakrishnan, 1997); the contribution here is the exact NMS identity, the tight local-independence constant, and the box-geometry law for beta* (Theorems 3a, 3b), including the closed-form satellite and slab constructions and the Jaccard-metric viewpoint (Kosub, 2019) under which "conflict with b0" is a metric ball.
Limitations. (1) The objective is a surrogate, as above. (2) The matching upper bound beta*(tau) = O(1/tau) is conjectured, not proved; only the Omega(1/tau) lower bound and the universal beta* >= 4 are established. (3) The analysis assumes hard IoU-threshold conflicts; Soft-NMS-style decayed scores are outside the independent-set model and would need a weighted-conflict generalization. (4) Boxes are axis-aligned; rotated-box detectors change the geometric constants in Section 5 though not Proposition 1 or Theorem 1.
8. Conclusion
We gave an exact account of greedy NMS's optimality. NMS is weight-ordered greedy maximum-weight independent set on the IoU-overlap graph (Proposition 1); it retains at least a 1/max(1, beta*) fraction of the optimal confidence, where beta* is the local independence number, and this is tight (Theorems 1-2); and for axis-aligned boxes beta* >= 4 at every threshold while beta*(tau) = Omega(1/tau), so the worst-case ratio is at most 1/4 everywhere and decays to tau as the threshold falls (Theorem 3). Every claim is confirmed by exact computation. The picture is actionable: greedy NMS is provably safe nowhere in the worst case but benign in practice at high thresholds, and the exact problem it approximates (MWIS) is now explicit, with our bounds saying when solving it exactly is worth the cost. The main open directions are the matching O(1/tau) upper bound on beta* and, more importantly, a faithful lift of these guarantees from the confidence-sum surrogate to recall and average precision.
References
- A. Neubeck and L. Van Gool. Efficient Non-Maximum Suppression. International Conference on Pattern Recognition (ICPR), 2006.
- N. Bodla, B. Singh, R. Chellappa, and L. S. Davis. Soft-NMS -- Improving Object Detection With One Line of Code. International Conference on Computer Vision (ICCV), 2017.
- J. Hosang, R. Benenson, and B. Schiele. Learning Non-Maximum Suppression. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
- H. Rezatofighi, N. Tsoi, J. Gwak, A. Sadeghian, I. Reid, and S. Savarese. Generalized Intersection over Union: A Metric and a Loss for Bounding Box Regression. CVPR, 2019.
- M. M. Halldorsson and J. Radhakrishnan. Greed is Good: Approximating Independent Sets in Sparse and Bounded-Degree Graphs. Algorithmica, 18(1):145-163, 1997.
- S. Kosub. A note on the triangle inequality for the Jaccard distance. Pattern Recognition Letters, 120:36-38, 2019.
- M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman. The PASCAL Visual Object Classes (VOC) Challenge. International Journal of Computer Vision, 88(2):303-338, 2010.
- T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollar, and C. L. Zitnick. Microsoft COCO: Common Objects in Context. European Conference on Computer Vision (ECCV), 2014.