Skip to content

dnn: moved NMSBoxes to imgproc module#23711

Closed
mshabunin wants to merge 4 commits intoopencv:4.xfrom
mshabunin:move-nmsboxes
Closed

dnn: moved NMSBoxes to imgproc module#23711
mshabunin wants to merge 4 commits intoopencv:4.xfrom
mshabunin:move-nmsboxes

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

Motivation: non-maximum suppression can be used not only as postprocessing in DNN-based algorithms, so we move it to imgproc module together with other geometry- and contour-related algorithms (bounding rect, intersections, etc.).

Notes:
  • I tried to preserve ABI and API compatibility with existing code, thus declaring aliases in cv::dnn namespace and keeping old functions in dnn module (hidden from user, header file not installed). Maybe it is not really necessary because dnn ABI is still considered experimental.
  • Python API will probably be broken (cv.dnn.NMSBoxes -> cv.NMSBoxes) (maybe we can put these functions to the dnn namespace in the imgproc module to fix it...? 🤔)
  • I did not check other bindings (JS?)

@opencv-alalek
Copy link
Copy Markdown
Contributor

IMO, it should be objdetect instead. Similar to groupRectangles() API.

(but need to resolve dependency issue).

@mshabunin
Copy link
Copy Markdown
Contributor Author

Originally I wanted to move all NMS stuff to the core module to be close with Rect and RotatedRect, but turned out NMS for RotatedRect uses rotatedRectangleIntersection and contourArea to calculate IOU which are in imgproc.

It seems impossible to move NMS to objdetect because then dnn would depend on it and we already have inverse dependency (objdetect on_dnn_).

I think, ideally all geometry-related classes and algorithms should be moved to the core or a separate module - large part of core/types.hpp, operations with rectangles and contours (but not findContours) - all of this does not operate with pixels and does not depend on Mat.

@fengyuentau
Copy link
Copy Markdown
Member

fengyuentau commented Jun 2, 2023

IMO, it should be objdetect instead.

I agree with this. core module makes sense as well. imgproc is more like a image processing module but NMSBoxes or NMSBoxesBatched is operation on boxes.

If the API move is being proceeding still, we can leave the legacy API calling the new one from other module, leave a warning for API deprecation and remove the legacy one completely in some point.

@asmorkalov
Copy link
Copy Markdown
Contributor

Discussed on OpenCV core team meating. Found alternative solution. Closed.

@asmorkalov asmorkalov closed this Jun 2, 2023
@dkurt
Copy link
Copy Markdown
Member

dkurt commented Jun 4, 2023

@asmorkalov, Once an alternative solution will be published, may I ask to refer it here? Just to be on touch. Thanks in advance!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants