gco_python icon indicating copy to clipboard operation
gco_python copied to clipboard

Minor changes in the wrapper

Open shapovalov opened this issue 11 years ago • 8 comments

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

shapovalov avatar Jan 23 '13 16:01 shapovalov