コード例 #1
0
ファイル: eval.py プロジェクト: codealphago/yolo2-pytorch
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
コード例 #2
0
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
コード例 #3
0
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