{"id":23841898,"url":"https://github.com/johnpertoft/locality-aware-nms","last_synced_at":"2025-07-08T04:08:45.972Z","repository":{"id":85388315,"uuid":"214200951","full_name":"johnPertoft/locality-aware-nms","owner":"johnPertoft","description":"Locality Aware NMS as custom Tensorflow OP","archived":false,"fork":false,"pushed_at":"2020-09-01T06:39:35.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T08:48:42.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnPertoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-10-10T14:14:54.000Z","updated_at":"2020-09-01T06:39:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"19210520-d181-4319-a287-133cb859e3a0","html_url":"https://github.com/johnPertoft/locality-aware-nms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johnPertoft/locality-aware-nms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnPertoft%2Flocality-aware-nms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnPertoft%2Flocality-aware-nms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnPertoft%2Flocality-aware-nms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnPertoft%2Flocality-aware-nms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnPertoft","download_url":"https://codeload.github.com/johnPertoft/locality-aware-nms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnPertoft%2Flocality-aware-nms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264192344,"owners_count":23570765,"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":[],"created_at":"2025-01-02T18:21:55.539Z","updated_at":"2025-07-08T04:08:45.937Z","avatar_url":"https://github.com/johnPertoft.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Locality Aware NMS\n- An implementation of Locality Aware NMS as described \nin [EAST: An Efficient and Accurate Scene Text Detector](https://arxiv.org/abs/1704.03155) \nas a custom Tensorflow OP.\n- A standard NMS implementation as a custom Tensorflow OP.\n- Support for rotated bounding boxes.\n- Usable with Tensorflow 1.X and 2.\n- Usable with Tensorflow Serving for production purposes.\n\n## Usage\n```python\nfrom lanms import locality_aware_nms\n\n# vertices: Tensor of shape (?, 4, 2).\n# probs: Tensor of shape (?,).\n\nvertices, scores = locality_aware_nms(vertices, probs, iou_threshold=0.3)\n\n# vertices: Tensor of shape (?, 4, 2).\n# scores: Tensor of shape (?,).\n```\n\n## Installation\nWith the current setup, the installed python package only works if it was built with the same Tensorflow\nversion as it's being used with. I didn't look further into this problem so I'm not sure what causes it\nor how it can be fixed. Thus, in order to install this, it must first be built with the same python and \ntensorflow version as you will use it with. These versions can be passed to the build script as follows.\n\n```\n./run.sh build 3.7 2.3.0\npip install artifacts/tf_locality_aware_nms-0.0.1-cp37-cp37m-linux_x86_64.whl\n```\n\n## Serving\nAs far as I know the built shared library file can not be dynamically loaded by Tensorflow Serving.\nInstead Tensorflow Serving has to be built with these ops included in order to load a graph containing them. This can be achieved by the following steps before building Tensorflow Serving (as of version 2.1).\n\n**Include in Tensorflow Serving repository**\n```\ncp -r lanms $TFSERVING/tensorflow_serving/custom_ops/\n```\n\n**Update the BUILD file to include these ops**\n```\nsed -i '/SUPPORTED_TENSORFLOW_OPS =/a \\ \"//tensorflow_serving/custom_ops/lanms:nms_ops\",' $TFSERVING/tensorflow_serving/model_servers/BUILD\n```\n\n\n## Also see\n- [Official(?) C++ Locality-Aware NMS implementation](https://github.com/argman/EAST/blob/master/lanms/lanms.h)\n- [(Slower) Pure Tensorflow 1.X implementation of Locality-Aware NMS](https://gist.github.com/johnPertoft/4b909fd099b60df01a041cd98f17a1dc)\n\n## TODO\n- I'm not convinced that the way the weighted merge is implemented is correct / the best way to do it.\n  Given some order of bounding boxes (arbitrarily determined by row of top most coordinate) and assuming \n  similarly scored bounding boxes the current implementation will produce a final bounding box closer\n  to the earlier ones rather than a bounding box that appears to be in the middle of a group of boxes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnpertoft%2Flocality-aware-nms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnpertoft%2Flocality-aware-nms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnpertoft%2Flocality-aware-nms/lists"}