Coder Social home page Coder Social logo

opengm / opengm Goto Github PK

View Code? Open in Web Editor NEW
409.0 409.0 206.0 10.85 MB

A C++ Library for Discrete Graphical Models

License: MIT License

CMake 2.45% C 0.01% C++ 77.59% MATLAB 0.58% Python 3.48% Shell 0.01% M 0.01% Jupyter Notebook 15.90% Objective-C 0.01%

opengm's Introduction

[UNMAINTAINED] OpenGM 2

Build Status


Forum / Newsgroup -> https://groups.google.com/forum/#!forum/opengm

Manual for OpenGM 2.0.2 -> http://hciweb2.iwr.uni-heidelberg.de/opengm/download/opengm-2.0.2-beta-manual.pdf

Code-Documentation for OpenGM 2.1.1 -> http://hciweb2.iwr.uni-heidelberg.de/opengm/doxygen/opengm-2.1.1/index.html

OpenGM is a C++ template library for discrete factor graph models and distributive operations on these models. It includes state-of-the-art optimization and inference algorithms beyond message passing. OpenGM handles large models efficiently, since (i) functions that occur repeatedly need to be stored only once and (ii) when functions require different parametric or non-parametric encodings, multiple encodings can be used alongside each other, in the same model, using included and custom C++ code. No restrictions are imposed on the factor graph or the operations of the model. OpenGM is modular and extendible. Elementary data types can be chosen to maximize efficiency. The graphical model data structure, inference algorithms and different encodings of functions interoperate through well-defined interfaces. The binary OpenGM file format is based on the HDF5 standard and incorporates user extensions automatically.

Features

Factor Graph Models (Kschischang et al. 2001)
    Graphs of any order and structure, from second order grid graphs to irregular higher-order models
    Arbitrary (commutative and associative) operations, including sum, product, conjunction and disjunction
    Flexible number of labels (different variables can have differently many labels)
    Function sharing across factors
    Function type abstraction. Different (built-in and custom) encodings can be used alongside each other
Functions
    Explicit function (multi-dimensional table)
    Sparse function (sparse multi-dimensional table)
    Potts functions (different types, including higher-order)
    Truncated absolute difference
    Truncated squared difference
    Views that treat one graphical model as a function within another graphical model
Algorithms
    Loopy Belief Propagation (Pearl 1988, Yedidia et al. 2000)
        parallel and sequential min-sum and max-product message passing (also for higher-order models)
        message damping (Wainwright 2008)
    Tree-reweighted Belief Propagation (TRBP) (Wainwright et al. 2005)
        parallel and sequential min-sum and max-product message passing (also for higher-order models)
        message damping (Wainwright 2008)
    A-star branch-and-bound search (Bergtholdt et al. 2009)
    Dual Decomposition
        With sub-gradient methods (Kappes et al. 2010)
        With bundle methods (Kappes et al. 2012)
        Automated decomposition of arbitrary factor graphs
        Arbitrary sub-solvers via templates
    Graph Cut (Boykov et al. 2001).
        Push-Relabel (Goldberg and Tarjan 1986)
        Edmonds-Karp (Edmonds and Karp 1972)
        Kolmogorov (Boykov and Kolmogorov 2004)
    QPBO
    MQPBO
    Linear Programming Relaxations over the Local Polytope
    TRWS
    ADSAL
    CombiLP
    Integer Linear Programming
    Multicut (Kappes et al. 2011)
    Fusion Moves for Correlation clustering (Beier et al. 2015)
    Cut & Glue and Cut (Beier et al. 2014)
    Reduced-Inference (Kappes et al. 2013)
    Alpha-Expansion
    Alpha-Beta-Swap
    Alpha-Fusion
    Inf and Flip
    Iterated Conditional Modes (ICM) (Besag 1986)
    Lazy Flipper (Andres et al. 2010)
    Kerninghan Lin
    MCMC Metropolis-Hastings algorithms (Metropolis et al. 1953)
        Gibbs sampling (Geman and Geman 1984)
        Swendsen-Wang sampling (Swendsen and Wang 1987)
    Wrappers around other graphical model libraries
        MRF-LIB
        LIB-DAI
        TRW-S
        QPBO
        GCO
        FastPD
        AD3
        DAOOPT
        MPLP, MPLP-C
Binary HDF5 file format
Command Line Optimizer with built-in protocol mode for runtime and convergence analyses
Python Module with OpenGM C++ API exported to Python with boost::python
    Allmost the complete C++ API is exported to Python
    Allmost all C++ inference algorithms wrapped to Python
    Vectorized API to add multiple functions and factors at once
    Add functions via numpy ndarrays
    Add functions via all default opengm function types
    Extendibility through interfaces for
        custom pure python function types
        custom pure python visitor for inference
            visualization of current inference state with matplotlib 
    Visualize Factor Graph (needs networkx and graphviz)
High performance
    Graphical models with more than 10,000,000 factors
    Specialized functions for optimized cache usage
Extendibility through interfaces for
    custom algorithms
    custom functions
    custom label spaces

How to cite OpenGM?

