-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* exclude examples * update load_json * add keypoints_crowd * format * fix hook * fix linter * upd history * bump version
- Loading branch information
Showing
14 changed files
with
1,828 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<https://github.com/jin-s13/xtcocoapi/blob/master/demos/demo_crowdpose.py>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"faster_coco_eval.__version__='1.6.4'\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import logging\n", | ||
"import numpy as np\n", | ||
"import faster_coco_eval\n", | ||
"from faster_coco_eval import COCO, COCOeval_faster\n", | ||
"\n", | ||
"print(f\"{faster_coco_eval.__version__=}\")\n", | ||
"\n", | ||
"logging.root.setLevel(\"INFO\")\n", | ||
"logging.debug(\"Запись.\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"gt_file = '../tests/dataset/example_crowdpose_val.json'\n", | ||
"preds = '../tests/dataset/example_crowdpose_preds.json'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sigmas = np.array([\n", | ||
" .79, .79, .72, .72, .62, .62, 1.07, 1.07, .87, .87, .89, .89, .79,\n", | ||
" .79\n", | ||
" ]) / 10.0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"INFO:faster_coco_eval.core.cocoeval:Evaluate annotation type *keypoints_crowd*\n", | ||
"INFO:faster_coco_eval.core.cocoeval:COCOeval_opt.evaluate() finished...\n", | ||
"INFO:faster_coco_eval.core.cocoeval:DONE (t=0.00s).\n", | ||
"INFO:faster_coco_eval.core.cocoeval:Accumulating evaluation results...\n", | ||
"INFO:faster_coco_eval.core.cocoeval:COCOeval_opt.accumulate() finished...\n", | ||
"INFO:faster_coco_eval.core.cocoeval:DONE (t=0.00s).\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets= 20 ] = 0.788\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Precision (AP) @[ IoU=0.50 | area= all | maxDets= 20 ] = 0.988\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Precision (AP) @[ IoU=0.75 | area= all | maxDets= 20 ] = 0.731\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 20 ] = 0.822\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Recall (AR) @[ IoU=0.50 | area= all | maxDets= 20 ] = 1.000\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Recall (AR) @[ IoU=0.75 | area= all | maxDets= 20 ] = 0.778\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Precision (AP) @[ IoU=0.50:0.95 | type= easy | maxDets= 20 ] = 1.000\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Precision (AP) @[ IoU=0.50:0.95 | type=medium | maxDets= 20 ] = 0.980\n", | ||
"INFO:faster_coco_eval.core.cocoeval: Average Precision (AP) @[ IoU=0.50:0.95 | type= hard | maxDets= 20 ] = 0.412\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"{'AP_all': 0.7877215935879303,\n", | ||
" 'AP_50': 0.9881188118811886,\n", | ||
" 'AP_75': 0.7314356435643564,\n", | ||
" 'AR_all': 0.8222222222222223,\n", | ||
" 'AR_50': 1.0,\n", | ||
" 'AR_75': 0.7777777777777778,\n", | ||
" 'AP_easy': 1.0,\n", | ||
" 'AP_medium': 0.9802,\n", | ||
" 'AP_hard': 0.4116}" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"cocoGt = COCO(gt_file)\n", | ||
"cocoDt = cocoGt.loadRes(preds)\n", | ||
"cocoEval = COCOeval_faster(cocoGt, cocoDt, 'keypoints_crowd', kpt_oks_sigmas=sigmas, use_area=False)\n", | ||
"cocoEval.evaluate()\n", | ||
"cocoEval.accumulate()\n", | ||
"cocoEval.summarize()\n", | ||
"\n", | ||
"cocoEval.stats_as_dict" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Orig Code\n", | ||
"\n", | ||
"```py\n", | ||
"from xtcocotools.coco import COCO\n", | ||
"from xtcocotools.cocoeval import COCOeval\n", | ||
"\n", | ||
"\n", | ||
"cocoGt = COCO(gt_file)\n", | ||
"cocoDt = cocoGt.loadRes(preds)\n", | ||
"cocoEval = COCOeval(cocoGt, cocoDt, 'keypoints_crowd', sigmas, use_area=False)\n", | ||
"cocoEval.evaluate()\n", | ||
"cocoEval.accumulate()\n", | ||
"cocoEval.summarize()\n", | ||
"```\n", | ||
"\n", | ||
"## Orig result\n", | ||
"\n", | ||
"```text\n", | ||
"loading annotations into memory...\n", | ||
"Done (t=0.00s)\n", | ||
"creating index...\n", | ||
"index created!\n", | ||
"Loading and preparing results...\n", | ||
"DONE (t=0.00s)\n", | ||
"creating index...\n", | ||
"index created!\n", | ||
"Running per image evaluation...\n", | ||
"Evaluate annotation type *keypoints_crowd*\n", | ||
"DONE (t=0.00s).\n", | ||
"Accumulating evaluation results...\n", | ||
"DONE (t=0.00s).\n", | ||
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets= 20 ] = 0.788\n", | ||
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets= 20 ] = 0.988\n", | ||
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets= 20 ] = 0.731\n", | ||
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 20 ] = 0.822\n", | ||
" Average Recall (AR) @[ IoU=0.50 | area= all | maxDets= 20 ] = 1.000\n", | ||
" Average Recall (AR) @[ IoU=0.75 | area= all | maxDets= 20 ] = 0.778\n", | ||
" Average Precision (AP) @[ IoU=0.50:0.95 | type= easy | maxDets= 20 ] = 1.000\n", | ||
" Average Precision (AP) @[ IoU=0.50:0.95 | type=medium | maxDets= 20 ] = 0.980\n", | ||
" Average Precision (AP) @[ IoU=0.50:0.95 | type= hard | maxDets= 20 ] = 0.412\n", | ||
"```" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.