harmoni_face_detect.box_utils¶
Module Contents¶
Functions¶
|
Compute the areas of rectangles given two corners. |
|
Return intersection-over-union (Jaccard index) of boxes. |
|
Perform hard non-maximum-supression to filter out boxes with iou greater |
|
Select boxes that contain human faces |
- harmoni_face_detect.box_utils.area_of(left_top, right_bottom)¶
Compute the areas of rectangles given two corners. :param left_top: left top corner. :type left_top: N, 2 :param right_bottom: right bottom corner. :type right_bottom: N, 2
- Returns
return the area.
- Return type
area (N)
- harmoni_face_detect.box_utils.iou_of(boxes0, boxes1, eps=1e-05)¶
Return intersection-over-union (Jaccard index) of boxes. :param boxes0: ground truth boxes. :type boxes0: N, 4 :param boxes1: predicted boxes. :type boxes1: N or 1, 4 :param eps: a small number to avoid 0 as denominator.
- Returns
IoU values.
- Return type
iou (N)
- harmoni_face_detect.box_utils.hard_nms(box_scores, iou_threshold, top_k=- 1, candidate_size=200)¶
Perform hard non-maximum-supression to filter out boxes with iou greater than threshold :param box_scores: boxes in corner-form and probabilities. :type box_scores: N, 5 :param iou_threshold: intersection over union threshold. :param top_k: keep top_k results. If k <= 0, keep all the results. :param candidate_size: only consider the candidates with the highest scores.
- Returns
a list of indexes of the kept boxes
- Return type
picked
- harmoni_face_detect.box_utils.predict(width, height, confidences, boxes, prob_threshold, iou_threshold=0.5, top_k=- 1)¶
Select boxes that contain human faces :param width: original image width :param height: original image height :param confidences: confidence array :type confidences: N, 2 :param boxes: boxes array in corner-form :type boxes: N, 4 :param iou_threshold: intersection over union threshold. :param top_k: keep top_k results. If k <= 0, keep all the results.
- Returns
an array of boxes kept labels (k): an array of labels for each boxes kept probs (k): an array of probabilities for each boxes being in corresponding labels
- Return type
boxes (k, 4)