def METHOD_NAME(outputs, w, h, detectedKeypoints):
    validPairs = []
    invalidPairs = []
    nInterpSamples = 10
    pafScoreTh = 0.2
    confTh = 0.4
    for k in range(len(mapIdx)):
        pafA = outputs[0, mapIdx[k][0], :, :]
        pafB = outputs[0, mapIdx[k][1], :, :]
        pafA = cv2.resize(pafA, (w, h))
        pafB = cv2.resize(pafB, (w, h))
        candA = detectedKeypoints[POSE_PAIRS[k][0]]
        candB = detectedKeypoints[POSE_PAIRS[k][1]]
        nA = len(candA)
        nB = len(candB)
        if (nA != 0 and nB != 0):
            validPair = np.zeros((0, 3))
            for i in range(nA):
                maxJ = -1
                maxScore = -1
                found = 0
                for j in range(nB):
                    d_ij = np.subtract(candB[j][:2], candA[i][:2])
                    norm = np.linalg.norm(d_ij)
                    if norm:
                        d_ij = d_ij / norm
                    else:
                        continue
                    interp_coord = list(zip(np.linspace(candA[i][0], candB[j][0], num=nInterpSamples),
                                            np.linspace(candA[i][1], candB[j][1], num=nInterpSamples)))
                    pafInterp = []
                    for k in range(len(interp_coord)):
                        pafInterp.append([pafA[int(round(interp_coord[k][1])), int(round(interp_coord[k][0]))],
                                           pafB[int(round(interp_coord[k][1])), int(round(interp_coord[k][0]))]])
                    pafScores = np.dot(pafInterp, d_ij)
                    avgPafScore = sum(pafScores) / len(pafScores)
                    if (len(np.where(pafScores > pafScoreTh)[0]) / nInterpSamples) > confTh:
                        if avgPafScore > maxScore:
                            maxJ = j
                            maxScore = avgPafScore
                            found = 1
                if found:
                    validPair = np.append(validPair, [[candA[i][3], candB[maxJ][3], maxScore]], axis=0)
            validPairs.append(validPair)
        else:
            invalidPairs.append(k)
            validPairs.append([])
    return validPairs, invalidPairs