@Article{opengm-library,
  author    = {Andres, B. and Beier, T. and Kappes, J.H.},
  title     = {{OpenGM}: {A} {C++} Library for Discrete Graphical Models},
  journal   = {CoRR},
  volume    = {abs/1206.0111},
  year      = {2012},
  url       = {http://arxiv.org/abs/1206.0111}
}
@Article{opengm-benchmark,
  Title                    = {A Comparative Study of Modern Inference Techniques for Structured Discrete Energy Minimization Problems},
  Author                   = {Kappes, J\"orgH. and Andres, Bjoern and Hamprecht, FredA. and Schn\"orr, Christoph and Nowozin, Sebastian and Batra, Dhruv and Kim, Sungwoong and Kausler, BernhardX. and Kr\"oger, Thorben and Lellmann, Jan and Komodakis, Nikos and Savchynskyy, Bogdan and Rother, Carsten},
  Journal                  = {International Journal of Computer Vision},
  Year                     = {2015},
  Number                   = {2},
  Pages                    = {155-184},
  Volume                   = {115},
  Doi                      = {10.1007/s11263-015-0809-x},
  ISSN                     = {0920-5691},
  Language                 = {English},
  Publisher                = {Springer US}
}

opengm/opengm - master

Build Status

DerThorsten/opengm - master (opengm-python dev.)

Build Status

Copyright (C) 2012 Bjoern Andres, Thorsten Beier and Joerg H.~Kappes.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

opengm's People

Contributors

alexander-kirillov avatar amueller avatar bjoern-andres avatar bluescarni avatar burcin avatar cerquide avatar chaubold avatar constantinpape avatar derthorsten avatar erotemic avatar fftobiwan avatar fgrsnau avatar ghisvail avatar herr-biber avatar homul avatar ilastikdev avatar jasjuang avatar jensnrad avatar joergkappes avatar kljohann avatar opengm avatar sstefan avatar steffen-wolf avatar stopfer avatar stuarteberg avatar ukoethe avatar vene avatar xinwf avatar yanlend avatar yunesj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opengm's Issues

Problem with initialization of inference

Hey everybody.
I've been talking with Thorsten a bit, but I'm not sure this is a Python related issue.
I try to initialize LF or Gibbs with some result from another methd (not in opengm) and try to improve it.
Unfortunately, the energy gets larger (worse).
I have no idea what I'm doing wrong.
Excerpt

ipdb> inference    # setStartingPoint(init) was called
<abc.Gibbs object at 0xf55e590>
ipdb> inference.accumulator
'minimizer'
ipdb> p init
array([14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
       14, 14, 14, 14], dtype=uint64)
ipdb> gm.evaluate(init)
-43.20207977294922
ipdb> inference.arg()
array([12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
       12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
       12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
       11, 11, 11, 11], dtype=uint64)
ipdb> gm.evaluate(inference.arg())
-42.297019958496094

For lazy flipper I even get

ipdb> gm.evaluate(lf.arg())
-39.21513366699219

I though I had the signs wrong but it doesn't look like I did (tripple checked ;)

Any hints would be much appreciated!
Thanks!

Additional info: gm is a pairwise model with custom pairwise potentials.

makeExternalLibs

had to remove ad3,trws qpbo from make external libs since travis had problems
with dowloading ad3.

We should refactor the "make externalLibs" part asap!

Estimating weights of functions

Hello there,

I am using @opengm python binding for modeling Conditional Random Fields. Besides with inference, does @opengm support estimating weights for each function, i.e., parameter estimation step?

I found a line in @opengm python binding that seems to be used to estimate parameter (line #10 in the file src/interfaces/python/example/inference_bp.py)

opengm.InfParam(steps=10,damping=0.5,convergenceBound=0.001)

Could you please confirm this is the function used to estimate parameters? If @opengm does not support parameter estimation, can I use other libraries such as libDAI or FastInf for estimating parameter, then use @opengm to do inference?

Thank you.

NODEPTR_BLOCK_SIZE

NODEPTR_BLOCK_SIZE is first defined in
/src/external/MRF-v2.1.src-patched/graph.h
and then again in
./src/external/QPBO-v1.3.src-patched/QPBO.h
which leads to compiler error

Compile error building master

Hey everybody.
I just checked out master and got the following error when I tried to compile:

/home/local/lamueller/checkout/opengm/src/interfaces/python/opengm/opengmcore/opengmcore.cpp:46: error: reference to ‘IndexVectorVectorType’ is ambiguous
/home/local/lamueller/checkout/opengm/src/interfaces/python/opengm/export_typedes.hxx:15: error: candidates are: typedef class opengm::python::IndexVectorVectorType IndexVectorVectorType
/home/local/lamueller/checkout/opengm/include/opengm/python/opengmpython.hxx:92: error:                 typedef class std::vector<std::vector<long long unsigned int, std::allocator<long long unsigned int> >, std::allocator<std::vector<long long unsigned int, std::allocator<long long unsigned int> > > > opengm::python::IndexVectorVectorType

Any help would be much appreciated.

GCO does not compile

If I enable WITH_GCO i get compiler erros:

/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:33:23: warning: ‘GCO_CLOCKS_PER_SEC’ initialized and declared ‘extern’ [enabled by default]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:33:23: warning: ‘GCO_CLOCKS_PER_SEC’ initialized and declared ‘extern’ [enabled by default]
In file included from /home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.h:109:0,
from /home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:4:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h: In instantiation of ‘int gcoLib::Energy<captype, tcaptype, flowtype>::get_var(gcoLib::Energy<captype, tcaptype, flowtype>::Var) [with captype = double; tcaptype = double; flowtype = double; gcoLib::Energy<captype, tcaptype, flowtype>::Var = int]’:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:199:20: required from here
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:330:91: error: ‘what_segment’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:330:91: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:330:91: note: use ‘this->what_segment’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h: In instantiation of ‘void gcoLib::Energy<captype, tcaptype, flowtype>::add_term1(gcoLib::Energy<captype, tcaptype, flowtype>::Var, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value) [with captype = double; tcaptype = double; flowtype = double; gcoLib::Energy<captype, tcaptype, flowtype>::Var = int; gcoLib::Energy<captype, tcaptype, flowtype>::Value = double]’:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:282:22: required from here
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:209:2: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:209:2: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:209:2: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h: In instantiation of ‘void gcoLib::Energy<captype, tcaptype, flowtype>::add_term2(gcoLib::Energy<captype, tcaptype, flowtype>::Var, gcoLib::Energy<captype, tcaptype, flowtype>::Var, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value) [with captype = double; tcaptype = double; flowtype = double; gcoLib::Energy<captype, tcaptype, flowtype>::Var = int; gcoLib::Energy<captype, tcaptype, flowtype>::Value = double]’:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:306:42: required from here
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:222:2: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:222:2: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:222:2: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:237:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:237:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:237:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:238:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:238:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:238:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:239:3: error: ‘add_edge’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:239:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:239:3: note: use ‘this->add_edge’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:247:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:247:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:247:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:248:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:248:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:248:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:249:3: error: ‘add_edge’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:249:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:249:3: note: use ‘this->add_edge’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:253:3: error: ‘add_edge’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:253:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:253:3: note: use ‘this->add_edge’ instead
In file included from /home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.h:109:0,
from /home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:4:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h: In instantiation of ‘int gcoLib::Energy<captype, tcaptype, flowtype>::get_var(gcoLib::Energy<captype, tcaptype, flowtype>::Var) [with captype = double; tcaptype = double; flowtype = double; gcoLib::Energy<captype, tcaptype, flowtype>::Var = int]’:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:199:20: required from here
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:330:91: error: ‘what_segment’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:330:91: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:330:91: note: use ‘this->what_segment’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h: In instantiation of ‘void gcoLib::Energy<captype, tcaptype, flowtype>::add_term1(gcoLib::Energy<captype, tcaptype, flowtype>::Var, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value) [with captype = double; tcaptype = double; flowtype = double; gcoLib::Energy<captype, tcaptype, flowtype>::Var = int; gcoLib::Energy<captype, tcaptype, flowtype>::Value = double]’:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:282:22: required from here
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:209:2: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:209:2: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:209:2: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h: In instantiation of ‘void gcoLib::Energy<captype, tcaptype, flowtype>::add_term2(gcoLib::Energy<captype, tcaptype, flowtype>::Var, gcoLib::Energy<captype, tcaptype, flowtype>::Var, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value, gcoLib::Energy<captype, tcaptype, flowtype>::Value) [with captype = double; tcaptype = double; flowtype = double; gcoLib::Energy<captype, tcaptype, flowtype>::Var = int; gcoLib::Energy<captype, tcaptype, flowtype>::Value = double]’:
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/GCoptimization.cpp:306:42: required from here
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:222:2: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:222:2: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:222:2: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:237:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:237:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:237:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:238:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:238:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:238:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:239:3: error: ‘add_edge’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:239:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:239:3: note: use ‘this->add_edge’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:247:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:247:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:247:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:248:3: error: ‘add_tweights’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:248:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:248:3: note: use ‘this->add_tweights’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:249:3: error: ‘add_edge’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:249:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:249:3: note: use ‘this->add_edge’ instead
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:253:3: error: ‘add_edge’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:253:3: note: declarations in dependent base ‘gcoLib::Graph<double, double, double>’ are not found by unqualified lookup
/home/tbeier/src/DerThorsten/opengm/src/external/GCO-v3.0.src-patched/energy.h:253:3: note: use ‘this->add_edge’ instead
make[2]: *** [src/external/CMakeFiles/external-library-gco-shared.dir/GCO-v3.0.src-patched/GCoptimization.cpp.o] Error 1

Generic Python inference interface

implement generic inference interface for python that use the opengm-callers to directly get naive support to new methods automatically.

GCO Patch doesn't work correctly

make externalLibs returns chunk failed errors on a number of libraries. This might not be a big deal in some cases (e.g. the underlying library was already updated to const char), on GCO however it fails quite badly. The GCoptimization.h file needs to close the gcoLib namespace before including ctime, however the patch fails to add these lines, causing troublesome compilation errors.

FactorGraph does not use IndexType

GraphicalModel is derived from FactorGraph, and in FactorGraph size_t is used insead of IndexType !

This can give compilation errors.
( I implemented a hotfix to make pyReducedInference work again)

QPBO licensing

Hey everybody. Sorry for abusing the issue tracker for a question (again).
I noticed you are fetching QPBO from Vladimir's website. I imagine that is for licensing reasons.
The website and code don't state any licensing terms. Have you asked him about that?

Thanks,
Andy

exception has incorrect error message

On line 57 of /include/opengm/graphicalmodel/space/space_base.hxx:

throw RuntimeError(std::string("assignDense(begin, end) is not implemented in ")+typeid(SPACE).name());

should be

throw RuntimeError(std::string("addVariable(begin, end) is not implemented in ")+typeid(SPACE).name());

TRW Initialization

After observing random behavior with the TRW S/BP solver, I spent quite some time looking for the cause.
I was lucky enough to spot it after a day of debugging, so I thought I'd share it.

The problem appears to be a wrong (or non) initialization of memory blocks for the messages. After inserting

ZeroMessages();

into the minimization function Minimize_TRW_S and Minimize_BP respectively in the file TRWS-v1.3.src-patched/minimize.cpp, the problem seems to be gone.

I'm not sure it it's a bug, but it should definitely be looked into or fixed in the next released.

I am using ubuntu with
gcc version 4.6.3
or
gcc version 4.4.7

Best,
Anton

Factor asserts -> exceptions

change

  • test if variableIDs are orderd
  • test if functionshape fits space
    from assert to exception in addFactor.

This is a common pitfall for users, and might cause strange behaviour in the release mode.

If this is done, change default mode to RELEASE in CMAKE and set DEBUG mode fix for tests.

Inference initialization

Let's say that I know that the graph model that I want to solve has a cost function with many local minima. Say also that I can compute pretty quickly an approximate solution not too far from the global minimum. Is there a way initialize any of the OpenGM inference algorithms with this information?

Qpbo external does not compile with Clang++

Qpbo external still does not compile with clang Clang Error:

/opengm/src/external/QPBO-v1.3.src-patched/instances.inc:30:28: error: explicit specialization of 'get_type_information' after instantiation inline void QPBO::get_type_information(char_& type_name, char_& type_format)

MacOS X test failures and Python wrapper crash

Hi all,

Thanks for the great work, unfortunately I still didn't get it to run.

In the mean time I installed Anaconda (so I have a different version of Python), and because of this I needed to manually build boost and boost-python (which proved straightforward).

However I get (after the trivial CMake fix) the exact same crash when importing the python wrapper (note that this happens DURING the build when sphinx tries to import it, but also if I try to disable sphinx, let it get installed and import it manually, it's still there):

Fatal Python error: PyThreadState_Get: no current thread
/bin/sh: line 1: 65897 Abort trap: 6           /anaconda/bin/sphinx-build (...)

I'm not even sure how to start to debug this but I will try.

At the same time I have some errors in the unit tests, they appear unrelated:

Transport solver failure:
terminate called after throwing an instance of 'std::runtime_error'
  what():  OpenGM assertion initTest(solver,a,b,bin,0.7494820823) failed in file /Users/vene/code/opengm/src/unittest/test_transportsolver.cpp, line 639

[1]    63568 abort      ./test-transportsolver

./test-astar
terminate called after throwing an instance of 'std::logic_error'
  what():  !exceptionFlag does not hold [line 113]
./test-graphcut
terminate called after throwing an instance of 'std::logic_error'
  what():  !exceptionFlag does not hold [line 113]
./test-lazyflipper
terminate called after throwing an instance of 'std::logic_error'
  what():  !exceptionFlag does not hold [line 113]

Cheers,
Vlad

Relevant flaw in Inference

I am trying to use OpenGM over the sum product semiring. It seems that most of the testing has focused on idempotents semirings. If I am not wrong, the code at class Inference (the core of openGM) returning the value of the inference engine is buggy when applied to non idempotent semirings.

template<class GM, class ACC>
typename GM::ValueType
Inference<GM, ACC>::value() const 
{
   std::vector<LabelType> s;
   const GM& gm = graphicalModel();
   if(NORMAL == arg(s)) {
      return gm.evaluate(s);
   }
   else {
      return ACC::template neutral<ValueType>();
   }
}

Also the Bruteforce infer method is flawed

template<class GM, class AKK>
template<class VISITOR>
InferenceTermination
Bruteforce<GM, AKK>::infer
(
   VISITOR & visitor
)
{
   std::vector<LabelType> states(gm_.numberOfVariables());
   std::vector<IndexType> vi(gm_.numberOfVariables());
   for(size_t j=0; j<gm_.numberOfVariables(); ++j) {
       vi[j] = j;
   }
   energy_ = movemaker_.move(vi.begin(), vi.end(), states.begin());
   visitor.begin(*this, energy_, energy_);
   for(;;) {
      ValueType energy = movemaker_.move(vi.begin(), vi.end(), states.begin());
      if(AccumulationType::bop(energy , energy_)) {
         visitor(*this, energy, energy);
         energy_ = energy;
         states_ = states;
      }
      bool overflow = true;
      for(size_t j=0; j<gm_.numberOfVariables(); ++j) {
         if( size_t(states[j]+1) < size_t(gm_.numberOfLabels(j))) {
            ++states[j];
            for(size_t k=0; k<j; ++k) {
               states[k] = 0;
            }
            overflow = false;
            break;
         }
      }
      if(overflow) {
         break;
      }
   }
   visitor.end(*this, energy_, energy_);
   return NORMAL;
}

although there is an easy fix for this one I think:

template<class GM, class AKK>
template<class VISITOR>
InferenceTermination
Bruteforce<GM, AKK>::infer
(
   VISITOR & visitor
)
{
   std::vector<LabelType> states(gm_.numberOfVariables());
   std::vector<IndexType> vi(gm_.numberOfVariables());
   for(size_t j=0; j<gm_.numberOfVariables(); ++j) {
       vi[j] = j;
   }
   energy_ = movemaker_.move(vi.begin(), vi.end(), states.begin());
   visitor.begin(*this, energy_, energy_);
   for(;;) {
      ValueType energy = movemaker_.move(vi.begin(), vi.end(), states.begin());
      if(AccumulationType::bop(energy , energy_)) {
         visitor(*this, energy, energy);
         states_ = states;
      }
      AccumulationType::op(energy, energy_);
      bool overflow = true;
      for(size_t j=0; j<gm_.numberOfVariables(); ++j) {
         if( size_t(states[j]+1) < size_t(gm_.numberOfLabels(j))) {
            ++states[j];
            for(size_t k=0; k<j; ++k) {
               states[k] = 0;
            }
            overflow = false;
            break;
         }
      }
      if(overflow) {
         break;
      }
   }
   visitor.end(*this, energy_, energy_);
   return NORMAL;
}

Fixing the value method at the Inference class has some impact on the design so I leave the decision to someone with a higher knowledge of the library. I think that the problem is very relevant because it does also impact the correctness of the tests of BP that evaluate the algorithm on different semirings.

I am still learning how to use the library, so I apologize if I am mistaken.

Numerical issues in MacOS C++ tests

The failing tests when I run make test:

         20 - test-transportsolver (OTHER_FAULT)
         28 - test-loc (Not Run)
         31 - test-lazyflipper (OTHER_FAULT)
         34 - test-astar (OTHER_FAULT)
         37 - test-graphcut (OTHER_FAULT)

test-loc is filtered out because I don't link to AD3 so it doesn't count.

As for transportsolver, the offending line is this one, and I edited the source to see what's wrong and I get (consistently) 0.592621 instead of 0.7494820823. Hmm, that's off by quite a bit.
All other assertions in the file pass.

In the inference tests I find it much harder to find where (what model parameters etc) the failures occur with, but I can provide the test output around the failure.

Lazyflipper fails with:

  * Minimization/Adder  ...
    - 2nd order grid model with 9 variables and 2 states (functionType = potts with unary ) *value = 8.45673  ,  bound = -inf
8.45673 != 8.3981 [line 94: gm.evaluate(state) == gm.evaluate(optimalState) ]

A* fails with:

* Minimization/Adder with standart heuristic ...
    [ ... ]
    - 2nd order full model with 5 variables and 2 states (functionType = random with unary ) *value = 25.431  ,  bound = 25.431
25.431 != 25.3581 [line 94: gm.evaluate(state) == gm.evaluate(optimalState) ]
terminate called after throwing an instance of 'std::logic_error'

Graph-cut fails with:

  * Test Max-Sum with Integer-BOOST-Push-Relabel
    - 2nd order grid model with 16 variables and 2 states (functionType = negative potts with unary ) *value = 14.9299  ,  bound = inf
14.9299 != 15.0342 [line 94: gm.evaluate(state) == gm.evaluate(optimalState) ]

Python Wrapper TODOS

  • write wrapper for dd-bundle (needs conic-bundle to be recompiled with -fPic)
  • write wrapper for GCO
  • finish wrapper for reducedInference: ( almost done)
    • cplex and trws are added as subsolvers
    • add more subsolvers
  • add Ibfs maxflow to alpha expansion and alpha beta swap

Clean Up CMAKE (RC 2.1)

  • use cmake GET and PATCH for external code
  • check installscripts (also for matlab and python interface)
  • update FIND-scripts
  • check compartibility for Linux, Windows and MacOS
  • other cleanups

[python] refactor inf_def_visitor.hxx

inf_def_visitor.hxx / InfSuite<...> has some ugly hacks to inject solver related information This might be the reason for some MACOS errors
A extra exported class for each solver with all meta information might do the trick
but that would be a lot of work.

dualdecomposition fails on 32 bit machine but not on 64 bit machine

On my 32 bit computer the following assertion fails:

OpenGM assertion temp(i)<0.0000001 && temp(i)>-0.00000001 failed in file /home/tbeier/src/privat/matlab-python/opengm-intern/include/opengm/inference/dualdecomposition/dddualvariableblock.hxx, line 96

On a 64 bit machine this assertion never failed!
Setting the values to
temp(i)<0.00001 && temp(i)>-0.00001
does not help on 32 bit machine.

OpenGM Matlab interface

Matlab interface ist still in a beta state:

  • needs some tests
  • rename mex-files (use meaningful prefix like opengm_mex_xxxx
  • copy examples how to generate models for larger data directly and fast into the matlab-src-folder

maxflow warnings

There are still some important warnings in Maxflow external which should be fixed.
An example is:

opengm/src/external/MaxFlow-v3.02.src-patched/maxflow.cpp:367:16:
note: place parentheses around the assignment to silence this warning
if (i->parent = a0_min)

merge DerThorsten/opengm -b RC2.1 to opengm/opengm -bRC2.1

I check out opengm/opengm -b RC2.1 and merged "internal" matlab-python into my fork by hand. (but only the python part, i did not merged src/matlab )
Now my fork ([email protected]:DerThorsten/opengm.git , branch RC2.1 ) should be merged in master!
This should be done soon , otherwise someone might use the old python wrapper!

Missing submodel_builder.hxx in loc.hxx

opengm/inference/auxiliary/submodel/submodel_builder.hxx
was deleted at

commit 3c202a1 "removed unused files"

but still used in include/opengm/inference/loc.hxx:

include "opengm/inference/auxiliary/submodel/submodel_builder.hxx"

then I can't compile sources with WITH_AD3 now.

Numpy headers

I open a new issue for this. I think Thorsten will comment on it.

Another thing that might be useful to address for python users is that Numpy headers are usually not in the python include dir. I addressed it by adding the compiler flag -I/.../site_packages/numpy/core/include but ideally there would be a field with some hints for autodetection, right? This is my first contact with CMake but I can try to help.

Vlad

graph cut unit test fails with clang

graph cut unit test fails with clang.
Except for that clang build is fine (in my fork)

37: OPTIMAL!
37: * Test Max-Sum with Integer-BOOST-Push-Relabel
37: - 2nd order grid model with 16 variables and 2 states (functionType = negative potts with unary ) value = 15.0048 , bound = inf
37: OPTIMAL!
37: - 2nd order grid model with 9 variables and 2 states (functionType = negative potts with unary ) *value = 8.44018 , bound = inf
37: *value = 8.44018 , bound = inf
37: *value = 7.11042 , bound = inf
37: OPTIMAL!
37: - 2nd order grid model with 9 variables and 2 states (functionType = negative potts without unary ) *value = 0 , bound = inf
37: *value = 0 , bound = inf
37: *value = 0 , bound = inf
37: OPTIMAL!
37: - 2nd order star model with 5 variables and 2 states (functionType = negative potts with unary ) *value = 9.65443 , bound = inf
37: *value = 9.65443 , bound = inf
37: *value = 8.8336 , bound = inf
37: OPTIMAL!
37: - 2nd order full model with 5 variables and 2 states (functionType = negative potts with unary ) *value = 9.65443 , bound = inf
37: 9.65443 != 1.1068e+20 [line 94: gm.evaluate(state) == gm.evaluate(optimalState) ]
37: terminate called after throwing an instance of 'std::logic_error'
37: what(): !exceptionFlag does not hold [line 113]
37/47 Test 37: test-graphcut ....................
**Exception: Other 2.71 sec

Mailing list and other questions

Is there a mailing list for discussion of user issues, etc.? I am coding a Markov Random Field with non-Gaussian priors and I'm trying to use a custom Function for that. What is the meaning of the

size_t size();

member function? Also, is it possible to define a custom function with data-dependent terms? The example in interpixel_boundary_segmentation.cxx define a custom function that depends only only on graph variables.

Compilation problem on RC2.1

Hey everybody.
I tried using the RC2.1 on Thorsten's fork and get the following error:

[ 90%] Building CXX object src/unittest/inference/CMakeFiles/test-graphcut.dir/test_graphcut.cxx.o
In file included from /home/user/amueller/checkout/opengm/include/opengm/inference/auxiliary/minstcutibfs.hxx:7,
                 from /home/user/amueller/checkout/opengm/src/unittest/inference/test_graphcut.cxx:26:
/home/user/amueller/checkout/opengm/include/../src/external/ibfs.src-patched/ibfs.h: In instantiation of ‘IBFSGraph<float, float, float>::arc’:
/home/user/amueller/checkout/opengm/include/../src/external/ibfs.src-patched/ibfs.h:154:   instantiated from ‘void IBFSGraph<captype, tcaptype, flowtype>::add_edge(int, int, captype, captype) [with captype = float, tcaptype = float, flowtype = float]’
/home/user/amueller/checkout/opengm/include/opengm/inference/auxiliary/minstcutibfs.hxx:69:   instantiated from ‘void opengm::external::MinSTCutIBFS<NType, VType>::addEdge(NType, NType, VType) [with NType = long unsigned int, VType = float]’
/home/user/amueller/checkout/opengm/include/opengm/inference/graphcut.hxx:358:   instantiated from ‘opengm::InferenceTermination opengm::GraphCut<GM, ACC, MINSTCUT>::infer(VISITOR&) [with VISITOR = opengm::EmptyVisitor<opengm::GraphCut<opengm::GraphicalModel<float, opengm::Adder, opengm::meta::TypeList<opengm::ExplicitFunction<float, long unsigned int, long unsigned int>, opengm::meta::ListEnd>, opengm::DiscreteSpace<long unsigned int, long unsigned int>, false>, opengm::Minimizer, opengm::external::MinSTCutIBFS<long unsigned int, float> > >, GM = opengm::GraphicalModel<float, opengm::Adder, opengm::meta::TypeList<opengm::ExplicitFunction<float, long unsigned int, long unsigned int>, opengm::meta::ListEnd>, opengm::DiscreteSpace<long unsigned int, long unsigned int>, false>, ACC = opengm::Minimizer, MINSTCUT = opengm::external::MinSTCutIBFS<long unsigned int, float>]’
/home/user/amueller/checkout/opengm/include/opengm/inference/graphcut.hxx:350:   instantiated from ‘opengm::InferenceTermination opengm::GraphCut<GM, ACC, MINSTCUT>::infer() [with GM = opengm::GraphicalModel<float, opengm::Adder, opengm::meta::TypeList<opengm::ExplicitFunction<float, long unsigned int, long unsigned int>, opengm::meta::ListEnd>, opengm::DiscreteSpace<long unsigned int, long unsigned int>, false>, ACC = opengm::Minimizer, MINSTCUT = opengm::external::MinSTCutIBFS<long unsigned int, float>]’
/home/user/amueller/checkout/opengm/include/opengm/unittests/blackboxtester.hxx:65:   instantiated from ‘void opengm::InferenceBlackBoxTester<GM>::test(const typename INF::Parameter&, bool, bool, bool, bool) [with INF = opengm::GraphCut<opengm::GraphicalModel<float, opengm::Adder, opengm::meta::TypeList<opengm::ExplicitFunction<float, long unsigned int, long unsigned int>, opengm::meta::ListEnd>, opengm::DiscreteSpace<long unsigned int, long unsigned int>, false>, opengm::Minimizer, opengm::external::MinSTCutIBFS<long unsigned int, float> >, GM = opengm::GraphicalModel<float, opengm::Adder, opengm::meta::TypeList<opengm::ExplicitFunction<float, long unsigned int, long unsigned int>, opengm::meta::ListEnd>, opengm::DiscreteSpace<long unsigned int, long unsigned int>, false>]’
/home/user/amueller/checkout/opengm/src/unittest/inference/test_graphcut.cxx:66:   instantiated from here
/home/user/amueller/checkout/opengm/include/../src/external/ibfs.src-patched/ibfs.h:56: error: bit-field ‘float IBFSGraph<float, float, float>::arc::rCap’ with non-integral type
make[2]: *** [src/unittest/inference/CMakeFiles/test-graphcut.dir/test_graphcut.cxx.o] Error 1
make[1]: *** [src/unittest/inference/CMakeFiles/test-graphcut.dir/all] Error 2
make: *** [all] Error 2

Any help would be much appreciated.
This is on 64bit Ubuntu 12.10 with all external libraries, boost and python.

compile error with WITH_FASTPD

/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:949:10: error: expected unqualified-id before ‘double’
/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:949:10: error: expected ‘)’ before ‘double’
/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:949:10: error: expected ‘)’ before ‘double’
/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:949:10: error: expected ‘)’ before ‘double’
/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:950:10: error: expected unqualified-id before ‘double’
/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:950:10: error: expected ‘)’ before ‘double’
/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:950:10: error: expected ‘)’ before ‘double’
/home/tbeier/src/DerThorsten/opengm/src/external/FastPD.src-patched/Fast_PD.h:950:10: error: expected ‘)’ before ‘double’

