Skip to main content

Calculate mAP for CSV format detection result

Project description

Function to calculate mean average precision (mAP) in CSV format for post detection prediction calculation.

Requirements

python 3.*, numpy, pandas, cython(optinal), pyximport(optional)

Installation

pip install CSV-mAP-calculator
pip install CSV-mAP-calculator -i https://pypi.python.org/simple

Usage example:

Path to CSV-files:

from CSV_mAP_calculator import get_csv_mAP

gt_file = 'csvs/gt.csv'
predict_file = 'csvs/predictions.csv'
mean_ap, average_precisions = get_csv_mAP(gt_file, predict_file, iou_threshold=0.5)

Or numpy arrays of shapes (N, 6) and (M, 7).

from CSV_mAP_calculator import get_csv_mAP
import pandas as pd

gt = pd.read_csv('csvs/gt.csv', header=None, names=['img_path', 'x1', 'y1', 'x2', 'y2','conf', 'label']).values
pred = pd.read_csv('csvs/predictions.csv', header=None, names=['img_path', 'x1', 'y1', 'x2', 'y2', 'label']).values
mean_ap, average_precisions = get_csv_mAP(gt, pred)

Input files format

  • Annotation CSV-file:
'img_path','x1','y1','x2','y2','label'
path/imgname1.jpg,0,0,511,511,cat1
path/imgname2.jpg,122,247,666,799,cat2
...
  • Detection CSV-file:
'img_path','x1','y1','x2','y2','conf','label'
path/imgname1.jpg,0,0,511,511,0.8958333,cat1
path/imgname1.jpg,121,32,511,242.5,0.9998,cat2
path/imgname2.jpg,0,0,511,511,0.8958333,cat3
...
  • Return should be like:
Number of files in annotations: 7283
Number of files in predictions: 7282
Unique classes: 3
Detections length: 7282
Annotations length: 7283
cat1                 | 0.917434 |    2445
cat2                 | 0.861768 |    2400
cat3                 | 0.930730 |    2438
mAP: 0.903311
0.903310916116078

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csv-mAP-calculator-0.1.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csv_mAP_calculator-0.1.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file csv-mAP-calculator-0.1.3.tar.gz.

File metadata

  • Download URL: csv-mAP-calculator-0.1.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

File hashes

Hashes for csv-mAP-calculator-0.1.3.tar.gz
Algorithm Hash digest
SHA256 50fad4732414f0a591d10f14dfa28e3b5f4521df8dd383dbde88fc301395ddc7
MD5 759114f2834ab19dfc6218c177d1e2dd
BLAKE2b-256 138f42c5a461a56b89eaf1e7568b67761ab422de6652250cc145b245ab2cf329

See more details on using hashes here.

File details

Details for the file csv_mAP_calculator-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: csv_mAP_calculator-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

File hashes

Hashes for csv_mAP_calculator-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2aa8b5dd3e4191a703e0b887ffa3250aa5e5b2c0a662f4d20efecfda45ce1afa
MD5 5ff27d0a9c24fb877610ba6c19432129
BLAKE2b-256 f50de28d1c6ad6abe55eec3c02d3654eceebe2012cee1def629d9a55d613a9d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page