ML | DL/Pose estimation

Pose Similarity - Weight Distance Python 코드

Leeys 2022. 3. 17. 14:14

코사인 거리는 매우 훌륭하고 좋은 결과 값을 주긴 하지만 아직 큰 결함이 있다. Confidence Score는 Pose를 추정할 때 이 좌표에는 어떤 키포인트가 있을지 얼마나 확신하는지 알려주는 정도이다. 이 정보를 무시한다면 우리는 매우 중요한 정보를 버리는 것이다.

 

weight distance 공식

🛒 함께 보면 좋은 상품: ebeiya 통화가능 스마트워치 대화면 운동측정 알림 확인 가능한, 블루투스, 4.65cm, 블랙

https://link.coupang.com/a/fUdZ79MzHE

 

ebeiya 통화가능 스마트워치 대화면 운동측정 알림 확인 가능한 - 스마트워치/밴드 | 쿠팡

현재 별점 4.5점, 리뷰 579개를 가진 ebeiya 통화가능 스마트워치 대화면 운동측정 알림 확인 가능한! 지금 쿠팡에서 더 저렴하고 다양한 스마트워치/밴드 제품들을 확인해보세요.

www.coupang.com

이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

def weightedDistanceMatching(poseVector1, poseVector2, score):
    """ 
        poseVector1 = [120(x), 230(y) ...]
        poseVector2 = [324(x), 232(y) ...]
        score = [0.2, 0.3 ....]
    """
    
    # test coordinate
    vector1PoseXY = poseVector1
    vector1Confidences = score
    
    # test threshold score sum
    vector1ConfidenceSum = sum(vector1Confidences)
    
    # train coordinate
    vector2PoseXY = poseVector2

    summation1 = 1 / vector1ConfidenceSum
    summation2 = 0
    
    for i in range(len(vector1PoseXY)):
        count += 1
        tempConf = math.floor(i / 2)
        # multiplying each joint's reliability and distance
        tempSum = vector1Confidences[tempConf] * abs(vector1PoseXY[i] - vector2PoseXY[i])
        # Add joint distance by joint count
        summation2 = summation2 + tempSum
    
    # WeightedDistance
    summation = summation1 * summation2

    return summation