DNN used for object detection#

Classes#

Name

Description

class cv::dnn_objdetect::InferBbox

A class to post process model predictions.

struct cv::dnn_objdetect::object

Structure to hold the details pertaining to a single bounding box.

Class cv::dnn_objdetect::InferBbox#

A class to post process model predictions.

Collaboration diagram for cv::dnn_objdetect::InferBbox:

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#

filter()#

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

Filters the bounding boxes.

assert_predictions()#

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

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]

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 )

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)

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 )

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 )

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 )

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)

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 )

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

comparator()#

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

Member Data Documentation#

detections#

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

Vector which holds the final detections of the model.

anchor_center#

std::vector< std::pair< double, double > > cv::dnn_objdetect::InferBbox::anchor_center

anchor_shapes#

std::vector< std::pair< double, double > > cv::dnn_objdetect::InferBbox::anchor_shapes

anchors#

size_t cv::dnn_objdetect::InferBbox::anchors

anchors_per_grid#

unsigned int cv::dnn_objdetect::InferBbox::anchors_per_grid

anchors_values#

std::vector< std::vector< double > > cv::dnn_objdetect::InferBbox::anchors_values

class_scores#

Mat cv::dnn_objdetect::InferBbox::class_scores

conf_scores#

Mat cv::dnn_objdetect::InferBbox::conf_scores

delta_bbox#

Mat cv::dnn_objdetect::InferBbox::delta_bbox

epsilon#

double cv::dnn_objdetect::InferBbox::epsilon

H#

unsigned int cv::dnn_objdetect::InferBbox::H

image_height#

unsigned int cv::dnn_objdetect::InferBbox::image_height

image_width#

unsigned int cv::dnn_objdetect::InferBbox::image_width

intersection_thresh#

double cv::dnn_objdetect::InferBbox::intersection_thresh

label_map#

std::vector< std::string > cv::dnn_objdetect::InferBbox::label_map

n_top_detections#

size_t cv::dnn_objdetect::InferBbox::n_top_detections

nms_intersection_thresh#

double cv::dnn_objdetect::InferBbox::nms_intersection_thresh

num_classes#

unsigned int cv::dnn_objdetect::InferBbox::num_classes

W#

unsigned int cv::dnn_objdetect::InferBbox::W

Source file#

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

Struct cv::dnn_objdetect::object#

Structure to hold the details pertaining to a single bounding box.

Collaboration diagram for cv::dnn_objdetect::object:

cv::dnn_objdetect::object Node1 cv::dnn_objdetect:: object     Node2 int     Node2->Node1 +xmax +xmin +ymax +ymin Node3 size_t     Node3->Node1 +class_idx Node4 std::string     Node4->Node1 +label_name Node5 std::basic_string< Char >     Node5->Node4 Node6 double     Node6->Node1 +class_prob

cv::dnn_objdetect::object Node1 cv::dnn_objdetect:: object     Node2 int     Node2->Node1 +xmax +xmin +ymax +ymin Node3 size_t     Node3->Node1 +class_idx Node4 std::string     Node4->Node1 +label_name Node5 std::basic_string< Char >     Node5->Node4 Node6 double     Node6->Node1 +class_prob

Detailed Description#

Structure to hold the details pertaining to a single bounding box.

Examples
samples/cpp/grabcut.cpp, samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_2.cpp, samples/cpp/tutorial_code/features/Homography/pose_from_homography.cpp, samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp, samples/dnn/object_detection.cpp, and samples/dnn/segmentation.cpp.

Member Data Documentation#

class_idx#

size_t cv::dnn_objdetect::object::class_idx

class_prob#

double cv::dnn_objdetect::object::class_prob

label_name#

std::string cv::dnn_objdetect::object::label_name

xmax#

int cv::dnn_objdetect::object::xmax

xmin#

int cv::dnn_objdetect::object::xmin

ymax#

int cv::dnn_objdetect::object::ymax

ymin#

int cv::dnn_objdetect::object::ymin

Source file#

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