Coder Social home page Coder Social logo

gco_python's Introduction

pygco

travis status

Python wrappers for GCO alpha-expansion and alpha-beta-swaps. These wrappers provide a high level interface for graph cut inference for multi-label problems.

See my blog for examples and comments: peekaboo-vision.blogspot.com

Installation

With Pip

  • Run pip install git+git://github.com/amueller/gco_python

For Linux

  • Download and install Cython (use your package manager).

  • run make

  • Run example.py for a simple example.

For Windows

  • Make sure Cython is installed (included in enthought Python distribution for example)

  • Download original source from http://vision.csd.uwo.ca/code/gco-v3.0.zip

  • Build gco with your compiler of choice. Create a dynamic library at libgco.so.

  • Adjust the path to gco in setup.py.

  • run python setup.py build.

  • run example.py for a simple example.

Troubleshooting

There have been some problems compiling gco (not my wrappers) using gcc4.7. Please install gcc-4.6 and adjust the call in Makefile accordingly.

Usage

GCO implements alpha expansion and alpha beta swaps using graphcuts. These can be used to efficiently find low energy configurations of certain energy functions. Note that from a probabilistic viewpoint, GCO works in log-space.

Note that all input arrays are assumed to be in int32. This means that float potentials must be rounded!

These algorithms can only deal with certain energies. Unfortunately I have not figured out yet how to convert C++ errors to Python. If an unknown error is raised, it probably means that you used an invalid energy function. Look at the gco README for details.

This package gives a high level interface to gco, providing the following functions:

cut_simple: Graph cut on a 2D grid using a global label affinity-matrix.

cut_VH: NOT DONE YET Graph cut on a 2D grid using a global label affinity-matrix and edge-weights. V contains the weights for vertical edges, H for horizontal ones.

cut_from_graph: Graph cut on an arbitrary graph with global label affinity-matrix.

cut_from_graph_weighted: NOT DONE YET Graph cut on an arbitrary graph with global label affinity-matrix and edgeweights.

See example.py and example_middlebury.py for examples and the gco README for more details.

gco_python's People

Contributors

amueller avatar kunal0895 avatar mjstevens777 avatar narayanschuetz avatar trsaunders avatar

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.