def py_cpu_softnms(dets, sc, Nt=0.3, sigma=0.5, thresh=0.001, method=2):
    '\n    py_cpu_softnms\n    :param dets:   boexs 坐标矩阵 format [y1, x1, y2, x2]\n    :param sc:     每个 boxes 对应的分数\n    :param Nt:     iou 交叠门限\n    :param sigma:  使用 gaussian 函数的方差\n    :param thresh: 最后的分数门限\n    :param method: 使用的方法\n    :return:       留下的 boxes 的 index\n    '
    N = dets.shape[0]
    indexes = np.array([np.arange(N)])
    dets = np.concatenate((dets, indexes.T), axis=1)
    y1 = dets[:, 0]
    x1 = dets[:, 1]
    y2 = dets[:, 2]
    x2 = dets[:, 3]
    scores = sc
    areas = (((x2 - x1) + 1) * ((y2 - y1) + 1))
    for i in range(N):
        tBD = dets[i, :].copy()
        tscore = scores[i].copy()
        tarea = areas[i].copy()
        pos = (i + 1)
        if (i != (N - 1)):
            maxscore = np.max(scores[pos:], axis=0)
            maxpos = np.argmax(scores[pos:], axis=0)
        else:
            maxscore = scores[(- 1)]
            maxpos = 0
        if (tscore < maxscore):
            dets[i, :] = dets[((maxpos + i) + 1), :]
            dets[((maxpos + i) + 1), :] = tBD
            tBD = dets[i, :]
            scores[i] = scores[((maxpos + i) + 1)]
            scores[((maxpos + i) + 1)] = tscore
            tscore = scores[i]
            areas[i] = areas[((maxpos + i) + 1)]
            areas[((maxpos + i) + 1)] = tarea
            tarea = areas[i]
        xx1 = np.maximum(dets[(i, 1)], dets[pos:, 1])
        yy1 = np.maximum(dets[(i, 0)], dets[pos:, 0])
        xx2 = np.minimum(dets[(i, 3)], dets[pos:, 3])
        yy2 = np.minimum(dets[(i, 2)], dets[pos:, 2])
        w = np.maximum(0.0, ((xx2 - xx1) + 1))
        h = np.maximum(0.0, ((yy2 - yy1) + 1))
        inter = (w * h)
        ovr = (inter / ((areas[i] + areas[pos:]) - inter))
        if (method == 1):
            weight = np.ones(ovr.shape)
            weight[(ovr > Nt)] = (weight[(ovr > Nt)] - ovr[(ovr > Nt)])
        elif (method == 2):
            weight = np.exp(((- (ovr * ovr)) / sigma))
        else:
            weight = np.ones(ovr.shape)
            weight[(ovr > Nt)] = 0
        scores[pos:] = (weight * scores[pos:])
    inds = dets[:, 4][(scores > thresh)]
    keep = inds.astype(int)
    return keep
py_cpu_softnms
:param dets:   boexs 坐标矩阵 format [y1, x1, y2, x2]
:param sc:     每个 boxes 对应的分数
:param Nt:     iou 交叠门限
:param sigma:  使用 gaussian 函数的方差
:param thresh: 最后的分数门限
:param method: 使用的方法
:return:       留下的 boxes 的 index
def py_cpu_softnms(dets, sc, Nt=0.3, sigma=0.5, thresh=0.001, method=2):
    '\n    py_cpu_softnms\n    :param dets:   boexs 坐标矩阵 format [y1, x1, y2, x2]\n    :param sc:     每个 boxes 对应的分数\n    :param Nt:     iou 交叠门限\n    :param sigma:  使用 gaussian 函数的方差\n    :param thresh: 最后的分数门限\n    :param method: 使用的方法\n    :return:       留下的 boxes 的 index\n    '
    N = dets.shape[0]
    indexes = np.array([np.arange(N)])
    dets = np.concatenate((dets, indexes.T), axis=1)
    y1 = dets[:, 0]
    x1 = dets[:, 1]
    y2 = dets[:, 2]
    x2 = dets[:, 3]
    scores = sc
    areas = (((x2 - x1) + 1) * ((y2 - y1) + 1))
    for i in range(N):
        tBD = dets[i, :].copy()
        tscore = scores[i].copy()
        tarea = areas[i].copy()
        pos = (i + 1)
        if (i != (N - 1)):
            maxscore = np.max(scores[pos:], axis=0)
            maxpos = np.argmax(scores[pos:], axis=0)
        else:
            maxscore = scores[(- 1)]
            maxpos = 0
        if (tscore < maxscore):
            dets[i, :] = dets[((maxpos + i) + 1), :]
            dets[((maxpos + i) + 1), :] = tBD
            tBD = dets[i, :]
            scores[i] = scores[((maxpos + i) + 1)]
            scores[((maxpos + i) + 1)] = tscore
            tscore = scores[i]
            areas[i] = areas[((maxpos + i) + 1)]
            areas[((maxpos + i) + 1)] = tarea
            tarea = areas[i]
        xx1 = np.maximum(dets[(i, 1)], dets[pos:, 1])
        yy1 = np.maximum(dets[(i, 0)], dets[pos:, 0])
        xx2 = np.minimum(dets[(i, 3)], dets[pos:, 3])
        yy2 = np.minimum(dets[(i, 2)], dets[pos:, 2])
        w = np.maximum(0.0, ((xx2 - xx1) + 1))
        h = np.maximum(0.0, ((yy2 - yy1) + 1))
        inter = (w * h)
        ovr = (inter / ((areas[i] + areas[pos:]) - inter))
        if (method == 1):
            weight = np.ones(ovr.shape)
            weight[(ovr > Nt)] = (weight[(ovr > Nt)] - ovr[(ovr > Nt)])
        elif (method == 2):
            weight = np.exp(((- (ovr * ovr)) / sigma))
        else:
            weight = np.ones(ovr.shape)
            weight[(ovr > Nt)] = 0
        scores[pos:] = (weight * scores[pos:])
    inds = dets[:, 4][(scores > thresh)]
    keep = inds.astype(int)
    return keep