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)
- Host: GitHub
- URL: https://github.com/universaldatatool/udt-iou-error
- Owner: UniversalDataTool
- Created: 2020-08-19T21:27:15.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-22T06:48:59.000Z (over 5 years ago)
- Last Synced: 2024-10-29T18:40:44.890Z (over 1 year ago)
- Topics: computer-vision, computer-vision-algorithms, labeling-tool, npm, npm-package
- Language: JavaScript
- Homepage:
- Size: 267 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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
```