No project description provided
Project description
torchmaxflow: Max-flow/Min-cut in PyTorch for 2D images and 3D volumes
Pytorch-based implementation of Max-flow/Min-cut based on the following paper:
- 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.
Citation
If you use this code in your research, then please consider citing:
Asad, Muhammad, Lucas Fidon, and Tom Vercauteren. "ECONet: Efficient Convolutional Online Likelihood Network for Scribble-based Interactive Segmentation." Medical Imaging with Deep Learning (MIDL), 2022.
Installation instructions
pip install torchmaxflow
or
# Clone and install from github repo
$ git clone https://github.com/masadcv/torchmaxflow
$ cd torchmaxflow
$ pip install -r requirements.txt
$ python setup.py install
Example outputs
Maxflow2d
Interactive maxflow2d
Example usage
The following demonstrates a simple example showing torchmaxflow usage:
image = np.asarray(Image.open('data/image2d.png').convert('L'), np.float32)
image = torch.from_numpy(image).unsqueeze(0).unsqueeze(0)
prob = np.asarray(Image.open('data/image2d_prob.png'), np.float32)
prob = torch.from_numpy(prob).unsqueeze(0)
lamda = 20.0
sigma = 10.0
post_proc_label = torchmaxflow.maxflow(image, prob, lamda, sigma)
For more usage examples see:
2D and 3D maxflow and interactive maxflow examples: demo_maxflow.py
References
This repository depends on the code for maxflow from latest version of OpenCV, which has been included.
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 torchmaxflow-0.0.4rc1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3e4217c62b8acd32b27c37348c6f8e595424298b09effbd78b965107a9a8cf9 |
|
MD5 | 27a96b39b00831e73b8b45da13a8d518 |
|
BLAKE2b-256 | 85ee9c2b4d069105f3e672e7d96717810a4e1495e8c9c576e90927b0776e7a7a |
Hashes for torchmaxflow-0.0.4rc1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a97d1b4b979e528bee693c1db3682522a0d30fe769fcaba6a38b7c81ae9be22a |
|
MD5 | 60f1019680f450708419913265ff4da6 |
|
BLAKE2b-256 | cdc89438460a8ec6cbaf159bcb1f6207ce978e3d2fa9dfeb2ded1671a34e03a0 |
Hashes for torchmaxflow-0.0.4rc1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19d9664e3bcad958c3f3094afdd169b69466ffd0bf80eb0ad27fb65875bc79e9 |
|
MD5 | e07114c0a253d84888ff9acd27eecdf0 |
|
BLAKE2b-256 | 94ffc803afe31bea19a49531a8ca6f03b8b5238426317aa263cf6c43eff81b99 |
Hashes for torchmaxflow-0.0.4rc1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 459d719854846acfb1410004e0943c628f46263f64397778254b67607f738728 |
|
MD5 | 8d106322f383fa3155d626fe959f9062 |
|
BLAKE2b-256 | 180810dd303d5720857c55628814396e9f67374b83a1ead4b42c23200c571cd3 |
Hashes for torchmaxflow-0.0.4rc1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 635dbae9d23f81b9c7cc8e08b2a10e95ab69d53867fd6d46a79c87976cd2394e |
|
MD5 | e1612a8653eb839a28e13775964e4e55 |
|
BLAKE2b-256 | 9164c12b64ad7662dadae98b472c81a013a191c27696766d15876646cc0d88b2 |
Hashes for torchmaxflow-0.0.4rc1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 797ca9843988c22ebb4642d53c3e6b3424e9faa31ceb46f3708434b0a928a067 |
|
MD5 | 1ec0700d8ecbe65fe80b4ae7b4dfaf54 |
|
BLAKE2b-256 | 590b1bbb845b3b6092466c03d0eee7be998d8e2cc97a875fc7157f1c6f7a69d4 |
Hashes for torchmaxflow-0.0.4rc1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 315238c08a5d4c2fb52311ec5984c00d9db3a7a55315ee4377b66e79705685a0 |
|
MD5 | 94cc3d07c1943bbd8bf56f85f18d3f22 |
|
BLAKE2b-256 | e367a056450deb63a77cd8e9298eabc9fc0cbe9b02a4de228a5c524cc3764db1 |
Hashes for torchmaxflow-0.0.4rc1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ba2b02e299efad0de82033bf05e0b99e932044f2512796b5255f5965107163d |
|
MD5 | 48384995cb7f277eebe4d13142dcda60 |
|
BLAKE2b-256 | 133c3fd379d39ccc002db49d364d4bc5094e4ffb7ecdabde4cc4bee309f97e31 |