def compute_detections_batch(segs, boxes, num_keep,
seg_threshold=0.2,
sigma=5e-3, step=0.2, num_iters=20,
dist_threshold=20.0,
iou_threshold=0.5,
nms_kind='greedy'):
if nms_kind == 'greedy':
# TODO: rename it to CRF?
_compute_frame = (lambda x: compute_detections_greedy(x[0], x[1], num_keep,
seg_threshold,
sigma, step, num_iters,
dist_threshold))
elif nms_kind == 'nms':
_compute_frame = (lambda x: compute_detections_nms(x[0], x[1], num_keep,
seg_threshold,
iou_threshold))
boxes, confidence = tf.map_fn(_compute_frame, (segs, boxes))
return boxes, confidence
评论列表
文章目录