Microsoft Research Community

MRF and Infer.NET

rated by 0 users
This post has 2 Replies | 3 Followers

Top 100 Contributor
Posts 7
hr0nix Posted: 10-17-2009 10:27 AM

Can you please advice how one can model Markov random field in Infer.NET? I'd like to implement a simple image segmentation algorithm, but I'm really unsure about the way of specifying clique potentials in the model.

 

Thanks in advance.

Top 10 Contributor
Posts 50

You can specify clique potentials using constraints or soft constraints.  For example, if you want a potential which is 0.2 when x1==x2 and 0.8 otherwise, you can say:
  Variable.ConstrainEqualRandom(x1==x2, new Bernoulli(0.2));
which is equivalent to:
  Variable.ConstrainEqual(x1==x2, Variable.Bernoulli(0.2));
The latter form is preferable if you want 0.2 to be a parameter of the model.  For example:
  Variable<double> p = Variable.Beta(1,1);
  Variable.ConstrainEqual(x1==x2, Variable.Bernoulli(p));
  Variable.ConstrainEqual(x2==x3, Variable.Bernoulli(p));
  etc.

Top 25 Contributor
Posts 31

Whilst you can construct this model in Infer.NET, as Tom describes, you should be aware that Infer.NET does not yet handle large grid models efficiently - such as would be needed to segment a normal sized image.  This is a high priority feature and we intend to support it in a forthcoming release. 

Best regards,

John W.

Page 1 of 1 (3 items) | RSS
©2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Feedback