1 / 20

Divide & Conquer

Divide & Conquer. Fibonacci (recursion). fib(n) = fib(n – 1) + fib(n – 2), fib(0) = fib(1) = 1. int fib( int n) { if (n == 0 || n == 1) return 1; else return fib(n – 1) + fib(n – 2); }. O(2 n ). Fibonacci (table). O(n). Dynamic Time Warping (DTW). Mapping between two sequences.

abra
Download Presentation

Divide & Conquer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Divide & Conquer

  2. Fibonacci (recursion) fib(n) = fib(n – 1) + fib(n – 2), fib(0) = fib(1) = 1 int fib(int n) { if (n == 0 || n == 1) return 1; else return fib(n – 1) + fib(n – 2); } O(2n)

  3. Fibonacci (table) O(n)

  4. Dynamic Time Warping (DTW)

  5. Mapping between two sequences Alignment is needed

  6. Warping Path

  7. ผลลัพธ์ที่ต้องการ เติมตารางขนาด N x M

  8. Cost Matrix (discrete!)

  9. Global Alignment N ∞ Best score … ∞ warping path ให้ถอยหลังไปตามทางที่เลือก min Sequence X 1 ∞ 0 0 ∞ ∞ ∞ ∞ ∞ 0 1 2 3 … M O(NM) Sequence Y

  10. Local Alignment N ∞ Minscore … ∞ Maxindex Sequence X 1 ∞ C(x1,y1) C(x1,y2) C(x1,y3) C(x1,y4) … C(x1,yM) 0 0 ∞ ∞ ∞ ∞ ∞ ∞ 0 1 2 3 4 … M Sequence Y ลงมาแตะแถวล่างn = 1 ให้เร็วที่สุด

  11. Homework (local alignment) Sequence X = 0, 2, 3, 2, 0, 2, 3, 2, 0 Sequence Y = 0,2,4,5,4,2,0,-2,-4,-5,-4,-2,0,2,3,2,0,2,3,2,0

  12. DTW in C# .NET

  13. Solution Sequence X x คือ infinity Sequence Y

  14. Problems you will encounter and hints • Lagging due to searching for many motions. • Threading. • Sliding window (timing). • Use a buffer or a queue. • Multiple joints, each joint is in 3D. • No needs to use all joints • Player-position dependence. • Use an angle of a joint with a reference point. • Other solutions ??? • Players must stand at a fixed position (not good). • Use a distance from Kinect for moving forward and backward (or use a height of head, for example).

  15. Architecture Key / mouse events Motions detected Motions Joint positions Time window Q1 DTW Q2 OverrideKB/Mouse Game Overflow(likely) Overflow(rare) One process(two threads, two queues) One process Core DTW is the major bottleneck.See parallelization (utilizing multiple-core) in the next chapter.

  16. Time Window Sliding (small step)and run DTW in the time window Time Timewindow If the step size is too large,some motions will be missed.

  17. Tips • ใช้เฉพาะ joint ที่สำคัญ ไม่ต้องใช้ทั้งหมด เพื่อให้ประมวลผลได้เร็ว • แปลง trajectory ใน 3D ให้เป็น angle (self-reference) Vector A Position of a joint in 3D (meter) z Vector B(reference) y x time Angle of a joint (degree) Absolutedistance !!! Θ Chest time Angle between vector A and B= cos-1(AB / |A||B|)

More Related