Thanks for your interest in contributing to IMM!
To add a new method:
- Create a new file in the
matching/im_modelsfolder called[method].py - If the method requires external modules, add them to
./matching/third_partywithgit submodule add: for example, I've used this command to add the LightGlue module which is automatically downloaded when using--recursive
git submodule add https://github.com/cvg/LightGlue matching/third_party/LightGlue
This command automatically modifies .gitmodules (and modifying it manually doesn't work).
Add the method by subclassing
BaseMatcherand implementing_forward, which takes two image tensors as input and returns a dict with keys['num_inliers','H', 'mkpts0', 'mkpts1', 'inliers0', 'inliers1', 'kpts0', 'kpts1', 'desc0', desc1']. The value of any key may be 0, if that model does not produce that output, but they key must exist. SeeTEMPLATE.pyfor an example.
You may also want to implementpreprocess,download_weights, and anything else necessary to make the model easy to run.Open
__init__.pyand add the model name (all lowercase) to theavailable_modelslist.
Add anelifcase toget_matcher()with this model name, following the template from the other matchers.If it requires additional dependencies, add them to
requirements.txtor to the[project.optional-dependencies]ofpyproject.toml.Format the code with Black, like this
pip install black
cd image-matching-models && black --line-length 120 ./
- Test your model and submit a PR!
Note: as authors update their model repos, consider updating the submodule reference here using the below: To update a submodule to the head of the remote, run
git submodule update --remote matching/third_party/[submodule_name]