markov random fields and its applications
play

Markov Random Fields and its Applications Huiwen Chang - PowerPoint PPT Presentation

Markov Random Fields and its Applications Huiwen Chang Introduction Markov Random Fields(MRF) A kind of undirected graphical model To model vision problems: Low level: image restoration, segmentation, texture analysis High


  1. Markov Random Fields and its Applications Huiwen Chang

  2. Introduction • Markov Random Fields(MRF) – A kind of undirected graphical model • To model vision problems: – Low level: image restoration, segmentation, texture analysis… – High level: object recognition and matching(structure from motion, stereo matching)…

  3. Introduction • Markov Random Fields(MRF) – A kind of undirected graphical model • To model vision problems: – Low level: image restoration, segmentation, texture analysis… – High level: object recognition and matching(structure from motion, stereo matching)… Labeling Problem

  4. Graphical Models • Probabilistic graphical models Nodes: random variables Edges: statistical dependencies among random variables – Advantage Compact and efficient way to visualize conditional independence assumptions to represent probability distribution

  5. Conditional Independence

  6. Graphical Model • Bayesian Network – Directed acyclic graph: • Factorization: • Conditional Independence:

  7. Graphical Model • Markov Network (MRF) P(a,b,c,d)= Potential functions over the maximal clique of the graph Potential function ψ (.) > 0

  8. Graphical Model • Markov Network (MRF) P(a,b,c,d)= Hammersley-Clifford theorem says such distributions that are consistent with the set of conditional independence statements & the set of such distributions that can be expressed as a factorization by the maximal cliques of the graph are identical

  9. MAP inference • Posterior probability of the labelling y given observation x is :

  10. Markov Random Field • Posterior probability of the labelling y given observation x is : 1 𝑎(𝑦) 𝜒 𝑑 𝒛 𝐷 ; 𝑦 P( 𝑧 𝑦 = 𝑑 Potential cliques functions where 𝑎(𝑦) = 𝜒 𝑑 𝒛 𝐷 ; 𝑦 is called the partition function . 𝑑 • Since we define potential function is strictly positive, we can express them as exponentials:

  11. MAP inference • Posterior probability of the labelling y given observation x is : • The most possible labeling is to minimize the Energy

  12. Pairwise MRF • Most common energy function for image labeling Unary Pairwise • Which of the energy acted as the prior?

  13. Example MRF model: Image Denoising • How can we retrieve the original image given the noisy one? Original image Y Noisy image X( Input )

  14. MRF formulation • Nodes – For each pixel i, • y i : latent variable (value in original image) • x i : observed variable (value in noisy image) Simple setting : x i , y i  {-1,1} x 1 x 2 y 1 y 2 x i y i x n y n

  15. MRF formulation • Edges – x i ,y i of each pixel i correlated – neighboring pixels, similar value(smoothness) x 1 x 2 y 1 y 2 x i y i x n y n

  16. MRF formulation • Edges – x i ,y i of each pixel i correlated  𝑦 𝑗 , 𝑧 𝑗 = −𝛾𝑦 𝑗 𝑧 𝑗 – neighboring pixels, similar value(smoothness)  ( 𝑧 𝑗 , 𝑧 𝑘 ) = −𝛽𝑧 𝑗 𝑧 𝑘 x 1 x 2 y 1 y 2 x i y i x n y n

  17. MRF formulation Energy function E y; 𝑦 =  ( 𝑧 𝑗 , 𝑧 𝑘 ) +  𝑦 𝑗 , 𝑧 𝑗 𝑗𝑘 𝑗 = −𝛽 𝑧 𝑗 𝑧 𝑘 − 𝛾 𝑦 𝑗 𝑧 𝑗 𝑗𝑘 𝑗 x 1 x 2 y 1 y 2 x i y i x n y n

  18. Optimization Energy function E y; 𝑦 =  ( 𝑧 𝑗 , 𝑧 𝑘 ) +  𝑦 𝑗 , 𝑧 𝑗 𝑗𝑘 𝑗 = −𝛽 𝑧 𝑗 𝑧 𝑘 − 𝛾 𝑦 𝑗 𝑧 𝑗 𝑗𝑘 𝑗 Iterated Conditional Modes (ICM) Initialize 𝑧 𝑗 = 𝑦 𝑗 for all i - Take a 𝑧 𝑗 , fix others, flip 𝑧 𝑗 if −𝑧 𝑗 make energy - lower - Repeat until converge

  19. original image noise image(10%) Restored by ICM(4%)

  20. original image noise image(10%) Restored by ICM(4%) Restored by Graph Cut(<1%)

  21. Optimization • Iterated Conditional Modes(ICM) • Graph Cuts (GC) • Message Passing – Belief Propagation (BP) – Tree Reweighted (not concluded here) • LP-relaxation – Cutting-plane (not concluded here) ……

  22. Graph Cuts • To find labeling f that minimizes the energy E(𝑔; 𝑌) 𝐹 𝑡𝑛𝑝𝑝𝑢ℎ 𝐹 𝑒𝑏𝑢𝑏 𝐸 𝑞 (𝑔 𝑞 ; 𝑌 𝑞 ) neighbors pixels

  23. Graph Cuts • For labeling problem – 2 Labels: Find global minimum • Max-flow/min-cut algorithm • Boykov and Kolmogrov 2001 – the worst case complexity O(mn^2 |C|) – Fast in practice – For multi-labels: Computing the global minimum is NP-hard • Will discuss later

  24. Two-Label Example: Lazy snapping • Goal: Separate foreground from background • 1 st step: Use stroke to select • 2 nd step: Use polygon with vertices to refine

  25. Model the problem 𝐹 1 (𝑦 𝑗 ) : Likelihood Energy 𝐹 2 (𝑦 𝑗 , 𝑦 𝑘 ) : Prior Energy 𝑌 𝑗 : Label of node i. in {0: background , 1: foreground }

  26. Likelihood Energy • Data Term • Use color similarity with known pixel to give an energy for uncertain pixel 𝐺 : Minimum distance to front color – 𝑒 𝑗 𝐶 : Minimum distance to background color – 𝑒 𝑗

  27. Prior Energy • Smoothness Term • Penalty Term for boundaries – Only nonzero if across segmentation boundary – Larger if adjacent pixels have similar colors

  28. Problem • Too slow for “real - time” requirement!

  29. Problem • Too slow for “real - time” requirement!

  30. Pre-segmentation • Graph Cut on segment instead of pixel level • 𝐷 𝑗𝑘 : the mean color difference between the two segments, weighted by the shared boundary length • Speed Comparison

  31. Graph Cuts • 2 Labels: Find global minimum – Max-flow/min-cut algorithm – Fast • Multi-Labels: computing the global minimum is NP-hard – Approximation algorithm(for some forms of energy function: smoothness energy term V which is metric or semi-metric) Identity Symmetry &non-negativity Triangle inequality

  32. Graph Cuts for multi labels • α -expansion(d) – V is metric, within a known factor of global minimum • α  -swap(c) – V is semi-metric, local minimum

  33. Graph Cut for multi labels • α  -swap algorithm – • α -expansion algorithm

  34. Graph Cut for multi labels • α  -swap algorithm – Min cut/ • α -expansion algorithm Max Flow

  35. α  -swap algorithm p r

  36. α -expansion algorithm

  37. Multi-label Examples: Shift Map B C A D User Constraints No accurate segmentation D B C required A

  38. Multi-label Examples: Shift Map B C A D User Constraints D B C A

  39. Multi-label Examples: Shift Map Image completion/In-painting(object removing) User’s mask Input Output

  40. Multi-label Examples: Shift Map Retargeting(content-aware image resizing) Output Input

  41. Multi-label Examples: Shift Map • Label Set: relative mapping coordinate M Labels: shift-map values (t x ,t y ) Nodes: pixels assign a label to (x,y) pixel Input : I(x,y) Output : R(u,v)

  42. Multi-label Examples: Shift Map • Energy function:      ( ) ( ( )) ( ( ), ( )) E M E M p E M p M q d s   , p R p q N Data term : Smoothness term : External Editing Requirement Avoid Stitching Artifacts  0 D • Data term – varies between different application – Inpainting : (x,y) Specific input pixels can be forced not to be included in the output (u,v) image by setting D(x,y )=∞

  43. Smoothness term Output Image Input Image n p’ p’ n q’ p q q’ D iscontinuity in the shift-map For p For q ( ( ), ( )) color E s M p M q gradient

  44. Multi-label Examples: Shift map • Graph Cuts : α -expansion • Why design label as disparity instead of absolute coordinate of input image?

  45. Hierarchical Solution Gaussian pyramid Output on input Shift-Map Shift-Map

  46. Multi-label Examples: Dense Stereo • Label set for each pixel: – disparity 𝑒 ∈ {0, 1, . . 𝐸} Left Camera Image Right Camera Image Dense Stereo Result

  47. Multi-label Examples: Dense Stereo • Data term: for pixel p, label d Left Camera Image Right Camera Image

  48. Multi-label Examples: Dense Stereo • Smoothness term for neighboring pixels p and q – – or,

  49. Design smoothness term V • Choices of V: not Robust Better! = 1 ( 𝛽 − 𝛾 > k) = min (|𝛽 − 𝛾| ,k)

  50. Results Original Image Initial Solution

  51. Results 1 st Expansion Original Image

  52. Results 2 nd Expansion Original Image

  53. Results 3 rd Expansion Original Image

  54. Results Original Image Final expansion

  55. Results • http://vision.middlebury.edu/stereo/eval/

  56. Comments on Graph Cuts • In practice, GraphCut α -expansion algorithm usually outperforms α  -swap method • Limitations of GC algorithm: – Constraint on energy term – Speed

  57. Belief Propagation(BP) • Belief Propagation allows the marginals and maximizer to be computed efficiently on graphical models. • Sum-product BP is a message passing algorithm that calculate the marginal distribution on a graphical model • Max-product BP(or max-sum in log domain), is used to estimate the state configuration with maximum probability. • Exhaustive search O(|state|^N)

  58. Sum-product BP

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