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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<img src="https://pygmtools.readthedocs.io/en/latest/_static/images/pygmtools_logo.svg" alt="pygmtools: Python Graph Matching Tools" width="800"/>
|
| 2 |
+
|
| 3 |
+
[](https://pypi.org/pypi/pygmtools/)
|
| 4 |
+
[](https://pypi.python.org/pypi/pygmtools/)
|
| 5 |
+
[](https://pepy.tech/project/pygmtools)
|
| 6 |
+
[](https://pygmtools.readthedocs.io/en/latest/?badge=latest)
|
| 7 |
+
[](https://codecov.io/gh/Thinklab-SJTU/pygmtools)
|
| 8 |
+
[](https://discord.gg/8m6n7rRz9T)
|
| 9 |
+
[](https://qm.qq.com/cgi-bin/qm/qr?k=QolXYJn_M5ilDEM9e2jEjlPnJ02Ktabd&jump_from=webapi&authKey=6zG6D/Js4YF5h5zj778aO5MDKOXBwPFi8gQ4LsXJN8Hn1V8uCVGV81iT4J/FjPGT)
|
| 10 |
+
[](https://GitHub.com/Thinklab-SJTU/pygmtools/stargazers/)
|
| 11 |
+
|
| 12 |
+
-----------------------------------------
|
| 13 |
+
|
| 14 |
+
``pygmtools`` (Python Graph Matching Tools) provides graph matching solvers in Python and is easily accessible via:
|
| 15 |
+
|
| 16 |
+
```bash
|
| 17 |
+
$ pip install pygmtools
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
Official documentation: https://pygmtools.readthedocs.io
|
| 21 |
+
|
| 22 |
+
Source code: https://github.com/Thinklab-SJTU/pygmtools
|
| 23 |
+
|
| 24 |
+
Graph matching is a fundamental yet challenging problem in pattern recognition, data mining, and others.
|
| 25 |
+
Graph matching aims to find node-to-node correspondence among multiple graphs, by solving an NP-hard combinatorial
|
| 26 |
+
optimization problem.
|
| 27 |
+
|
| 28 |
+
Doing graph matching in Python used to be difficult, and this library wants to make researchers' lives easier.
|
| 29 |
+
To highlight, ``pygmtools`` has the following features:
|
| 30 |
+
|
| 31 |
+
* *Support various solvers*, including traditional combinatorial solvers (including linear, quadratic, and multi-graph)
|
| 32 |
+
and novel deep learning-based solvers;
|
| 33 |
+
* *Support various backends*, including ``numpy`` which is universally accessible, and some state-of-the-art deep
|
| 34 |
+
learning architectures with GPU support:
|
| 35 |
+
``pytorch``, ``paddle``, ``jittor``, ``tensorflow``, ``mindspore``;
|
| 36 |
+
* *Deep learning friendly*, the operations are designed to best preserve the gradient during computation and batched
|
| 37 |
+
operations support for the best performance.
|
| 38 |
+
|
| 39 |
+
## Installation
|
| 40 |
+
|
| 41 |
+
You can install the stable release on PyPI:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
$ pip install pygmtools
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
or get the latest version by running:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
$ pip install -U https://github.com/Thinklab-SJTU/pygmtools/archive/master.zip # with --user for user install (no root)
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Now the pygmtools is available with the ``numpy`` backend.
|
| 54 |
+
|
| 55 |
+
The following packages are required, and shall be automatically installed by ``pip``:
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
Python >= 3.7
|
| 59 |
+
requests >= 2.25.1
|
| 60 |
+
scipy >= 1.4.1
|
| 61 |
+
Pillow >= 7.2.0
|
| 62 |
+
numpy >= 1.18.5
|
| 63 |
+
easydict >= 1.7
|
| 64 |
+
appdirs >= 1.4.4
|
| 65 |
+
tqdm >= 4.64.1
|
| 66 |
+
wget >= 3.2
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
## Available Graph Matching Solvers
|
| 70 |
+
This library offers user-friendly API for the following solvers:
|
| 71 |
+
|
| 72 |
+
* [Two-Graph Matching Solvers](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.html)
|
| 73 |
+
* Linear assignment solvers including the differentiable soft
|
| 74 |
+
[Sinkhorn algorithm](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.linear_solvers.sinkhorn.html) [1],
|
| 75 |
+
and the exact solver [Hungarian](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.linear_solvers.hungarian.html) [2].
|
| 76 |
+
* Soft and differentiable quadratic assignment solvers, including [spectral graph matching](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.sm.html) [3]
|
| 77 |
+
and [random-walk-based graph matching](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.rrwm.html) [4].
|
| 78 |
+
* Discrete (non-differentiable) quadratic assignment solver
|
| 79 |
+
[integer projected fixed point method](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.ipfp.html) [5].
|
| 80 |
+
* [Multi-Graph Matching Solvers](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.html)
|
| 81 |
+
* [Composition based Affinity Optimization (CAO) solver](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.cao.html) [6]
|
| 82 |
+
by optimizing the affinity score, meanwhile gradually infusing the consistency.
|
| 83 |
+
* Multi-Graph Matching based on
|
| 84 |
+
[Floyd shortest path algorithm](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.mgm_floyd.html) [7].
|
| 85 |
+
* [Graduated-assignment based multi-graph matching solver](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.gamgm.html) [8][9]
|
| 86 |
+
by graduated annealing of Sinkhorn’s temperature.
|
| 87 |
+
* [Neural Graph Matching Solvers](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.html)
|
| 88 |
+
* Intra-graph and cross-graph embedding based neural graph matching solvers
|
| 89 |
+
[PCA-GM](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.pca_gm.html)
|
| 90 |
+
and [IPCA-GM](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.ipca_gm.html) [10]
|
| 91 |
+
for matching individual graphs.
|
| 92 |
+
* [Channel independent embedding (CIE)](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.cie.html) [11]
|
| 93 |
+
based neural graph matching solver for matching individual graphs.
|
| 94 |
+
* [Neural graph matching solver (NGM)](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.ngm.html) [12]
|
| 95 |
+
for the general quadratic assignment formulation.
|
| 96 |
+
|
| 97 |
+
## Available Backends
|
| 98 |
+
This library is designed to support multiple backends with the same set of API.
|
| 99 |
+
Please follow the official instructions to install your backend.
|
| 100 |
+
|
| 101 |
+
The following backends are available:
|
| 102 |
+
|
| 103 |
+
* [Numpy](https://numpy.org/) (**default** backend, CPU only)
|
| 104 |
+
|
| 105 |
+
<img src="https://pygmtools.readthedocs.io/en/latest/_images/numpy_logo.png" alt="numpy logo" width="200"/>
|
| 106 |
+
|
| 107 |
+
* [PyTorch](https://pytorch.org/) (GPU friendly, deep learning friendly)
|
| 108 |
+
|
| 109 |
+
<img src="https://pygmtools.readthedocs.io/en/latest/_images/pytorch_logo.png" alt="pytorch logo" width="200"/>
|
| 110 |
+
|
| 111 |
+
* [Jittor](https://github.com/Jittor/Jittor) (GPU friendly, JIT support, deep learning friendly)
|
| 112 |
+
|
| 113 |
+
<img src="https://pygmtools.readthedocs.io/en/latest/_images/jittor_logo.png" alt="jittor logo" width="200"/>
|
| 114 |
+
|
| 115 |
+
* [PaddlePaddle](https://www.paddlepaddle.org.cn/en) (GPU friendly, deep learning friendly)
|
| 116 |
+
|
| 117 |
+
<img src="https://pygmtools.readthedocs.io/en/latest/_images/paddle_logo.png" alt="paddle logo" width="200"/>
|
| 118 |
+
|
| 119 |
+
* [Tensorflow](https://tensorflow.google.cn/) (GPU friendly, deep learning friendly)
|
| 120 |
+
|
| 121 |
+
<img src="https://pygmtools.readthedocs.io/en/latest/_images/tensorflow_logo.png" alt="tensorflow logo" width="200"/>
|
| 122 |
+
|
| 123 |
+
### Development status (0.3.8)
|
| 124 |
+
|
| 125 |
+
| | Numpy | PyTorch | Jittor | PaddlePaddle | Tensorflow | MindSpore |
|
| 126 |
+
| ------------------- | ----- | ------- | ------ | ------------ | ---------- | --------- |
|
| 127 |
+
| Linear Solvers | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| 128 |
+
| Classic Solvers | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| 129 |
+
| Multi-Graph Solvers | ✔ | ✔ | ✔ | ✔ | 📆 | 📆 |
|
| 130 |
+
| Neural Solvers | ✔ | ✔ | ✔ | ✔ | 📆 | 📆 |
|
| 131 |
+
| Examples Gallery | ✔ | ✔ | ✔ | ✔ | 📆 | 📆 |
|
| 132 |
+
|
| 133 |
+
✔: Supported; 📆: Planned for future versions (contributions welcomed!).
|
| 134 |
+
|
| 135 |
+
For more details, please [read the documentation](https://pygmtools.readthedocs.io/en/latest/guide/get_started.html#install-other-backends).
|
| 136 |
+
|
| 137 |
+
## Pretrained Models
|
| 138 |
+
|
| 139 |
+
The library includes several neural network solvers. The pretrained models shall be automatically downloaded upon
|
| 140 |
+
needed from Google Drive. If you are experiencing issues accessing Google Drive, please download the pretrained models
|
| 141 |
+
manually and put them at ``~/.cache/pygmtools`` (for Linux).
|
| 142 |
+
|
| 143 |
+
Available at:
|
| 144 |
+
[[google drive]](https://drive.google.com/drive/folders/1O7vkIW8QXBJsNsHUIRiSw91HJ_0FAzu_?usp=sharing)
|
| 145 |
+
[[baidu drive]](https://pan.baidu.com/s/1MvzfM52NJeLWx2JXbbc6HA?pwd=x8bv)
|
| 146 |
+
|
| 147 |
+
## The Deep Graph Matching Benchmark
|
| 148 |
+
|
| 149 |
+
``pygmtools`` is also featured with a standard data interface of several graph matching benchmarks. Please read
|
| 150 |
+
[the corresponding documentation](https://pygmtools.readthedocs.io/en/latest/guide/benchmark.html) for details.
|
| 151 |
+
|
| 152 |
+
We also maintain a repository containing non-trivial implementation of deep graph matching models, please check out
|
| 153 |
+
[ThinkMatch](https://thinkmatch.readthedocs.io/) if you are interested!
|
| 154 |
+
|
| 155 |
+
## Chat with the Community
|
| 156 |
+
|
| 157 |
+
If you have any questions, or if you are experiencing any issues, feel free to [raise an issue](https://github.com/Thinklab-SJTU/pygmtools/issues/new) on GitHub.
|
| 158 |
+
|
| 159 |
+
We also offer the following chat rooms if you are more comfortable with them:
|
| 160 |
+
|
| 161 |
+
* Discord (for English speakers):
|
| 162 |
+
|
| 163 |
+
[](https://discord.gg/8m6n7rRz9T)
|
| 164 |
+
|
| 165 |
+
* QQ Group (for Chinese speakers)/QQ群(中文用户): 696401889
|
| 166 |
+
|
| 167 |
+
[](https://qm.qq.com/cgi-bin/qm/qr?k=NlPuwwvaFaHzEWD8w7jSOTzoqSLIM80V&jump_from=webapi&authKey=chI2htrWDujQed6VtVid3V1NXEoJvwz3MVwruax6x5lQIvLsC8BmpmzBJOCzhtQd)
|
| 168 |
+
|
| 169 |
+
## Contributing
|
| 170 |
+
Any contributions/ideas/suggestions from the community is welcomed! Before starting your contribution, please read the
|
| 171 |
+
[Contributing Guide](https://github.com/Thinklab-SJTU/pygmtools/blob/main/CONTRIBUTING.md).
|
| 172 |
+
|
| 173 |
+
## Developers and Maintainers
|
| 174 |
+
|
| 175 |
+
``pygmtools`` is currently developed and maintained by members from [ThinkLab](http://thinklab.sjtu.edu.cn) at
|
| 176 |
+
Shanghai Jiao Tong University.
|
| 177 |
+
|
| 178 |
+
## References
|
| 179 |
+
<!--MLA style references-->
|
| 180 |
+
|
| 181 |
+
[1] Sinkhorn, Richard, and Paul Knopp. "Concerning nonnegative matrices and doubly stochastic matrices." Pacific Journal of Mathematics 21.2 (1967): 343-348.
|
| 182 |
+
|
| 183 |
+
[2] Munkres, James. "Algorithms for the assignment and transportation problems." Journal of the society for industrial and applied mathematics 5.1 (1957): 32-38.
|
| 184 |
+
|
| 185 |
+
[3] Leordeanu, Marius, and Martial Hebert. "A spectral technique for correspondence problems using pairwise constraints." International Conference on Computer Vision (2005).
|
| 186 |
+
|
| 187 |
+
[4] Cho, Minsu, Jungmin Lee, and Kyoung Mu Lee. "Reweighted random walks for graph matching." European conference on Computer vision. Springer, Berlin, Heidelberg, 2010.
|
| 188 |
+
|
| 189 |
+
[5] Leordeanu, Marius, Martial Hebert, and Rahul Sukthankar. "An integer projected fixed point method for graph matching and map inference." Advances in neural information processing systems 22 (2009).
|
| 190 |
+
|
| 191 |
+
[6] Yan, Junchi, et al. "Multi-graph matching via affinity optimization with graduated consistency regularization." IEEE transactions on pattern analysis and machine intelligence 38.6 (2015): 1228-1242.
|
| 192 |
+
|
| 193 |
+
[7] Jiang, Zetian, Tianzhe Wang, and Junchi Yan. "Unifying offline and online multi-graph matching via finding shortest paths on supergraph." IEEE transactions on pattern analysis and machine intelligence 43.10 (2020): 3648-3663.
|
| 194 |
+
|
| 195 |
+
[8] Solé-Ribalta, Albert, and Francesc Serratosa. "Graduated assignment algorithm for multiple graph matching based on a common labeling." International Journal of Pattern Recognition and Artificial Intelligence 27.01 (2013): 1350001.
|
| 196 |
+
|
| 197 |
+
[9] Wang, Runzhong, Junchi Yan, and Xiaokang Yang. "Graduated assignment for joint multi-graph matching and clustering with application to unsupervised graph matching network learning." Advances in Neural Information Processing Systems 33 (2020): 19908-19919.
|
| 198 |
+
|
| 199 |
+
[10] Wang, Runzhong, Junchi Yan, and Xiaokang Yang. "Combinatorial learning of robust deep graph matching: an embedding based approach." IEEE Transactions on Pattern Analysis and Machine Intelligence (2020).
|
| 200 |
+
|
| 201 |
+
[11] Yu, Tianshu, et al. "Learning deep graph matching with channel-independent embedding and hungarian attention." International conference on learning representations. 2019.
|
| 202 |
+
|
| 203 |
+
[12] Wang, Runzhong, Junchi Yan, and Xiaokang Yang. "Neural graph matching network: Learning lawler’s quadratic assignment problem with extension to hypergraph and multiple-graph matching." IEEE Transactions on Pattern Analysis and Machine Intelligence (2021).
|