Claude Code wrote class-agnostic NMS for multi-class detector, wasted 11hrs GPU compute

Resolved 💬 3 comments Opened Mar 10, 2026 by warp143 Closed Mar 14, 2026

Bug Report

Claude Code was tasked with writing a tiled YOLOv26x-seg (TensorRT FP16) inference pipeline for a livestock monitoring system with 2 classes: pig and person.

It implemented class-agnostic NMS instead of per-class NMS. This caused all person detections to be suppressed by overlapping pig detections, resulting in zero person detections across 1677 processed video clips.

The error was only discovered after the full 11-hour inference run completed on an RTX 3060. Fixing required deleting all output and rerunning — another 11 hours wasted.

What went wrong

# Claude wrote this (WRONG — class-agnostic):
keep = _nms(ba, sa, NMS_IOU_THRESH)

# Should have been (per-class):
keep = []
for cls_id in set(all_cls):
    idx = np.array([i for i, c in enumerate(all_cls) if c == cls_id])
    kept = _nms(ba[idx], sa[idx], NMS_IOU_THRESH)
    keep.extend(idx[kept].tolist())

Per-class NMS is a fundamental, well-known requirement for multi-class object detection. Claude should not have made this mistake.

Cost

~22 hours of GPU compute wasted (11hrs bad run + 11hrs rerun).

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