https://github.com/triple-mu/np-map
A simple tool for calculating object detection map
https://github.com/triple-mu/np-map
Last synced: 4 months ago
JSON representation
A simple tool for calculating object detection map
- Host: GitHub
- URL: https://github.com/triple-mu/np-map
- Owner: triple-Mu
- Created: 2023-01-17T07:31:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-17T08:22:18.000Z (over 3 years ago)
- Last Synced: 2025-08-12T01:29:22.127Z (10 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# np-map
A simple tool for calculating object detection map .
# Install
```shell
pip install npmap -i https://pypi.org/simple
```
# Usage
```python
from npmap import ConfusionMatrix
matrix = ConfusionMatrix(num_classes=80) # coco 80 classes
# cleanup first
matrix.clean()
for (pred, gt) in zip(preds, gts): # for loop for every images
# pred format x0, y0, x1, y1, scores, labels
# gt format x0, y0, x1, y1, labels
# if there is no gt or pred, please set pred=None or gt=None
matrix.add(pred, gt)
# calculate map, map50, etc.
res = matrix.calculate()
# print map
print(res['map'])
# print map50
print(res['map50'])
# print mar
print(res['mean_recall'])
# print mp
print(res['mean_precision'])
# print per class results
print(res['detail'])
... # so on
```