Simplify Visitors

Visitors has become to complicated and need to be reimplemented/simplified.

They should only have the interface

begin(INF&)
(INF&)
end(INF&)

everything else should be done by specialisations and not by overloading this functions.

Very slow BP on 1-D MRF

To get myself familiar with OpenGM, I wrote an application where I build a simple 1-D Markov Random Field with 20 variables, smoothing factors between adjacent variables (SquaredDifferenceFunction) and unary factors for each variable using a user defined Function Type. Belief Propagation takes about 12 min (!) to run, so it seems that there is something wrong. I am wondering if the reason is in the user defined Function Type. Do you have any ideas about what I should look into?

Thanks!

Can't compile commandline/double/opengm_min_sum_libdai.cxx (Master)

I'm trying to compile the entire package with all the libraries and have found a few issues. One of them is when I try to compile commandline/double/opengm_min_sum_libdai.cxx the compiler complains about the TimingVisitor not accepting 6 arguments. I tried deleting the extra argument in inference_caller_base.hxx, but then it complained about protocolMap_ .

There seems like a conflict between visitor.hxx and new_visitors.hxx , I tried to converting it to new_visitors.hxx in libdai/inference.hxx , but this turned out to be quite time consuming.

Hdf5 Problems

So far we designed hdf5 IO in this way:
One has a gm with a typelist TL(A,B,C) and one saves the gm.

