Metadata-Version: 2.1
Name: object-detection-metrics
Version: 0.3
Summary: Object Detection Metrics
Home-page: https://github.com/bionlplab/object_detection_metrics'
Author: Yifan Peng
Author-email: yip4002@med.cornell.edu
License: MIT License
Keywords: object detection metrics
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Text Processing
Classifier: Topic :: Software Development
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: rest
License-File: LICENSE

[![Build status](https://github.com/yfpeng/object_detection_metrics/actions/workflows/pytest.yml/badge.svg)](https://github.com/yfpeng/object_detection_metrics/)
[![Latest version on PyPI](https://img.shields.io/pypi/v/object_detection_metrics.svg)](https://pypi.python.org/pypi/object_detection_metrics)
[![License](https://img.shields.io/pypi/l/object_detection_metrics.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Downloads](https://img.shields.io/pypi/dm/object_detection_metrics.svg)](https://pypi.python.org/pypi/object_detection_metrics)
[![Pythong version](https://img.shields.io/pypi/pyversions/object_detection_metrics)](https://pypi.python.org/pypi/object_detection_metrics)
[![codecov](https://codecov.io/gh/yfpeng/object_detection_metrics/branch/master/graph/badge.svg?token=m4mJ9fD88s)](https://codecov.io/gh/yfpeng/object_detection_metrics)
[![Hits](https://hits.dwyl.com/yfpeng/object_detection_metrics.svg)](https://hits.dwyl.com/yfpeng/object_detection_metrics)


This project was forked from [rafaelpadilla/Object-Detection-Metrics](https://github.com/rafaelpadilla/Object-Detection-Metrics).

## Getting started

Installing `object_detection_metrics`

```shell
$ pip install object_detection_metrics
```

Reading Josn file

```python
import podm
bounding_boxes = podm.load_data('tests/sample_2/groundtruths.json')
```

Reading COCO file

```python
import podm
bounding_boxes = podm.load_data_coco('tests/sample_2/groundtruths_coco.json')
```

PASCAL VOC Metrics

```python
import podm
gt_BoundingBoxes = podm.load_data('tests/sample_2/groundtruths.json')
pd_BoundingBoxes = podm.load_data('tests/sample_2/detections.json')
results = podm.get_pascal_voc_metrics(gt_BoundingBoxes, pd_BoundingBoxes, .5)
```

ap, precision, recall, tp, fp, etc

```python
for cls, metric in actuals.items():
    label = m.label
    print('ap', metric.ap)
    print('precision', metric.precision)
    print('interpolated_recall', metric.interpolated_recall)
    print('interpolated_precision', metric.interpolated_precision)
    print('tp', metric.tp)
    print('fp', metric.fp)
    print('num_groundtruth', metric.num_groundtruth)
    print('num_detection', metric.num_detection)
```

mAP

```python
from podm import MetricPerClass
mAP = MetricPerClass.mAP(results)
```

IoU

```python
box1 = Box(0., 0., 10., 10.)
box2 = Box(1., 1., 11., 11.)
Box.intersection_over_union(box1, box2)
```

## Implemented metrics

[Tutorial](https://medium.com/@jonathan_hui/map-mean-average-precision-for-object-detection-45c121a31173)

-   Intersection Over Union (IOU)
-   TP and FP
    -   True Positive (TP): IOU ≥ *IOU threshold* (default: 0.5)
    -   False Positive (FP): IOU \< *IOU threshold* (default: 0.5)
-   Precision and Recall
-   Average Precision
    -   11-point AP
    -   all-point AP


