## Mixed Graphical Models with DGM

Semantic Image Segmentation with Conditional Random Fields
imyuliu

### Mixed Graphical Models with DGM

Hi Dr.,

I'm studying CRFs recently, and I've read some codes of implementations of general CRFs such as CRF(Java), Mallet, CRFSuite. I found DGM is best for me, which is quite clearly in coding.

During studying the codes written by you, I come across some questions and want to bother you:
1. When adding/setting arcs in building a graph, why the edge potential is square rooted? (#186 and #196 in ./modules/DGM/Graph.cpp)
2. In message passing algorithms, why the new msg is double multiplied by edge potential? (#80 in ./modules/DGM/MessagePassing.cpp)

I tried to search for clues that may help answering the questions, but found nothing. I hope you may give me some hints, and thank you.

Thank you.

Creator
Posts: 157
Joined: Tue Dec 16, 2008, 20:52
Location: Hannover, Germany
Contact:

### Re: Mixed Graphical Models with DGM

Hello

thank you for interest to the DGM library.
Here are the answers to your questions:

1. The arc is the undirected edge in CRFs models. The DGM library emulates every undirected arc with two opposite-directed directed edges. Thus A -- B is represented with A -> B and A <- B. In the exact decoding, the potentials of every combination P(A, B) are calculated by multiplying node and edge potentials (please ref. to Demo 1D for more details: http://research.project-10.de/dgmdoc/a00020.html). Thus, when we have 2 edges, representing 1 arc, the potentials will be multiplied 2 times, instead of 1. That is the reason, why we extract the square root of the arc potential in addArc() and setArc() functions, but leave the edge potential unchanged in addEdge() and setEdge() functions. This allows the usage of both arcs and edges in the same model (like A -- B <- C)
2. Since we work with potentials, which are not exact probabilities, we have a small degree of freedom here in interpreting the message passing algorithm. We calculate the square of the pairwise potentials (i.e. directed edges in DGM) in approximate message-passing algorithms in order to provide the back-compatibility with the exact inference/decoding algorithms.

I hope these answers will help you win understanding the DGM library. Please, do not hesitate turning to me, in case you have more questions.

imyuliu

### Re: Mixed Graphical Models with DGM

Hi Dr.,

It's been a very long time since our last contact. I'm the guy reaching you by email. I see you've put my article's link in homepage. Thank you very much, not just for the link, but DGM, the foundation of my work/research.

I've been in a hard time last year. But now I'm getting better and am about to get my things together including my version of DGM. My version has changed a lot based on 2018's DGM code and specializes in a problem other than image processing, with GPU computing by CUDA. It has also been a far way behind the development of your DGM, too.

I hope I can collect my memory quickly and contribute to DGM in future. Thank you again, Dr..

Creator
Posts: 157
Joined: Tue Dec 16, 2008, 20:52
Location: Hannover, Germany
Contact:

### Re: Mixed Graphical Models with DGM

Hello,

It's been a very long time since our last contact. I'm the guy reaching you by email. I see you've put my article's link in homepage. Thank you very much, not just for the link, but DGM, the foundation of my work/research.

Thank you for your kind words. I am really happy that DGM library was useful for you!

I hope I can collect my memory quickly and contribute to DGM in future. Thank you again, Dr..

All the pull request are really welcome!