So now one tries to load into a gm with TL ( A,B,C,) or TL(A,B,C,D) or a permutation
which is fine.

But lets assume that the saved gm has only instances of function type A
( no instance of B and D)

If one tries to load this gm into am gm with TL(A) it fails
Since it is assumed, if one saves a graphical model, the user is will use ALL function types from TL.
So we assumed, if one has a TL (A,B,C) , that there are instances of A and B and C and that it is nonsense to try to load that into a gm with TL(A).

But with matlab and python interface this is just wrong to assume.

I already pushed a possible fix to my fork (DerThorsten/opengm -b RC2.1)
But I need to test this!!!

The fix is, ignore function types without instances while loading them

can't compile with both of MRF-lib and GCO at the same time

Because MRF-lib and GCO has different "GCoptimization.h" (same name, but different), I receive a lot of errors (depending of header path order) when I include the following headers in the same cpp file:

include <opengm/inference/external/gco.hxx>

include <opengm/inference/external/mrflib.hxx>

Possible solutions are:

  • rename GCO/GCoptimization.h to something
  • rename MRF/GCoptimization.h to something
  • and make a corresponding patch, or write some lines of shell script to add
  • or, do not recommend to use both at the same time

A patch renaming a file may be too large.
Renaming file with a small patch might be better.

