• Stars
    star
    194
  • Rank 200,219 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mean Average Precision for Object Detection

mAP: Mean Average Precision for Object Detection

A simple library for the evaluation of object detectors.

Downloads Downloads Downloads

In practice, a higher mAP value indicates a better performance of your detector, given your ground-truth and set of classes.

Install package

pip install mean_average_precision

Install the latest version

pip install --upgrade git+https://github.com/bes-dev/mean_average_precision.git

Example

import numpy as np
from mean_average_precision import MetricBuilder

# [xmin, ymin, xmax, ymax, class_id, difficult, crowd]
gt = np.array([
    [439, 157, 556, 241, 0, 0, 0],
    [437, 246, 518, 351, 0, 0, 0],
    [515, 306, 595, 375, 0, 0, 0],
    [407, 386, 531, 476, 0, 0, 0],
    [544, 419, 621, 476, 0, 0, 0],
    [609, 297, 636, 392, 0, 0, 0]
])

# [xmin, ymin, xmax, ymax, class_id, confidence]
preds = np.array([
    [429, 219, 528, 247, 0, 0.460851],
    [433, 260, 506, 336, 0, 0.269833],
    [518, 314, 603, 369, 0, 0.462608],
    [592, 310, 634, 388, 0, 0.298196],
    [403, 384, 517, 461, 0, 0.382881],
    [405, 429, 519, 470, 0, 0.369369],
    [433, 272, 499, 341, 0, 0.272826],
    [413, 390, 515, 459, 0, 0.619459]
])

# print list of available metrics
print(MetricBuilder.get_metrics_list())

# create metric_fn
metric_fn = MetricBuilder.build_evaluation_metric("map_2d", async_mode=True, num_classes=1)

# add some samples to evaluation
for i in range(10):
    metric_fn.add(preds, gt)

# compute PASCAL VOC metric
print(f"VOC PASCAL mAP: {metric_fn.value(iou_thresholds=0.5, recall_thresholds=np.arange(0., 1.1, 0.1))['mAP']}")

# compute PASCAL VOC metric at the all points
print(f"VOC PASCAL mAP in all points: {metric_fn.value(iou_thresholds=0.5)['mAP']}")

# compute metric COCO metric
print(f"COCO mAP: {metric_fn.value(iou_thresholds=np.arange(0.5, 1.0, 0.05), recall_thresholds=np.arange(0., 1.01, 0.01), mpolicy='soft')['mAP']}")

More Repositories

1

stable_diffusion.openvino

Python
1,539
star
2

MobileStyleGAN.pytorch

An official implementation of MobileStyleGAN in PyTorch
Python
671
star
3

crnn-pytorch

Pytorch implementation of OCR system using CRNN + CTCLoss
Python
217
star
4

random_face

A simple python library for fast image generation of people who do not exist.
Python
182
star
5

mpl.pytorch

Pytorch implementation of MaxPoolingLoss.
Python
175
star
6

thinkpad_x1_carbon_6th_linux

Linux configuration guide for Thinkpad x1 Carbon 6th Gen (2018)
Shell
146
star
7

pytorch_clip_guided_loss

A simple library that implements CLIP guided loss in PyTorch.
Python
77
star
8

VIBE

VIBE Background Subtractior
C++
67
star
9

pytorch_clip_bbox

Pytorch based library to rank predicted bounding boxes using text/image user's prompts.
Python
51
star
10

ESOINN

An enhanced self-organizing incremental neural network for online unsupervised learning
C++
29
star
11

vqvae_dwt_distiller.pytorch

Python
26
star
12

HandDetector

Hand and Fingertip Detecot with OpenCV
C++
25
star
13

SOINN

Self-Organizing and Incremental Neural Networks
C++
20
star
14

haar_pytorch

Pytorch implementation of forward and inverse Haar Wavelets 2D
Python
18
star
15

libGNG

Growing Neural Gas
C++
12
star
16

story-diffusion-runpod-serverless-worker

StoryDiffusion serverless worker
Python
12
star
17

stable_diffusion_quantizer.pytorch

Custom pipelines for stable diffusion model
Python
6
star
18

pytorch_clip_interrogator

Image-to-prompt reconstruction.
Python
4
star
19

smart_pdf

Summarize PDF by LLM
Python
4
star
20

SandboxCV

SandboxCV: sandbox for some computer vision algorithms
C++
2
star
21

pytorch_clip

Pytorch API to work with CLIP models.
Python
2
star
22

random_prompt

Random Prompt generator for ArtWork creation
Python
2
star
23

tts-runpod-serverless-worker

Serverless implementation of Text-To-Speech
Python
2
star
24

PTAM

Implementation of the PTAM as crossplatform library
C++
1
star
25

pybind11_template

Template of python wrapper for C++ class using pybind11+CMake
Python
1
star
26

CloudsStitcher

Framework for stitching point clouds
C++
1
star
27

image_to_sticker

Convert image to sticker
Python
1
star
28

text_to_speech_lab

Some experiments with TTS pipelines
Python
1
star