def _take_top_detections(probs, deltas):
    """For each ROI, takes TOP probs, ids and deltas."""
    top_class_probs, top_class_ids = probs.max(dim=1)
    top_deltas = deltas[range(top_class_ids.shape[0]), top_class_ids]
    return top_class_probs, top_class_ids, top_deltas