tucan9389 / PoseEstimation-CoreML

The example project of inferencing Pose Estimation using Core ML
https://github.com/motlabs/awesome-ml-demos-with-ios
MIT License
680 stars 136 forks source link

Support pose matching feature #20

Closed tucan9389 closed 5 years ago

tucan9389 commented 5 years ago

Demo

Pose Capturing Pose Matching
demo-pose-capturing demo-pose-matching

PR Point

How to make the matching rate

1. Vector based method

  1. Get the connected points (p1_1, p1_2) from captured points
  2. Get the connected points (p2_1, p2_2) from predicted points
  3. Exception handling (nil check, confidence check)
  4. Get two vector
    let vec1: CGPoint = p1_2 - p1_1
    let vec2: CGPoint = p2_2 - p2_1
  5. Calculate the angle with vec1, (0, 0), vec2: angle loss
  6. Sum all angle loss and divide by (numberOfLoss) * (π/2): loss rate
  7. Check the 6th's result is on 0.0 to 1.0 range.
  8. Flip the result
    let matchingRate = 1 - lossRate

2. Angle based method

Implemented on source code