{"id":20360758,"url":"https://github.com/masadcv/numpymaxflow","last_synced_at":"2025-07-30T07:40:37.527Z","repository":{"id":41277410,"uuid":"483371590","full_name":"masadcv/numpymaxflow","owner":"masadcv","description":"Numpy-based implementation of Max-flow/Min-cut (graphcut) for 2D/3D data","archived":false,"fork":false,"pushed_at":"2024-10-30T21:16:25.000Z","size":2817,"stargazers_count":2,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T12:57:07.906Z","etag":null,"topics":["numpy","python","segmentation"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/numpymaxflow/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/masadcv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-04-19T18:53:23.000Z","updated_at":"2024-10-30T21:09:03.000Z","dependencies_parsed_at":"2024-10-16T21:41:16.018Z","dependency_job_id":"faa6b518-6237-427d-b52c-713f757e4126","html_url":"https://github.com/masadcv/numpymaxflow","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/masadcv/numpymaxflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masadcv%2Fnumpymaxflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masadcv%2Fnumpymaxflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masadcv%2Fnumpymaxflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masadcv%2Fnumpymaxflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masadcv","download_url":"https://codeload.github.com/masadcv/numpymaxflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masadcv%2Fnumpymaxflow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266069166,"owners_count":23871692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["numpy","python","segmentation"],"created_at":"2024-11-14T23:42:51.808Z","updated_at":"2025-07-30T07:40:37.499Z","avatar_url":"https://github.com/masadcv.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# numpymaxflow: Max-flow/Min-cut in numpy for 2D images and 3D volumes\n[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\u003cimg src=\"https://img.shields.io/pypi/dm/numpymaxflow.svg?label=PyPI%20downloads\u0026logo=python\u0026logoColor=green\"/\u003e\n[![CI Build](https://github.com/masadcv/numpymaxflow/actions/workflows/build.yml/badge.svg)](https://github.com/masadcv/numpymaxflow/actions/workflows/build.yml)\n[![PyPI version](https://badge.fury.io/py/numpymaxflow.svg)](https://badge.fury.io/py/numpymaxflow)\n\u003cimg src=\"https://img.shields.io/badge/Python-%203.9%20|%203.10%20|%203.11%20|%203.12%20|%203.13-3776ab.svg\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/numpy-%3E%3D%201.26.0-brightgreen.svg\"/\u003e\n\nNumpy-based implementation of Max-flow/Min-cut based on the following paper:\n\n- Boykov, Yuri, and Vladimir Kolmogorov. \"An experimental comparison of min-cut/max-flow algorithms for energy minimization in vision.\" IEEE transactions on pattern analysis and machine intelligence 26.9 (2004): 1124-1137.\n\nIf you want same functionality in PyTorch, then consider [PyTorch-based implementation](https://github.com/masadcv/torchmaxflow)\n\n## Citation\nIf you use this code in your research, then please consider citing:\n\n **Asad, Muhammad, Lucas Fidon, and Tom Vercauteren. [\"ECONet: Efficient Convolutional Online Likelihood Network for Scribble-based Interactive Segmentation.\"](https://openreview.net/pdf?id=9xtE2AgD_Cc) Medical Imaging with Deep Learning (MIDL), 2022.**\n\n## Installation instructions\n`pip install numpymaxflow`\n\nor \n\n\n```\n# Clone and install from github repo\n\n$ git clone https://github.com/masadcv/numpymaxflow\n$ cd numpymaxflow\n$ pip install -r requirements.txt\n$ python setup.py install\n```\n\n## Example outputs\nMaxflow2d\n\n![./figures/numpymaxflow_maxflow2d.png](https://raw.githubusercontent.com/masadcv/numpymaxflow/main/figures/numpymaxflow_maxflow2d.png)\n\nInteractive maxflow2d\n\n![./figures/numpymaxflow_intmaxflow2d.png](https://raw.githubusercontent.com/masadcv/numpymaxflow/main/figures/numpymaxflow_intmaxflow2d.png)\n\n\n![figures/figure_numpymaxflow.png](https://raw.githubusercontent.com/masadcv/numpymaxflow/main/figures/figure_numpymaxflow.png)\n\n\n## Example usage\n\nThe following demonstrates a simple example showing numpymaxflow usage:\n```python\nimage = np.asarray(Image.open('data/image2d.png').convert('L'), np.float32)\nimage = np.expand_dims(image, axis=0)\n\nprob = np.asarray(Image.open('data/image2d_prob.png'), np.float32)\n\nlamda = 20.0\nsigma = 10.0\n\npost_proc_label = numpymaxflow.maxflow(image, prob, lamda, sigma)\n```\n\nFor more usage examples see: \n\n**2D and 3D maxflow and interactive maxflow examples**: [`demo_maxflow.py`](https://raw.githubusercontent.com/masadcv/numpymaxflow/main/demo_maxflow.py) \n \n## References\n- [OpenCV's Graphcut implementation](https://github.com/opencv/opencv/blob/4.x/modules/imgproc/include/opencv2/imgproc/detail/gcgraph.hpp)\n- [SimpleCRF's maxflow implementation](https://github.com/HiLab-git/SimpleCRF)\n- [torchmaxflow's implementation](https://github.com/masadcv/torchmaxflow)\n\nThis repository depends on the code for [maxflow from latest version of OpenCV](https://github.com/opencv/opencv/blob/4.x/modules/imgproc/include/opencv2/imgproc/detail/gcgraph.hpp), which has been included.\n\n\u003c!-- BibTeX:\n```\n@inproceedings{\nasad2022econet,\ntitle={{ECON}et: Efficient Convolutional Online Likelihood Network for Scribble-based Interactive Segmentation},\nauthor={Muhammad Asad and Lucas Fidon and Tom Vercauteren},\nbooktitle={Medical Imaging with Deep Learning},\nyear={2022},\nurl={https://openreview.net/forum?id=9xtE2AgD_Cc}\n}\n``` --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasadcv%2Fnumpymaxflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasadcv%2Fnumpymaxflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasadcv%2Fnumpymaxflow/lists"}