| OpenCV 3.4.3 Open Source Computer Vision

Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
cv::dnn_objdetect::InferBbox Class Reference
DNN used for object detection

A class to post process model predictions. More...

`#include "core_detect.hpp"`

## Public Member Functions
| InferBbox (Mat _delta_bbox, Mat _class_scores, Mat _conf_scores)
| Default constructer. More...
void | filter (double thresh=0.8)
| Filters the bounding boxes. More...

## Public Attributes
std::vector< object > | detections
| Vector which holds the final detections of the model. More...

## Protected Member Functions
void | assert_predictions (std::vector< std::vector< double > > *min_max_boxes)
| Ensures that the bounding box values are within image boundaries. More...
void | filter_top_n (std::vector< std::vector< double > > *probs, std::vector< std::vector< double > > *boxes, std::vector< std::vector< double > > &top_n_boxes, std::vector< size_t > &top_n_idxs, std::vector< double > &top_n_probs)
| Filter top `n` predictions. More...
void | final_probability_dist (std::vector< std::vector< double > > *final_probs)
| Computes final probability values of each bounding box. More...
void | intersection_over_union (std::vector< std::vector< double > > *boxes, std::vector< double > *base_box, std::vector< double > *iou)
| Computes intersection over union of bounding boxes. More...
void | nms_wrapper (std::vector< std::vector< double > > &top_n_boxes, std::vector< size_t > &top_n_idxs, std::vector< double > &top_n_probs)
| Wrapper to apply Non-Maximal Supression. More...
std::vector< bool > | non_maximal_suppression (std::vector< std::vector< double > > *boxes, std::vector< double > *probs)
| Applies Non-Maximal Supression. More...
void | transform_bboxes (std::vector< std::vector< double > > *bboxes)
| Transform relative coordinates from ConvDet to bounding box coordinates. More...
void | transform_bboxes_inv (std::vector< std::vector< double > > *pre, std::vector< std::vector< double > > *post)
| Transform bounding boxes from [x, y, h, w] to [xmin, ymin, xmax, ymax]. More...

## Static Protected Member Functions
static bool | comparator (std::pair< double, size_t > l1, std::pair< double, size_t > l2)

## Detailed Description

A class to post process model predictions.

## Constructor & Destructor Documentation

## § InferBbox()

cv::dnn_objdetect::InferBbox::InferBbox | ( | Mat | _delta_bbox,
|  | Mat | _class_scores,
|  | Mat | _conf_scores
| ) |  |

Default constructer.

Parameters

  _delta_bbox | Blob containing relative coordinates of bounding boxes
  _class_scores | Blob containing the probability values of each class
  _conf_scores | Blob containing the confidence scores

## Member Function Documentation

## § assert_predictions()

void cv::dnn_objdetect::InferBbox::assert_predictions | ( | std::vector< std::vector< double > > * | min_max_boxes | ) |
| protected

Ensures that the bounding box values are within image boundaries.

Parameters

  min_max_boxes | Vector containing bounding boxes of the form [xmin, ymin, xmax, ymax]

## § comparator()

static bool cv::dnn_objdetect::InferBbox::comparator | ( | std::pair< double, size_t > | l1,
|  | std::pair< double, size_t > | l2
| ) |  |
| inline static protected

## § filter()

void cv::dnn_objdetect::InferBbox::filter | ( | double | thresh = `0.8` | ) |

Filters the bounding boxes.

## § filter_top_n()

void cv::dnn_objdetect::InferBbox::filter_top_n | ( | std::vector< std::vector< double > > * | probs,
|  | std::vector< std::vector< double > > * | boxes,
|  | std::vector< std::vector< double > > & | top_n_boxes,
|  | std::vector< size_t > & | top_n_idxs,
|  | std::vector< double > & | top_n_probs
| ) |  |
| protected

Filter top `n` predictions.

Parameters

  probs | Final probability values of bounding boxes
  boxes | Predicted bounding box co-ordinates
  top_n_boxes | Contains bounding box co-ordinates of top `n` boxes
  top_n_idxs | Containes class indices of top `n` bounding boxes
  top_n_probs | Contains probability values of top `n` bounding boxes

## § final_probability_dist()

void cv::dnn_objdetect::InferBbox::final_probability_dist | ( | std::vector< std::vector< double > > * | final_probs | ) |
| protected

Computes final probability values of each bounding box.

Parameters

  final_probs | Vector to hold the probability values

## § intersection_over_union()

void cv::dnn_objdetect::InferBbox::intersection_over_union | ( | std::vector< std::vector< double > > * | boxes,
|  | std::vector< double > * | base_box,
|  | std::vector< double > * | iou
| ) |  |
| protected

Computes intersection over union of bounding boxes.

Parameters

  boxes | Vector of bounding box co-ordinates
  base_box | Base box wrt which IOU is calculated
  iou | Vector to store IOU values

## § nms_wrapper()

void cv::dnn_objdetect::InferBbox::nms_wrapper | ( | std::vector< std::vector< double > > & | top_n_boxes,
|  | std::vector< size_t > & | top_n_idxs,
|  | std::vector< double > & | top_n_probs
| ) |  |
| protected

Wrapper to apply Non-Maximal Supression.

Parameters

  top_n_boxes | Contains bounding box co-ordinates of top `n` boxes
  top_n_idxs | Containes class indices of top `n` bounding boxes
  top_n_probs | Contains probability values of top `n` bounding boxes

## § non_maximal_suppression()

std::vector<bool> cv::dnn_objdetect::InferBbox::non_maximal_suppression | ( | std::vector< std::vector< double > > * | boxes,
|  | std::vector< double > * | probs
| ) |  |
| protected

Applies Non-Maximal Supression.

Parameters

  boxes | Bounding box co-ordinates belonging to one class
  probs | Probability values of boxes belonging to one class

## § transform_bboxes()

void cv::dnn_objdetect::InferBbox::transform_bboxes | ( | std::vector< std::vector< double > > * | bboxes | ) |
| protected

Transform relative coordinates from ConvDet to bounding box coordinates.

Parameters

  bboxes | Vector to hold the predicted bounding boxes

## § transform_bboxes_inv()

void cv::dnn_objdetect::InferBbox::transform_bboxes_inv | ( | std::vector< std::vector< double > > * | pre,
|  | std::vector< std::vector< double > > * | post
| ) |  |
| protected

Transform bounding boxes from [x, y, h, w] to [xmin, ymin, xmax, ymax].

Parameters

  pre | Vector conatining initial co-ordinates
  post | Vector containing the transformed co-ordinates

## Member Data Documentation

## § detections

std::vector<object> cv::dnn_objdetect::InferBbox::detections

Vector which holds the final detections of the model.

The documentation for this class was generated from the following file:

- /build/3_4-contrib_docs-lin64/opencv_contrib/modules/dnn_objdetect/include/opencv2/core_detect.hpp