Answered by:
MRF and Infer.NET (Migrated from community.research.microsoft.com)

Question
-
hr0nix posted on 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.
Friday, June 3, 2011 6:03 PM
Answers
-
minka replied on 09-24-2010 7:56 AM
You can use multiple constraints to build up arbitrarily complex compatibility functions. See for example these threads: http://community.research.microsoft.com/forums/t/4542.aspx
http://community.research.microsoft.com/forums/t/4448.aspx- Marked as answer by Microsoft Research Friday, June 3, 2011 6:04 PM
Friday, June 3, 2011 6:04 PM
All replies
-
minka replied on 10-17-2009 11:10 AM
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.Friday, June 3, 2011 6:03 PM -
jwinn replied on 10-18-2009 6:16 PM
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.
Friday, June 3, 2011 6:03 PM -
smh0816 replied on 09-24-2010 3:49 AM
I still have no idea how to model MRF in general cases. What it the compatibility function gives different values when (x1 == 1 && x2 == 1) and (x1 == 2 && x2 == 2)? What it we have multiple labels? I think discrete 2D distribution is needed for the compatibility function.
Friday, June 3, 2011 6:03 PM -
minka replied on 09-24-2010 7:56 AM
You can use multiple constraints to build up arbitrarily complex compatibility functions. See for example these threads: http://community.research.microsoft.com/forums/t/4542.aspx
http://community.research.microsoft.com/forums/t/4448.aspx- Marked as answer by Microsoft Research Friday, June 3, 2011 6:04 PM
Friday, June 3, 2011 6:04 PM