dynamic programming review
play

Dynamic programming - review Josef Sivic - PowerPoint PPT Presentation

Reconnaissance dobjets et vision artificielle 2009 Dynamic programming - review Josef Sivic http://www.di.ens.fr/~josef Equipe-projet WILLOW, ENS/INRIA/CNRS UMR 8548 Laboratoire dInformatique, Ecole Normale Suprieure, Paris Many slides


  1. Reconnaissance d’objets et vision artificielle 2009 Dynamic programming - review Josef Sivic http://www.di.ens.fr/~josef Equipe-projet WILLOW, ENS/INRIA/CNRS UMR 8548 Laboratoire d’Informatique, Ecole Normale Supérieure, Paris Many slides from: A. Zisserman

  2. Dynamic programming • Discrete optimization • Each variable x has a finite number of possible states • Applies to problems that can be decomposed into a sequence of stages • Each stage expressed in terms of results of fixed number of previous stages • The cost function need not be convex • The name “dynamic” is historical • Also called the “Viterbi” algorithm

  3. Consider a cost function of the form where x i can take one of h values trellis x 1 x 2 x 3 x 4 x 5 x 6 e.g. h=5, n=6 find shortest path Complexity of minimization: • exhaustive search O(h n ) • dynamic programming O(nh 2 )

  4. Example 1 smoothness closeness to measurements d x i i

  5. Motivation: complexity of stereo correspondence Objective: compute horizontal displacement for matches between left and right images

  6. x 1 x 2 x 3 x 4 x 5 x 6 Key idea: the optimization can be broken down into n sub-optimizations

  7. x 1 x 2 x 3 x 4 x 5 x 6

  8. Viterbi Algorithm Complexity O(nh 2 )

  9. Example 2 d x i i Note, f(x) is not convex

  10. Note This type of cost function often arises in MAP estimation measurements Bayes’ rule e.g. for Gaussian measurement errors, and first order smoothness Use negative log to obtain a cost function of the form from likelihood from prior

  11. Where can DP be applied? Dynamic programming can be applied when there is a linear ordering on the cost function (so that partial minimizations can be computed). Example Applications: 1. Text processing: String edit distance 2. Speech recognition: Dynamic time warping 3. Computer vision: Stereo correspondence 4. Image manipulation: Image re-targeting 5. Bioinformatics: Gene alignment

  12. Application I: string edit distance The edit distance of two strings, s1 and s2, is the minimum number of single character mutations required to change s1 into s2, where a mutation is one of: 1. substitute a letter ( kat  cat ) cost = 1 2. insert a letter ( ct  cat ) cost = 1 3. delete a letter ( caat  cat ) cost = 1 Example: d( opimizateon, optimization ) op imizateon || ||||||||| optimization |||||||||||| ‘c’ = copy, cost = 0 cciccccccscc d(s1,s2) = 2

  13. Complexity • for two strings of length m and n, exhaustive search has complexity O( 3 m+n ) • dynamic programming reduces this to O( mn )

  14. Using string edit distance for spelling correction 1. Check if word w is in the dictionary D 2. If it is not, then find the word x in D that minimizes d(w, x) 3. Suggest x as the corrected spelling for w Note: step 2 appears to require computing the edit distance to all words in D, but this is not required at run time because edit distance is a metric, and this allows efficient search.

  15. Application II: Dynamic Time Warp (DTW) Objective: temporal alignment of a sample and template speech pattern sample template audio time frequency (Hz) warp to match log(STFT) `columns’ of log(STFT) matrix short term Fourier transform

  16. template Application II: Dynamic Time Warp (DTW) s a m p l e is time shift of i th column (1, 0) (0, 1) quality of match cost of allowed moves (1, 1)

  17. Application III: stereo correspondence Objective: compute horizontal displacement for matches between left and right images

  18. Application III: stereo correspondence Objective: compute horizontal displacement for matches between left and right images is spatial shift of i th pixel quality of match uniqueness, smoothness

  19. left image band right image band 1 normalized cross 0.5 correlation(NCC) 0 x NCC of square image regions at offset (disparity) x

  20. • Arrange the raster intensities on two sides of a grid • Crossed dashed lines represent potential correspondences • Curve shows DP solution for shortest path (with cost computed from f(x))

  21. Pentagon example left image right image range map

  22. Real-time application – Background substitution Left view Right view Input Results Background substitution 2 Background substitution 1 input left view

  23. Application IV: image re-targeting • Remove image “seams” for imperceptible aspect ratio change seam Seam Carving for Content-Aware Image Retargeting. Avidan and Shamir, SIGGRAPH, San-Diego, 2007

  24. scale seam removal

  25. Finding the optimal seam – s s

  26. Generalization: dynamic programming on graphs 1 2 3 4 5 6

  27. Different graph structures 6 1 3 5 2 3 2 3 1 2 1 4 5 4 6 4 5 6 Fully connected Tree structure Star structure O(nh 2 ) O(nh 2 ) O(h n ) Application: fitting pictorial structures to images

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend