amueller/gco_python — pull request #7 by shapovalov (2013-01-23 16:15:50+00:00)
Title: Minor changes in the wrapper

Hi Andreas,

I needed a more general wrapper for the GCO library, so I made several changes:

1) GCO allows to redefine the energy type used, and the floating-point energy is often useful. In theory, it may work much slower (since augmenting-path max-flow algorithms are inherently designed for integer capacities), but is often OK in practice. Now, changing one compile-time definition in gco_python.pyx sets the type.

2) I’ve added pairwise potential callbacks to the C++ wrapper, so that
arbitrary pairwise potential suitable for expansion/swap can be specified. I thought that this was the only way to implement the generalized Potts potentials (i.e. that vary across edges), but later I noticed that for general graphs I can specify the edge weights.
However, this feature is still can be useful for anyone who needs more general pairwise potentials (e.g. associative potentials that are learned separately for different labels).

I don’t know if your consider those changes useful. Please look at the diffs. Also, I am new to Cython, so some code may be not idiomatic or look stupid.

Regards,
Roman