An open API service indexing awesome lists of open source software.

https://github.com/universaldatatool/udt-iou-error

Npm module for calculating the Intersection over Union (IoU) error for a set of polygons (or UDT Regions)
https://github.com/universaldatatool/udt-iou-error

computer-vision computer-vision-algorithms labeling-tool npm npm-package

Last synced: 9 months ago
JSON representation

Npm module for calculating the Intersection over Union (IoU) error for a set of polygons (or UDT Regions)

Awesome Lists containing this project

README

          

# UDT IOU Error

Compute the intersection over union error of groups of polygons ([UDT regions](https://github.com/UniversalDataTool/udt-format/blob/master/interfaces/image_segmentation.md)). Created primarily for use with the [Universal Data Tool](https://universaldatatool.com).

All x/y coordinates should be in a `1x1` area, anything outside of the `1x1` area won't be considered. (If you want to change this behavior to something more configurable, PRs are welcome!)

```javascript
// install with npm install udt-iou-error
const getIOU = require("udt-iou-error")

const annotation1 = [
{
regionType: "bounding-box",
centerX: 0.5,
centerY: 0.5,
width: 0.5,
height: 0.5,
},
]

const annotation2 = [
{
regionType: "polygon",
points: [
{ x: 0, y: 0 },
{ x: 0, y: 1 },
{ x: 1, y: 1 },
],
},
]

getIOU(annotation1, annotation2)
// >> 0.2
```

### Classifications

It's also smart enough to calculate IOU error with multiple classifications.

```javascript
const getIOU = require("udt-iou-error")

const annotation1 = [
{
regionType: "bounding-box",
classification: "red",
centerX: 0.5,
centerY: 0.5,
width: 0.5,
height: 0.5,
},
{
regionType: "bounding-box",
classification: "blue",
centerX: 0.1,
centerY: 0.1,
width: 0.2,
height: 0.2,
},
]

const annotation2 = [
{
regionType: "polygon",
classification: "blue",
points: [
{ x: 0, y: 0 },
{ x: 0, y: 1 },
{ x: 1, y: 1 },
],
},
]

getIOU(annotation1, annotation2)
// >> 0.259
```