{"id":18497040,"url":"https://github.com/multi-template-matching/mtm-python-oop","last_synced_at":"2025-04-09T00:30:32.200Z","repository":{"id":57443801,"uuid":"415073422","full_name":"multi-template-matching/mtm-python-oop","owner":"multi-template-matching","description":"A more object-oriented python implementation of multi-template matching (mtm), relying on scikit-image and shapely.","archived":false,"fork":false,"pushed_at":"2021-12-20T19:33:59.000Z","size":40257,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T19:39:16.060Z","etag":null,"topics":["computer-vision","object-detection","template-matching"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multi-template-matching.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-08T17:29:04.000Z","updated_at":"2025-02-24T06:36:49.000Z","dependencies_parsed_at":"2022-09-10T20:22:50.561Z","dependency_job_id":null,"html_url":"https://github.com/multi-template-matching/mtm-python-oop","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multi-template-matching%2Fmtm-python-oop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multi-template-matching%2Fmtm-python-oop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multi-template-matching%2Fmtm-python-oop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multi-template-matching%2Fmtm-python-oop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multi-template-matching","download_url":"https://codeload.github.com/multi-template-matching/mtm-python-oop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949639,"owners_count":21023360,"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":["computer-vision","object-detection","template-matching"],"created_at":"2024-11-06T13:33:06.286Z","updated_at":"2025-04-09T00:30:29.621Z","avatar_url":"https://github.com/multi-template-matching.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/multi-template-matching/mtm-python-oop/main?filepath=tutorials)\n\n# Multi-Template-Matching (mtm) : the object-oriented python implementation  \n\n![coins](./images/coins.png)\n\n\nMulti-Template-Matching is an accessible method to perform object-detection in images using one or several template images for the search.  \nThe strength of the method compared to previously available single-template matching, is that by combining the detections from multiple templates,\none can improve the range of detectable patterns. This helps if you expect variability of the object-perspective in your images, such as rotation, flipping...  \nThe detections from the different templates are not simply combined, they are filtered using Non-Maxima Suppression (NMS) to prevent overlapping detections.  \n\nThe python implementations of mtm only perform the detection and filtering with NMS.  \nFor the templates, you can provide a list of images to use. You can also perform geometrical transformation (kind of data augmentation) of existing templates if you expect these transformation in the image (ex: rotation/flipping).  \n\nThis implementation relies on the packages scikit-image and shapely, but not on OpenCV contrary to the python implementation originally published (and still available).  \nIt is more object-oriented, especially it should be easier to adapt to other shapes (detection with rectangular template but outlining detected region with a non-rectangular shape), by implementing another type of Detection object.  \nIn this python implementation, the detections are of type `BoundingBox` and hold a reference to a shapely `Polygon` object (a subtype of [geometric object](https://shapely.readthedocs.io/en/latest/manual.html#geometric-objects)).  \nWhile most functions required for multi-template-matching are directly available through the BoundingBox object, you can also use functions and attributes available to shapely Polygon by accessing the `polygon`attribute of a BoundingBox.  \n\nCore functions available in mtm are : \n\n- the main function `mtm.matchTemplates`  \nIt returns the best predicted locations provided a scoreThreshold and an optional number of objects expected in the image.  \nIt performs the search for each template followed by overlap-based Non-Maxima Suppression (NMS) to remove redundant/overlapping detections.  \nIf a number N of expected object is mentioned, it returns at max N detection but potentially less depending on the score threshold.  \n\n- the function `mtm.findMatches`  \nIt performs the search for each template and return all detections above the score-threshold, or a single top-score detection for each template if `singleMatch` is true.  \nContrary to `mtm.matchTemplates`, __it does not perform NMS__ so you will potentially get overlapping detections.  \nUsually one should use directly `mtm.matchTemplates`.  \n\nThe website of the project https://multi-template-matching.github.io/Multi-Template-Matching/ references most of the information, including presentations, posters and recorded talks/tutorials.  \nThe [wiki](https://github.com/multi-template-matching/MultiTemplateMatching-Fiji/wiki) section of this related repository also provides some information about the implementation.  \n\n# Installation  \nOpen a command prompt (or Anaconda prompt if using Anaconda) and type  \n`pip install mtm` \n\nFor development purpose, you can clone/download this repo, open a command prompt in the root directory of the repo and use pip to install the package in editable mode.  \n`pip install -e .`  \nmind the dot specifying to use the active directory (ie the one you open the prompt in).  \nIn editable mode, any change to the source code is directly reflected the next time you import the package.  \n\n# Examples\nCheck out the [jupyter notebook tutorial](https://github.com/multi-template-matching/mtm-python-oop/tree/master/tutorials) for some example of how to use the package.  \nYou can run the tutorials online using Binder, no configuration needed ! (click the Binder banner on top of this page).  \n\nTo run the tutorials locally, install the package using pip as described above, then clone/download the repository and unzip it.  \nFinally open a jupyter-notebook session in the unzipped folder to be able to open and execute the notebooks.  \n\n# Citation\nIf you use this implementation for your research, please cite:\n  \nThomas, L.S.V., Gehrig, J.  \n_Multi-template matching: a versatile tool for object-localization in microscopy images_  \nBMC Bioinformatics 21, 44 (2020). https://doi.org/10.1186/s12859-020-3363-7\n\n# Related projects\nSee this [repo](https://github.com/multi-template-matching/MultiTemplateMatching-Fiji) for the implementation as a Fiji plugin.  \n[Here](https://nodepit.com/workflow/com.nodepit.space%2Flthomas%2Fpublic%2FMulti-Template%20Matching.knwf) for a KNIME workflow using Multi-Template-Matching.\n\n\n# Origin of the work\nThis work has been part of the PhD project of **Laurent Thomas** under supervision of **Dr. Jochen Gehrig** at ACQUIFER.  \n\n\u003cimg src=\"https://github.com/multi-template-matching/MultiTemplateMatching-Python/blob/master/images/Acquifer_Logo_60k_cmyk_300dpi.png\" alt=\"ACQUIFER\" width=\"400\" height=\"80\"\u003e     \n\n# Funding\nThis project has received funding from the European Union’s Horizon 2020 research and innovation program under the Marie Sklodowska-Curie grant agreement No 721537 ImageInLife.  \n\n\u003cp float=\"left\"\u003e\n\u003cimg src=\"https://github.com/multi-template-matching/MultiTemplateMatching-Python/blob/master/images/ImageInlife.png\" alt=\"ImageInLife\" width=\"130\" height=\"100\"\u003e\n\u003cimg src=\"https://github.com/multi-template-matching/MultiTemplateMatching-Python/blob/master/images/MarieCurie.jpg\" alt=\"MarieCurie\" width=\"130\" height=\"130\"\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmulti-template-matching%2Fmtm-python-oop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmulti-template-matching%2Fmtm-python-oop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmulti-template-matching%2Fmtm-python-oop/lists"}