A python library for Object Detection metrics.
Why OD-Metrics?
- User-friendly: Designed for simplicity, allowing users to calculate metrics with minimal setup.
- Highly Customizable: Offers flexibility by allowing users to set custom values for every parameter in metrics definitions.
- COCOAPI Compatibility: Metrics are rigorously tested to ensure compatibility with COCOAPI, ensuring reliability and consistency.
Supported Metrics
Supported metrics include:
For more information see Metrics documentation.
Documentation
For help, usage, API reference, and an overview of metrics formulas, please refer to Documentation.
Try live Demo
Installation
Install from PyPI
pip install od-metrics
Install from Github
pip install git+https://github.com/EMalagoli92/OD-Metrics
Simple Example
from od_metrics import ODMetrics
# Ground truths
y_true = [
{ # image 1
"boxes": [[25, 16, 38, 56], [129, 123, 41, 62]],
"labels": [0, 1]
},
{ # image 2
"boxes": [[123, 11, 43, 55], [38, 132, 59, 45]],
"labels": [0, 0]
}
]
# Predictions
y_pred = [
{ # image 1
"boxes": [[25, 27, 37, 54], [119, 111, 40, 67], [124, 9, 49, 67]],
"labels": [0, 1, 1],
"scores": [.88, .70, .80]
},
{ # image 2
"boxes": [[64, 111, 64, 58], [26, 140, 60, 47], [19, 18, 43, 35]],
"labels": [0, 1, 0],
"scores": [.71, .54, .74]
}
]
metrics = ODMetrics()
output = metrics.compute(y_true, y_pred)
print(output)
"""
{
"mAP@[.5 | all | 100]": 0.16831683168316827,
"mAP@[.5:.95 | all | 100]": 0.06732673267326732,
"mAP@[.5:.95 | large | 100]": -1.0,
"mAP@[.5:.95 | medium | 100]": 0.06732673267326732,
"mAP@[.5:.95 | small | 100]": -1.0,
"mAP@[.75 | all | 100]": 0.0,
"mAR@[.5 | all | 100]": 0.16666666666666666,
"mAR@[.5:.95 | all | 100]": 0.06666666666666667,
"mAR@[.5:.95 | all | 10]": 0.06666666666666667,
"mAR@[.5:.95 | all | 1]": 0.06666666666666667,
"mAR@[.5:.95 | large | 100]": -1.0,
"mAR@[.5:.95 | medium | 100]": 0.06666666666666667,
"mAR@[.5:.95 | small | 100]": -1.0,
"mAR@[.75 | all | 100]": 0.0,
"class_metrics": {
"0": {
"AP@[.5 | all | 100]": 0.33663366336633654,
"AP@[.5:.95 | all | 100]": 0.13465346534653463,
"AP@[.5:.95 | large | 100]": -1.0,
"AP@[.5:.95 | medium | 100]": 0.13465346534653463,
"AP@[.5:.95 | small | 100]": -1.0,
"AP@[.75 | all | 100]": 0.0,
"AR@[.5 | all | 100]": 0.3333333333333333,
"AR@[.5:.95 | all | 100]": 0.13333333333333333,
"AR@[.5:.95 | all | 10]": 0.13333333333333333,
"AR@[.5:.95 | all | 1]": 0.13333333333333333,
"AR@[.5:.95 | large | 100]": -1.0,
"AR@[.5:.95 | medium | 100]": 0.13333333333333333,
"AR@[.5:.95 | small | 100]": -1.0,
"AR@[.75 | all | 100]": 0.0
},
"1": {
"AP@[.5 | all | 100]": 0.0,
"AP@[.5:.95 | all | 100]": 0.0,
"AP@[.5:.95 | large | 100]": -1.0,
"AP@[.5:.95 | medium | 100]": 0.0,
"AP@[.5:.95 | small | 100]": -1.0,
"AP@[.75 | all | 100]": 0.0,
"AR@[.5 | all | 100]": 0.0,
"AR@[.5:.95 | all | 100]": 0.0,
"AR@[.5:.95 | all | 10]": 0.0,
"AR@[.5:.95 | all | 1]": 0.0,
"AR@[.5:.95 | large | 100]": -1.0,
"AR@[.5:.95 | medium | 100]": 0.0,
"AR@[.5:.95 | small | 100]": -1.0,
"AR@[.75 | all | 100]": 0.0
}
},
"classes": [
0,
1
],
"n_images": 2
}
"""
Aknowledgment
License
This work is made available under the Apache License 2.0
Support
Found this helpful? ⭐ it on GitHub
Metadata
Release files for od-metrics 2.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| od_metrics-2.2.2.tar.gz | 26.7 kB | Without provenance | Details for od_metrics-2.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| od_metrics-2.2.2-py3-none-any.whl | Python 3 | none | any | Details for od_metrics-2.2.2-py3-none-any.whl |
Total release size: 49.6 kB
Release files / od_metrics-2.2.2.tar.gz
| Download URL | od_metrics-2.2.2.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fa38dfec272b8babc868e5cabed246ee1c97a7bc396771a758734e28701cd55
|
|
BLAKE2b-256 checksum How to use checksums |
840c5c1084987f15a5a997ef3c06aa5b8a001c1fc812b158edf53554483b8ec6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / od_metrics-2.2.2-py3-none-any.whl
| Download URL | od_metrics-2.2.2-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c0009b173711c2a82dd910127981b293cdacfa7245b5d5c27853ed94af68f85
|
|
BLAKE2b-256 checksum How to use checksums |
2611a61cb38fa15a1d306c5d4cd0e6136a95a4da24d889743f63c8b958b4537c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for od-metrics 2.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.