def matching(data_yx_min, data_yx_max, yx_min, yx_max, threshold): if data_yx_min.numel() > 0: matrix = utils.iou.torch.iou_matrix(yx_min, yx_max, data_yx_min, data_yx_max) iou, index = torch.max(matrix, -1) positive = iou > threshold tp = _matching(positive.cpu().numpy(), index.cpu().numpy()) else: tp = np.zeros([yx_min.size(0)], np.bool) return tp
def matching(data_yx_min, data_yx_max, yx_min, yx_max, threshold): if data_yx_min.numel() > 0: matrix = utils.iou.torch.iou_matrix(yx_min, yx_max, data_yx_min, data_yx_max) iou, index = torch.max(matrix, -1) positive = iou > threshold tp = _matching(positive.cpu().numpy(), index.cpu().numpy()) else: tp = np.zeros([yx_min.size(0)], np.bool) return tp
def conv_logits(pred): if 'logits' in pred: logits = pred['logits'].contiguous() prob, cls = torch.max(F.softmax(logits, -1), -1) else: size = pred['iou'].size() prob = torch.autograd.Variable(utils.ensure_device(torch.ones(*size))) cls = torch.autograd.Variable( utils.ensure_device(torch.zeros(*size).int())) return prob, cls