pyGCO: a python wrapper for the graph cuts package
Project description
pyGCO: a python wrapper for the graph cuts
The original wrapper is pygco
This is a python wrapper for gco-v3.0 package, which implements a graph cuts based move-making algorithm for optimization in Markov Random Fields.
It contains a copy of the gco-v3.0 package. Some of the design were borrowed from the gco_python package. However, compared to gco_python:
- This package does not depend on Cython. Instead it is implemented using the ctypes library and a C wrapper of the C++ code.
- This package is an almost complete wrapper for gco-v3.0, which supports more direct low level control over GCoptimization objects.
- This package supports graphs with edges weighted differently.
This wrapper is composed of two parts, a C wrapper and a python wrapper.
Implemented functions
- cut_general_graph(...)
- cut_grid_graph(...)
- cut_grid_graph_simple(...)
Building wrapper
- download the last version of gco-v3.0 to the gco_source
- compile gco-v3.0 and the C wrapper using
make
- compile test_wrapper using
make test_wrapper
- run the C test code
./test_wrapper
(now you have the C wrapper ready)
make download
make all
make test_wrapper
./test_wrapper
The successful run should return:
labels = [ 0 2 2 1 ], energy=19
data energy=15, smooth energy=4
Next test the python wrapper using python test_examples.py
, if it works fine you are ready to use pygco.
To include pygco in your code, simply import pygco module. See the documentation inside code for more details.
Install wrapper
Clone repository and enter folder, then
pip install -r requirements.txt
python setup.py install
Now it can be also installed from PyPi
pip install gco-wrapper
Show test results
Visualisation of the unary terns for binary segmentation
4-connected components with the initial labeling (left) and estimated labeling with regularisation 1 (middle) and 0 (right)
8-connected components with the initial labeling (left) and estimated labeling with regularisation 1 (middle) and 0 (right)
Visualisation of the unary terns for 3 labels segmentation
with the initial labeling (left) and estimated labeling (right)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for gco_wrapper-3.0.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aab0b15ab02bed80cf9c9da6b3d8c8b4461c9f0d13b91c3e78b19f7cf6ac462f |
|
MD5 | 98f232141090fd6f8dd93277669dfd15 |
|
BLAKE2b-256 | 4e4173370b948c428aea0c0566101e4b2e66eb87943e87c6d6165137d0418a82 |
Hashes for gco_wrapper-3.0.7-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e70c61a267455952d2351cd68102842bdf0a23a4f4815b89b64db0a243e00e8 |
|
MD5 | 71f81d425c623f22d9105ab4a1a5c26a |
|
BLAKE2b-256 | 7df59ee31d46edaf3c7dcd18c2900442d924886772f25b30006405969ef5eafc |
Hashes for gco_wrapper-3.0.7-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b0da5b3d2a42aa48c69c296e2399dcfb052ae3dff0d0287ce34f00c4d3437c |
|
MD5 | 4f7b801bd11fc3ac2453452014a2822b |
|
BLAKE2b-256 | 11e4353780e9f8c34225594fc5c2874254df486ec3d16156e55f7c8e13c749de |
Hashes for gco_wrapper-3.0.7-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27da3d9de8fd4d17d172b8c8a0f448fa6f657fcbe9dc2f388d385b045a262c07 |
|
MD5 | 3f2ba965ffcfda56eaa469676497d2dd |
|
BLAKE2b-256 | 04d92cbde82a4609788b170752bcbae4f9d8eaf789300e67fd1ff7e98b5d11f2 |
Hashes for gco_wrapper-3.0.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a11128fd0c47f61e3935f98b21d4745568ecfa96f3e8d089f00ce87601b10269 |
|
MD5 | efaa45228417eaba4609d36c0717bf1b |
|
BLAKE2b-256 | 176402745d1889311000e74295b701dd4273559d77ece7fb9cb2a25f176061ee |
Hashes for gco_wrapper-3.0.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5209688d533cfff06034aa6bf408f66013ecabe1a19b0e50edc69a93a816e097 |
|
MD5 | 427ceb5d1fbf7ab6f46b45aa8669c45b |
|
BLAKE2b-256 | 43efb9a84078884d95b210c02c46af0a3115e9184fa88c9daa921419a43447e4 |
Hashes for gco_wrapper-3.0.7-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2e639f2259d078a2f7938681631fcc23df6c6cb3d093f88f62c1d7c255fb173 |
|
MD5 | edb2e29c36ee048560da40a1222275af |
|
BLAKE2b-256 | f87625a0b144bb48c538dae52dcab16609a43802906bb87b42660e82cc8b786a |
Hashes for gco_wrapper-3.0.7-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57407eda2870e7ddf439398b1f63cac2453ae4671fde47f1e9b3348eb808ed1c |
|
MD5 | bc58f026724e5434ae084d5e88854ba2 |
|
BLAKE2b-256 | 17226a129f7825eb635a53347888b382496de8845b34f3eb2a624ac724fb8e79 |
Hashes for gco_wrapper-3.0.7-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03f86f79d7336d7e79729737369d288cd87016b2a4e89ca3533880d786062a5f |
|
MD5 | e8e3e1c8c70e0820efd5caaf06f534df |
|
BLAKE2b-256 | a8c9528d953eb48d7d31192dbd8acece17e9dcfef5a7591b06afeff60e3cc104 |
Hashes for gco_wrapper-3.0.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 271c4f3b6de436357d82b5e884aa7479b12b9e4e818887879dda72d6679abc69 |
|
MD5 | a1a250f45a4d9e67cbd372b1c08cca48 |
|
BLAKE2b-256 | 46ac21486a2dfaf6b66ff8e88664c50022f9ad716da24227a3d29160a5552677 |
Hashes for gco_wrapper-3.0.7-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c643c74d8255a6a644c40fc04e8d0a23befbc4ad71aeb8d5a1e325e82c57cd4d |
|
MD5 | 746509739781423cc58faac9dd7a7ad0 |
|
BLAKE2b-256 | e756e9b2667809d148bb7c338d8e7289321c0b8d84e9a767bd166b962ccdba4e |
Hashes for gco_wrapper-3.0.7-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23bf4b93ea8ec3cb28a5dc2b238d698b9b0426dbbf04b9f2dd12fb2927b6031b |
|
MD5 | 57ab64b4eb499970fbf9793ceb92db0f |
|
BLAKE2b-256 | 4f8202b417d4efbd718679589d006c5bf38662037c66341d1e911d59b0fcc952 |
Hashes for gco_wrapper-3.0.7-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 353c7bb4024784d345418057ddf5498eee3e282dfa5089395f37c2cea50b2040 |
|
MD5 | 943ae16b5a53e7df87cf4df078356eb1 |
|
BLAKE2b-256 | b4c6dcaab99b227f054a0ad7f1aebfa1b4e9821dadb5bff67039d4961075e597 |
Hashes for gco_wrapper-3.0.7-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf78364d594f0ec16de29192376b13e944b3154b514b4cfa17faec084a962d90 |
|
MD5 | c9c96f1e4e7f20fc038f930d825ff0e4 |
|
BLAKE2b-256 | 24f6c42672c6c18c4d9c13a51e4c9de82df2f681e1122ed8e62143b1b0f51ce9 |
Hashes for gco_wrapper-3.0.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e7a635b91763fd42fd8be8b5ddbfc874f26ffbd38c266b59f75ac17b18d10b1 |
|
MD5 | 219c7a1e65627147e5ed0862f889533e |
|
BLAKE2b-256 | 0527e4deacce9b49b9faf79825f7720e3fc22fe6f1255407f2158d79db79b9fb |
Hashes for gco_wrapper-3.0.7-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c51bc6810264029e2af049e43486411dc658466fe02abeb17dc50e12be3eeffd |
|
MD5 | 6390a75cdda31b41c74e3c99b9560d3b |
|
BLAKE2b-256 | 74e386a86c11c9dbbe886fa221f342f6294abfd62388153a8cc490a9ca62cee0 |
Hashes for gco_wrapper-3.0.7-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f459441b7631fb71fc7a765777bcb6c485e4a6d87a411eefa67ba30a3745eb3 |
|
MD5 | 975e1ffc6ff9d53129ef2beec3d88db5 |
|
BLAKE2b-256 | 5bf543398365d199f68d001b6f9cb590c49b1a4117befc017793b0390861c404 |
Hashes for gco_wrapper-3.0.7-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a359a3bfeda1f26d27b66623ee08898ce55a28c4687aa7b00cc54654a6e75b0 |
|
MD5 | f673eb07385c9f303ebfcf204f215fc2 |
|
BLAKE2b-256 | 58fba71d1fa05bc0fdee64217c1f0f298082f0ad1df4cf6eff7e9e9b1c19e358 |
Hashes for gco_wrapper-3.0.7-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a023e40e4e1e2d52a37b2dc0199462f634132668f828de307ea9df58d3d8c6c6 |
|
MD5 | 8bbb51839c381424f68e0081a516dd97 |
|
BLAKE2b-256 | a074801cb08784021267b2c2424a4dcbb95e15f6b3ef9bc3d35d5f2f4c3e3d93 |
Hashes for gco_wrapper-3.0.7-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab203fce6b2bf52dc1a92f1c9276888280288f77e2e29ed46b99a00a859c9c6c |
|
MD5 | 99a891973252087add9dbde32e4e7347 |
|
BLAKE2b-256 | 8fea0c2da6dbd8dce580c8ca7f6e25969023a53e2aa8ca0ab8b43b5a299a7cae |
Hashes for gco_wrapper-3.0.7-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a390b85f7c2981dbb424ed7e2aedf2825e64c8eafcc9cf0689faeaa2df35283 |
|
MD5 | fb62e078e292db7829edecc6b40dec38 |
|
BLAKE2b-256 | 798760cc0d910bafbcea545b6b10c0a8b513591ab7ae642cb3ebd3b7e6e63263 |
Hashes for gco_wrapper-3.0.7-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 569ace4a74db21baa6d103a2a619810bf4e8f077e2da8c0e1a017a7ec37031e4 |
|
MD5 | 5539175c0e4d5f17563a1b406f1b6fb3 |
|
BLAKE2b-256 | f97fa0e8e712c8bbc4bc99dd6b4142dcd43f6ea7bd61214ee088363d213784b2 |
Hashes for gco_wrapper-3.0.7-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33cab5580ca52b275d8b31e7b8ac865909a6dbabfb405ffe325d3d0d1c52f4ed |
|
MD5 | 7ae89ffd572922a2e9a6c2231a3cdc80 |
|
BLAKE2b-256 | b7e5eaf59ca02f46811360a7298890358396c0758491e2bf83e50d821d25a15b |
Hashes for gco_wrapper-3.0.7-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6cf74c115cfb564103b1c94c9d78d8651a0bf11d872776a0e13cbc679af8668 |
|
MD5 | 1154f06d04695de14364bedd4223479a |
|
BLAKE2b-256 | 8d314803afa7419bf24edf2681435fa521fed1165e0b12f2015712dbfb42be12 |
Hashes for gco_wrapper-3.0.7-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a6c7531eca53a85326dbd3a0f58b021d2e5605a127c97523941a3faa4fe3cf3 |
|
MD5 | 8345d53d471303cadd88183d6d86b99d |
|
BLAKE2b-256 | 03f138c6531aabd0f158d0b300651c9ce66be01b66faf363ee1fe7ae59f5bfb6 |
Hashes for gco_wrapper-3.0.7-cp27-cp27mu-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95f889fad6b533ec5e581663a87c6ff1f992be1d8c68cdeef5220f6506124804 |
|
MD5 | 493f2aa928884c42788f7a0fff2a86e8 |
|
BLAKE2b-256 | c319d4e9f7ca865244f1c6395f6abe91d3ac2efb9a49adc31ac533388581b114 |
Hashes for gco_wrapper-3.0.7-cp27-cp27mu-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0109bd558b2ac1cd24e881263b10b04751eabb9578cd2a65e294b8d24b4d26b0 |
|
MD5 | b7bcb47f16e47ff27c03b9462ef00703 |
|
BLAKE2b-256 | 043e1e6e3ef33069c948c2d469843da0a3c6c5f6ba660452b062bc022af6460a |
Hashes for gco_wrapper-3.0.7-cp27-cp27m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ea78d58623cc7e7cf2592433e40e17b79b902a404b869ccc7b0f6fd60f02276 |
|
MD5 | 58f602e414c0e78fa306a35dbaa9a766 |
|
BLAKE2b-256 | 2a51e4143e5307a81a730cdcde5f58cd9672f2f1612a6a203cd2aa469920f5b3 |
Hashes for gco_wrapper-3.0.7-cp27-cp27m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2024af3a32e9012747e4fcdd7a820fef0da9967d5351092caff0067db033b32b |
|
MD5 | 04465ea8ec1fd25cfb35e132d88dcb5d |
|
BLAKE2b-256 | 0c1af1dc6482928a4ebe712eda5a67bc61543ab09c923f40a9575d1b42cb6f4f |
Hashes for gco_wrapper-3.0.7-cp27-cp27m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab04f750484976c1ec7149d8ba1d9f3a79bfc6c85f5a471945d919b58344804a |
|
MD5 | f89e2d0221e19c750794561bc9156fed |
|
BLAKE2b-256 | d373892ebe87c59af3e0ae27354a3cd5c91e3765f528b12f5206673df4645477 |