• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    Python
  • Created about 5 years ago
  • Updated almost 2 years ago

Reviews

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

Repository Details

Function to calculate mAP for set of detected boxes and annotated boxes.

Function to calculate mean average precision (mAP) for set of boxes. Useful for object detection pipelines.

Requirements

python 3.*, numpy, pandas

Installation

pip install map-boxes

Usage example:

You can provide paths to CSV-files:

from map_boxes import mean_average_precision_for_boxes

annotations_file = 'example/annotations.csv'
detections_file = 'example/detections.csv'
mean_ap, average_precisions = mean_average_precision_for_boxes(annotations_file, detections_file)

or you can pass directly numpy arrays of shapes (N, 6) and (M, 7). Be careful about order of variables in arrays!:

from map_boxes import mean_average_precision_for_boxes
import pandas as pd

ann = pd.read_csv('example/annotations.csv')
det = pd.read_csv('example/detections.csv')
ann = ann[['ImageID', 'LabelName', 'XMin', 'XMax', 'YMin', 'YMax']].values
det = det[['ImageID', 'LabelName', 'Conf', 'XMin', 'XMax', 'YMin', 'YMax']].values
mean_ap, average_precisions = mean_average_precision_for_boxes(ann, det)

Input files format

Boxes must be in normalized form e.g. coordinates must be in range: [0, 1]. To normalize pixel values you need to recalculate them as: x_norm = x / width, y_norm = y / height

  • Annotation CSV-file:
ImageID,LabelName,XMin,XMax,YMin,YMax
i0.jpg,Shellfish,0.0875,0.8171875,0.35625,0.8958333
i0.jpg,Seafood,0.0875,0.8171875,0.35625,0.8958333
i1.jpg,Tin can,0.1296875,0.3375,0.31875,0.68958336
i1.jpg,Drink,0.4234375,0.546875,0.58958334,0.92083335
i1.jpg,Drink,0.5375,0.7375,0.16666667,0.575
...
  • Detection CSV-file:
ImageID,LabelName,Conf,XMin,XMax,YMin,YMax
i0.jpg,Turtle,0.41471,0.1382,0.7440,0.3585,0.8951
i0.jpg,Reptile,0.32093,0.1391,0.7439,0.3582,0.8944
i0.jpg,Seahorse,0.11860,0.1393,0.7434,0.3589,0.8943
i0.jpg,Caterpillar,0.11275,0.1390,0.7438,0.3588,0.8948
i1.jpg,Personal care,0.42326,0.2624,0.5473,0.1112,0.7274
i1.jpg,Personal care,0.31120,0.1318,0.3381,0.3149,0.6863
i1.jpg,Personal care,0.34866,0.4277,0.5446,0.5861,0.9211
i1.jpg,Blender,0.10578,0.7678,0.9476,0.2674,0.5847
...

More Repositories

1

Weighted-Boxes-Fusion

Set of methods to ensemble boxes from different object detection models, including implementation of "Weighted boxes fusion (WBF)" method.
Python
1,719
star
2

Keras-RetinaNet-for-Open-Images-Challenge-2018

Code for 15th place in Kaggle Google AI Open Images - Object Detection Track
Python
266
star
3

Verilog-Generator-of-Neural-Net-Digit-Detector-for-FPGA

Verilog Generator of Neural Net Digit Detector for FPGA
Verilog
264
star
4

ZF_UNET_224_Pretrained_Model

Modification of convolutional neural net "UNET" for image segmentation in Keras framework
Python
213
star
5

volumentations

Library for 3D augmentations
Python
177
star
6

Keras-inference-time-optimizer

Optimize layers structure of Keras model to reduce computation time
Python
156
star
7

MobileNet-in-FPGA

Generator of verilog description for FPGA MobileNet implementation
Verilog
120
star
8

MVSEP-MDX23-music-separation-model

Model for MDX23 music separation contest
Python
102
star
9

classification_models_3D

Set of models for classifcation of 3D volumes
Python
93
star
10

KAGGLE_DISTRACTED_DRIVER

Solutions
Python
93
star
11

segmentation_models_3D

Set of models for segmentation of 3D volumes
Python
89
star
12

Kaggle-Planet-Understanding-the-Amazon-from-Space

3rd place solution
Python
64
star
13

Keras-Mask-RCNN-for-Open-Images-2019-Instance-Segmentation

Code and pre-trained models for Instance Segmentation track in Open Images Dataset
Python
56
star
14

efficientnet_3D

EfficientNets in 3D variant for keras and TF.keras
Python
51
star
15

Keras-augmentation-layer

Keras implementation of layer which performs augmentations of images using GPU.
Python
49
star
16

VGG16-Pretrained-C

Pretrained VGG16 neural net in C language
C
45
star
17

2nd-place-solution-for-VinBigData-Chest-X-ray-Abnormalities-Detection

Localization of thoracic abnormalities model based on VinBigData (top 1%)
Python
36
star
18

KAGGLE_CERVICAL_CANCER_2017

Python
33
star
19

DrivenData-Alzheimer-Research-1st-place-solution

1st place solution for Clog Loss: Advance Alzheimer’s Research with Stall Catchers
Python
22
star
20

classification_models_1D

Classification models 1D Zoo - Keras and TF.Keras
Python
13
star
21

DrivenData-Identify-Fish-Challenge-2nd-Place-Solution

Solution for N+1 fish, N+2 fish DrivenData competition (2nd place)
Python
12
star
22

Covid-19-spread-prediction

Automatic short-term covid-19 spread prediction by countries and Russian regions
Python
10
star
23

MVSEP-CDX23-Cinematic-Sound-Demixing

Model for CDX23 (Cinematic Sound Demixing) contest
Python
9
star
24

DrivenData-Pri-matrix-Factorization-2nd-Place-Solution

DrivenData Pri-matrix Factorization (2nd place solution)
Python
8
star
25

DrivenData-Open-AI-Caribbean-Challenge-2nd-place-solution

Code for DrivenData Open AI Caribbean Challenge. 2nd place solution.
Python
7
star
26

VOTS2023-Challenge-Tracker

Code for VOTS2023 Challenge tracker
Python
7
star
27

KAGGLE_AVITO_2016

Avito Duplicate Ads Detection
Python
6
star
28

MobileNet-v1-Pytorch

MobileNet v1 in Pytorch. Weights converted from Keras implementation
Python
5
star
29

Post-Training-Integer-Quantization

Some examples of quantization process
Python
3
star
30

Audio-separation-models-checker

Python
3
star
31

demucs3

Fork of demucs repository
Python
3
star
32

KAGGLE_YELP

Solutions
Python
3
star
33

KAGGLE_DSB2

Solutions
Python
1
star
34

Pretrained-VGG-neural-nets-in-TensorFlow

Set of VGG neural net models for TensorFlow. Weights converted from Pytorch.
Python
1
star