{"id":21836767,"url":"https://github.com/bes-dev/mean_average_precision","last_synced_at":"2025-04-04T21:11:28.886Z","repository":{"id":42617986,"uuid":"268089959","full_name":"bes-dev/mean_average_precision","owner":"bes-dev","description":"Mean Average Precision for Object Detection","archived":false,"fork":false,"pushed_at":"2024-01-05T20:17:06.000Z","size":129,"stargazers_count":198,"open_issues_count":11,"forks_count":31,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-28T20:11:22.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bes-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-30T13:56:29.000Z","updated_at":"2025-03-23T14:53:42.000Z","dependencies_parsed_at":"2024-06-18T18:38:33.210Z","dependency_job_id":"e2f07cae-a71d-4c7b-b4ec-99a90462d3fa","html_url":"https://github.com/bes-dev/mean_average_precision","commit_stats":{"total_commits":36,"total_committers":5,"mean_commits":7.2,"dds":0.5,"last_synced_commit":"c30ea439680416f600781022eb6f1f8032d88647"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Fmean_average_precision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Fmean_average_precision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Fmean_average_precision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Fmean_average_precision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bes-dev","download_url":"https://codeload.github.com/bes-dev/mean_average_precision/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249534,"owners_count":20908212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T20:42:41.113Z","updated_at":"2025-04-04T21:11:28.868Z","avatar_url":"https://github.com/bes-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mAP: Mean Average Precision for Object Detection\n\nA simple library for the evaluation of object detectors.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"resources/img0.jpeg\"/\u003e\n\u003c/p\u003e\n\n[![Downloads](https://pepy.tech/badge/mean-average-precision)](https://pepy.tech/project/mean-average-precision)\n[![Downloads](https://pepy.tech/badge/mean-average-precision/month)](https://pepy.tech/project/mean-average-precision)\n[![Downloads](https://pepy.tech/badge/mean-average-precision/week)](https://pepy.tech/project/mean-average-precision)\n\n\nIn practice, a **higher mAP** value indicates a **better performance** of your detector, given your ground-truth and set of classes.\n\n## Install package\n\n```bash\npip install mean_average_precision\n```\n\n## Install the latest version\n\n```bash\npip install --upgrade git+https://github.com/bes-dev/mean_average_precision.git\n```\n\n## Example\n```python\nimport numpy as np\nfrom mean_average_precision import MetricBuilder\n\n# [xmin, ymin, xmax, ymax, class_id, difficult, crowd]\ngt = np.array([\n    [439, 157, 556, 241, 0, 0, 0],\n    [437, 246, 518, 351, 0, 0, 0],\n    [515, 306, 595, 375, 0, 0, 0],\n    [407, 386, 531, 476, 0, 0, 0],\n    [544, 419, 621, 476, 0, 0, 0],\n    [609, 297, 636, 392, 0, 0, 0]\n])\n\n# [xmin, ymin, xmax, ymax, class_id, confidence]\npreds = np.array([\n    [429, 219, 528, 247, 0, 0.460851],\n    [433, 260, 506, 336, 0, 0.269833],\n    [518, 314, 603, 369, 0, 0.462608],\n    [592, 310, 634, 388, 0, 0.298196],\n    [403, 384, 517, 461, 0, 0.382881],\n    [405, 429, 519, 470, 0, 0.369369],\n    [433, 272, 499, 341, 0, 0.272826],\n    [413, 390, 515, 459, 0, 0.619459]\n])\n\n# print list of available metrics\nprint(MetricBuilder.get_metrics_list())\n\n# create metric_fn\nmetric_fn = MetricBuilder.build_evaluation_metric(\"map_2d\", async_mode=True, num_classes=1)\n\n# add some samples to evaluation\nfor i in range(10):\n    metric_fn.add(preds, gt)\n\n# compute PASCAL VOC metric\nprint(f\"VOC PASCAL mAP: {metric_fn.value(iou_thresholds=0.5, recall_thresholds=np.arange(0., 1.1, 0.1))['mAP']}\")\n\n# compute PASCAL VOC metric at the all points\nprint(f\"VOC PASCAL mAP in all points: {metric_fn.value(iou_thresholds=0.5)['mAP']}\")\n\n# compute metric COCO metric\nprint(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']}\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbes-dev%2Fmean_average_precision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbes-dev%2Fmean_average_precision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbes-dev%2Fmean_average_precision/lists"}