1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #18891 from CowKeyMan:NMS_boxes_with_different_labels

Add option for NMS for boxes with different labels

* DetectionModel impl

* Add option for NMS for boxes with different labels

In the detect function in modules/dnn/include/opencv2/dnn/dnn.hpp, whose implementation can be found at modules/dnn/src/model.cpp, the Non Max Suppression (NMS) is applied only for objects of the same label. Thus, a flag
was added with the purpose to allow developers to choose if they want to keep the default implementation or wether they would like NMS to be applied to all the boxes, regardless of label.

The flag is called nmsDifferentLabels, and is given a default value of false, which applies the current default implementation, thus allowing existing projects to update opencv without disruption

Solves issue opencv#18832

* Change return type of set & Add default constr

* Add assertions due to default constructor
This commit is contained in:
Daniel Cauchi
2020-12-01 14:50:24 +01:00
committed by GitHub
parent 3f686a6ab8
commit 9d37cdaa66
3 changed files with 165 additions and 35 deletions
+17
View File
@@ -1296,6 +1296,23 @@ CV__DNN_INLINE_NS_BEGIN
*/
CV_WRAP DetectionModel(const Net& network);
CV_DEPRECATED_EXTERNAL // avoid using in C++ code (need to fix bindings first)
DetectionModel();
/**
* @brief nmsAcrossClasses defaults to false,
* such that when non max suppression is used during the detect() function, it will do so per-class.
* This function allows you to toggle this behaviour.
* @param[in] value The new value for nmsAcrossClasses
*/
CV_WRAP DetectionModel& setNmsAcrossClasses(bool value);
/**
* @brief Getter for nmsAcrossClasses. This variable defaults to false,
* such that when non max suppression is used during the detect() function, it will do so only per-class
*/
CV_WRAP bool getNmsAcrossClasses();
/** @brief Given the @p input frame, create input blob, run net and return result detections.
* @param[in] frame The input image.
* @param[out] classIds Class indexes in result detection.