Skip to content

fix: correct NMSBoxes input format in license_plate_detection_yunet - #314

Open
princemittalr wants to merge 1 commit into
opencv:mainfrom
princemittalr:fix/lpd-yunet-nmsboxes-275
Open

fix: correct NMSBoxes input format in license_plate_detection_yunet#314
princemittalr wants to merge 1 commit into
opencv:mainfrom
princemittalr:fix/lpd-yunet-nmsboxes-275

Conversation

@princemittalr

Copy link
Copy Markdown

Fixes #275

Problem

NMSBoxes expects bounding boxes in [x, y, width, height] format, but
_postprocess was passing dets[:, 0:4] which contains [x1, y1, x2, y2]
— the first two corner coordinates. This breaks IoU computation completely
in multi-plate scenes, causing wrong boxes to be suppressed.

Fix

  • Compute axis-aligned bounding box from all 4 corner points using min/max
  • Convert to [x, y, w, h] format for NMSBoxes
  • Flatten keepIdx to handle return type difference between OpenCV 4.5 and 4.7+

Changes

  • models/license_plate_detection_yunet/lpd_yunet.py

NMSBoxes expects [x, y, w, h] but code was passing [x1, y1, x2, y2]
corner coordinates, breaking IoU computation in multi-plate scenes.

Fix: compute axis-aligned bounding box from 4 corner points and
convert to [x, y, w, h] format. Also flatten keepIdx to handle
NMSBoxes return type change between OpenCV 4.5 and 4.7+.

Fixes opencv#275
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

license_plate_detection_yunet NMSBoxes call with wrong bboxes

1 participant