Skip to main content

tf-convex-polygon-iou

Convex Polygons Intersection over Union (IoU) computation for tensorflow.

This repository is a a generalization of https://github.com/lilanxiao/Rotated_IoU to convex polygons, and ported to tensorflow 2.

Approach

The algorithm here may not be optimal, but only uses available tensorflow operations.

The most complex parts are to compute the intersection of two convex polygon.

As for the original work, it is based on Livermore, Califf, 1977. which remarks:

  • Intersection of two convex polygons is a convex polygon
  • A vertex from a polygon that is contained in the other polygon is a vertex of the intersection shape.
  • An edge from a polygon that is contained in the other polygon is an edge in the intersection shape.
  • Edge intersections between two polygons are vertices in the intersection shape.

Therefore the algorithm here:

  1. Finds all vertices in a polygon that lies within the other, by computing the winding number.
  2. Finds all intersection between edge other edges of the two polygons.
  3. Sorts all vertices in trigonometric order arround a point inside the polygon (die to duplicates, it cannot be ensured that it is the centroid of the polygon).

To compute the IoU, one must finally compute the area of the intersection. The used formula is robust to duplicate vertices, if the order of vertices is right.

Requirements

tensorflow >= 2.8.0 # it may be lower, but it is not tested

Release files for tf-convex-polygon-iou-atuleu 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tf-convex-polygon-iou-atuleu 0.0.2
File Size Uploaded
tf-convex-polygon-iou-atuleu-0.0.2.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tf-convex-polygon-iou-atuleu 0.0.2
File Interpreter ABI Platform
tf_convex_polygon_iou_atuleu-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / tf-convex-polygon-iou-atuleu-0.0.2.tar.gz

Download URL tf-convex-polygon-iou-atuleu-0.0.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
203f0999cb4ad5ac64d9d7c359f98a4e382f897d85f28a2207691677030e1cf2
BLAKE2b-256 checksum
How to use checksums
ced4b22fc899cf99b327bb5e8599ba5d382d0b5e406c79bea8bf198949859fe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

Release files / tf_convex_polygon_iou_atuleu-0.0.2-py3-none-any.whl

Download URL tf_convex_polygon_iou_atuleu-0.0.2-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46ebb7f852f9efab94f0e0d5b9c0ddcc9fa386a19476af6635ab0069582a7a6f
BLAKE2b-256 checksum
How to use checksums
50f9944d287037405a9d4da1273a4b7070d97b9f75a4877e60934ddaf42a4e9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page