Utils#
- class model_api.models.utils.OutputTransform(input_size, output_resolution)#
Bases:
object
- compute_resolution(input_size)#
- resize(image)#
- scale(inputs)#
- model_api.models.utils.add_rotated_rects(segmented_objects)#
- Return type:
list
[SegmentedObjectWithRects
]
- model_api.models.utils.clip_detections(detections, size)#
- Return type:
list
[Detection
]
- model_api.models.utils.get_contours(segmentedObjects)#
- Return type:
list
[Contour
]
- model_api.models.utils.load_labels(label_file)#
- model_api.models.utils.multiclass_nms(detections, iou_threshold=0.45, max_num=200)#
Multi-class NMS.
strategy: in order to perform NMS independently per class, we add an offset to all the boxes. The offset is dependent only on the class idx, and is large enough so that boxes from different classes do not overlap
- Parameters:
detections (np.ndarray) – labels, scores and boxes
iou_threshold (float, optional) – IoU threshold. Defaults to 0.45.
max_num (int, optional) – Max number of objects filter. Defaults to 200.
- Returns:
(dets, indices), Dets are boxes with scores. Indices are indices of kept boxes.
- Return type:
tuple
- model_api.models.utils.nms(x1, y1, x2, y2, scores, thresh, include_boundaries=False, keep_top_k=0)#
- Return type:
list
[int
]
- model_api.models.utils.softmax(logits, eps=1e-09, axis=None, keepdims=False)#
- Return type:
ndarray