add (minimal) doxygen to PottsGFunction

I want to write docu for python for PottsGFunction but since there is no documentation PottsGFunction and it is not that self explanatory I cannot do this.

Provide support for conditional queries

Conditional map queries such as

argmax_{x} P(X=x|Y=y)

are very common in applications. Currently OpenGM only supports map queries like argmax_{z} P(Z=z). The only way I see for answering conditional map queries using openGM is by doing a two step procedure:

  1. Create a new GM where the factors are reduced based on Y=y using (for example) ViewFixVariablesFunction.
  2. Run the inference algorithm of your choice on the resulting GM.

Since they are commonly used queries, it would be good that this (or a better) procedure is provided by the library instead of being leaving this work to the users.

Inversibility assumption in movemaker

The movemaker class seems to be constrained to graphical models over inversible monoids. In the code below, the two lines near the end calling op and iop will only be correct provided that the every element in ValueType has an inverse.

In particular, for probability distributions factorized as products this implies that the movemaker class can only be applied to non-zero potentials, when a factor has a zero in it, movemaker (and hence Bruteforce) does not work.

A way out will be making iop throw a NonInversibleElementException and using a full recomputation when the exception in catched.

template<class GM>
template<class IndexIterator, class StateIterator>
typename Movemaker<GM>::ValueType
Movemaker<GM>::valueAfterMove
(
   IndexIterator begin,
   IndexIterator end,
   StateIterator destinationState
) {
   // set stateBuffer_ to destinationState, and determine factors to recompute
   std::set<size_t> factorsToRecompute;
   for (IndexIterator it = begin; it != end; ++it, ++destinationState) {
      OPENGM_ASSERT(*destinationState < gm_.numberOfLabels(*it));
      if (state_[*it] != *destinationState) {
         OPENGM_ASSERT(*destinationState < gm_.numberOfLabels(*it));
         stateBuffer_[*it] = *destinationState;
         std::set<size_t> tmpSet;
         std::set_union(factorsToRecompute.begin(), factorsToRecompute.end(),
            factorsOfVariable_[*it].begin(), factorsOfVariable_[*it].end(),
            std::inserter(tmpSet, tmpSet.begin()));
         factorsToRecompute.swap(tmpSet);
      }
   }
   // \todo consider buffering the values of ALL factors at the current state!
   ValueType destinationValue = energy_;
   for (std::set<size_t>::const_iterator it = factorsToRecompute.begin(); it != factorsToRecompute.end(); ++it) {
      OPENGM_ASSERT(*it < gm_.numberOfFactors());
      // determine current and destination state of the current factor
      std::vector<size_t> currentFactorState(gm_[*it].numberOfVariables());
      std::vector<size_t> destinationFactorState(gm_[*it].numberOfVariables());
      for (size_t j = 0; j < gm_[*it].numberOfVariables(); ++j) {
         currentFactorState[j] = state_[gm_[*it].variableIndex(j)];
         OPENGM_ASSERT(currentFactorState[j] < gm_[*it].numberOfLabels(j));
         destinationFactorState[j] = stateBuffer_[gm_[*it].variableIndex(j)];
         OPENGM_ASSERT(destinationFactorState[j] < gm_[*it].numberOfLabels(j));
      }
      OperatorType::op(destinationValue, gm_[*it](destinationFactorState.begin()), destinationValue);
      OperatorType::iop(destinationValue, gm_[*it](currentFactorState.begin()), destinationValue);
   }
   // restore stateBuffer_
   for (IndexIterator it = begin; it != end; ++it) {
      stateBuffer_[*it] = state_[*it];
   }
   return destinationValue;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.