Skip to content

Instantly share code, notes, and snippets.

@botcs
Created March 1, 2019 22:20
Show Gist options
  • Save botcs/904d96ebb50708f7690f52c831e76018 to your computer and use it in GitHub Desktop.
Save botcs/904d96ebb50708f7690f52c831e76018 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Unit test for COCOWrapper and COCOeval\n",
"\n",
"### 1. Introduce `debugdataset` : \n",
"A demo implementation with the bare minimum functions required to train a new dataset using the `maskrcnn_benchmark` lib, featuring the core fields and methods which must be implemented.\n",
"The dataset generates non-overlapping uniform sized white boxes with annotations.\n",
"The size and number of instances can be controlled.\n",
"\n",
"_Maybe later it could be used for expanding unit tests with training networks on this dataset._\n",
"\n",
"### 2. Introduce `COCOWrapper`: \n",
"An additional layer on the top of the generic `maskrcnn-dataset`, only requiring basic fields and methods to be implemented.\n",
"Only serves the sole purpose to replace the `dataset.coco` dependency, more specifically this wrapper implements functions that the `COCOeval` requires.\n",
" \n",
"### 3. Test on `COCOeval`:\n",
"Using the original implementation from [MS-COCO](https://github.com/cocodataset/cocoapi/tree/master/PythonAPI/pycocotools) test if perfect score can be achieved using the annotations as predictions with 1.0 objectness-score."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import torch\n",
"import numpy as np\n",
"\n",
"from pycocotools.cocoeval import COCOeval\n",
"from maskrcnn_benchmark.data.datasets.evaluation.coco.abstract_cocostyle_eval import COCOWrapper\n",
"import maskrcnn_benchmark.data.datasets.debugdataset as debugdataset\n",
"\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# initialize database\n",
"dataset = debugdataset.DebugDataset(\n",
" dataset_size=100,\n",
" width=640,\n",
" height=480,\n",
" side_length=50, # medium sized instances\n",
" min_num_instances=30, \n",
" max_num_instances=30,\n",
" allow_overlap=False, # the most straightforward case\n",
" transforms=None\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Mimic predictions\n",
"\n",
"Use the same format that `do_coco_evaluation` recieves in the original `maskrcnn_benchmark` implementation [here](https://github.com/facebookresearch/maskrcnn-benchmark/blob/13b4f82efd953276b24ce01f0fd1cd08f94fbaf8/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py#L13)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"predictions = []\n",
"for img, target, idx in dataset:\n",
" target.add_field(\"scores\", torch.ones(len(target))) \n",
" predictions.append(target)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wrap dataset and predictions\n",
"Notice: compared to the current implementation, here `cocoDt` and `cocoGt` is formatted to RLE representation before feeding them to `COCOeval`, and their instances are reused"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO GT annots\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Parsing images: 100%|██████████| 100/100 [00:04<00:00, 24.13it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO Predictions\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Parsing images: 100it [00:01, 80.09it/s]\n"
]
}
],
"source": [
"cocoGt = COCOWrapper(dataset)\n",
"cocoDt = COCOWrapper(dataset, predictions)\n",
"coco_eval_bbox = COCOeval(cocoGt, cocoDt, 'bbox')\n",
"coco_eval_segm = COCOeval(cocoGt, cocoDt, 'segm')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualize one input from the dataset\n",
"`dataset[idx]` returns an `img, target, idx` tuple"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAIAAAC6s0uzAAAIhklEQVR4nO3dS3LbMBQAQTGl+18ZWcRLlaP/AG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mDbyiCvAoEzAABAQYAAICDAABAQaAgAADQECAASAgwAAQEGAACGx1EIeDFwDu4dNyBiZgAAhsNQED32eWgueYgAEgIMAAENhhC9pVPAAsxwQMAAEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAICDAABAQaAgAADQECAASAgwAAQEGAACOxwHSEAu9r4alcTMAAEBBgAAgIMAAEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAICDAABAQaAgMsYYA0bH0kP52QCBoCAAANAQIABICDAABAQYAAICDAABAQYAALeA+YNvKIK8CgTMAAEBBgAAgIMAAEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAKOogRgc2OMegk3mIABICDAABBwiQ0Am7MFDQD8EGAACAgwAAQEGAACAgwAAQEGgIAAA0BAgAEgIMAAEBBgAAgIMAAEBBgAAgIMAAEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAICDAABAQaAgAADQECAASAgwAAQEGAACAgwAAQEGAACAgwAAQEGgIAAA0BAgAEgIMAAEBBgAAgIMAAEBBgAAgIMAAEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAICDAABAQYAAAAAAADYx1/pOWQs7WGWqAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<PIL.Image.Image image mode=RGB size=640x480 at 0x7F66476B9A90>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataset[0][0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### evaluate the results as it is done originally\n",
"\n",
"1. `coco_eval_<type>.evaluate()` sets field `coco_eval_<type>.evalImgs`\n",
"1. `coco_eval_<type>.accumulate()` sets field `coco_eval_<type>.eval`\n",
"1. `coco_eval_<type>.summarize()` computes some specific scores from `coco_eval_<type>.eval` and prints it"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\n",
"DONE (t=2.30s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.02s).\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.300\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.967\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.967\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=2.15s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.02s).\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.928\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.300\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.967\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.967\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PROBLEM! The scores are not perfect (< 1.0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Let's inspect the bug using an even simpler dataset\n",
"\n",
"reduce the dataset size to a single image and the number of instances to 2"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO GT annots\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Parsing images: 100%|██████████| 1/1 [00:00<00:00, 314.65it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO Predictions\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Parsing images: 1it [00:00, 676.61it/s]\n"
]
}
],
"source": [
"num_of_inst = 2\n",
"dataset = debugdataset.DebugDataset(\n",
" dataset_size=1, \n",
" min_num_instances=num_of_inst, \n",
" max_num_instances=num_of_inst\n",
")\n",
"\n",
"predictions = []\n",
"for img, target, idx in dataset:\n",
" target.add_field(\"scores\", torch.ones(len(target))) \n",
" predictions.append(target)\n",
"\n",
"cocoGt = COCOWrapper(dataset)\n",
"cocoDt = COCOWrapper(dataset, predictions)\n",
"coco_eval_bbox = COCOeval(cocoGt, cocoDt, 'bbox')\n",
"coco_eval_segm = COCOeval(cocoGt, cocoDt, 'segm')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAIAAAC6s0uzAAAEgklEQVR4nO3VsQ2DQBAAwX/67/kIHJrAskAbMFPBZrsWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPA2uw4AgD/NTJ1wYe+f3no83QEAfDNgAAgYMAAEDBgAAgYMAAEDBoCAAQNAwIABIGDAABAwYAAIGDAABAwYAAIGDAABAwaAgAEDQMCAASBgwAAQMGAACBgwAAQMGAACBgwAAQMGgIABA0DAgAEgYMAAEDBgAAgYMAAEDBgAAgYMAAEDBoCAAQNAwIABIGDAABAwYAAIGDAABAwYAAIGDAABAwaAgAEDQMCAASBgwAAQMGAACBgwAAQMGAACBgwAAQMGgIABA0DAgAEgYMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB87DoAgKfMTJ1wYW/rWWutow4AgDcyYAAIGDAABAwYAAIGDAABAwaAgAEDQMCAASBgwAAQMGAACBgwAAQMGAACBgwAAQMGgIABA0DAgAEgYMAAEDBgAAgYMAAEDBgAAgYMAAEDBoCAAQNAwIABIGDAABAwYAAIGDAABAwYAAIGDAABAwaAgAEDQMCAASBgwAAQMGAACBgwAAQMGAACBgwAAQMGgIABA0DAgAEgYMAAEDBgAAgYMAAEDBgAAgYMAAEDBoCAAQNAwIABIGDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3O0EqJQGx+8S9bQAAAAASUVORK5CYII=\n",
"text/plain": [
"<PIL.Image.Image image mode=RGB size=640x480 at 0x7F65AC93DA90>"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"img, target, idx = dataset[0]\n",
"img"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualize the masks as well for safety"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 0\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFl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qu/0bM/NPY6fBHx/lUd9DfCWJN8Grmdyif4R5ntmqurQ+HwY+Ecm/0DN8+PjIHCwqvaN/ZuYRHRmM886ml8BzhrvOG5g8gL5LTOe6Ze5Bdg5tncyec3wyPo7xzt3FwBPTV06rJokAa4DHq6qD04dmve5T0uyaWy/iMnrsA8ziefl47Sj5z5yfy4H7hrPNlZNVV1TVVurajuTx+1dVfUO5njmJC9J8rIj28BvAg8wx4+PqnocOJDk18fSxcBDM515NV/U/QUv9F7C5F3ebwJ/Out5pub6NPAY8AyTf+2uZPIa1J3Ao8DngVPGuQH+atyHrwM7ZjTza5lcptwP3Ds+LlkDc/8GcM+Y+wHgz8b6mcCXgQXgH4CNY/3Esb8wjp8548fK6/mfd8/nduYx233j48Ejf9/WwOPjHGD/eHz8E3DyLGf2N4IkqWHWl+eStKYYTUlqMJqS1GA0JanBaEpSg9GUpAajKUkNRlOSGv4btY2Otks13b4AAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 1\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADbRJREFUeJzt3W+MpXV5h/Hr2/2Hf1lAQra7mwKR1PCiBbJBiMYYiC1SI7xAgzF1Y7bZpKWJxiZ2aZM2Jn2hfSFq0miJ2K6NVSjaQggNRcA0feHqKn8EtshoNbtbcKsC2hop6N0X57f0dLs6c7Mzc87g9Ukm8zy/55lz7iFnrz3POTNsqgpJ0tL80qwHkKS1xGhKUoPRlKQGoylJDUZTkhqMpiQ1rEg0k1yW5JEkC0n2rMR9S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kN6i7gUeDzwKnj3AB/Mb6HrwE7ZjTza5lcpjwA3Dc+Ll8Dc/8acO+Y+0HgT8b62cCXgAXg74BNY/2ksb8wjp8948fK6/nfd8/nduYx2/3j46Gjf97WwOPjPGD/eHz8A3DKLGf2N4IkqWHWl+eStKYYTUlqMJqS1GA0JanBaEpSg9GUpAajKUkNRlOSGv4HxMCMS66qcWcAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"for inst_idx, mask in enumerate(target.get_field('masks')):\n",
" print(\"instance:\", inst_idx)\n",
" plt.imshow(mask.get_mask_tensor())\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Now compute the results"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bbox\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\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=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.500\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
"\n",
"\n",
"segm\n",
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\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=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.252\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.500\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"print('bbox')\n",
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()\n",
"print('\\n\\nsegm')\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Scores are even worse\n",
"\n",
"\n",
"### Let's iterate over these fields to find the source:\n",
"1. `coco_eval_<type>.evaluate()` sets field `coco_eval_<type>.evalImgs`\n",
"1. `coco_eval_<type>.accumulate()` sets field `coco_eval_<type>.eval`\n",
"1. `coco_eval_<type>.summarize()` computes some specific scores from `coco_eval_<type>.eval` and prints it"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'image_id': 0,\n",
" 'category_id': 99,\n",
" 'aRng': [0, 10000000000.0],\n",
" 'maxDet': 100,\n",
" 'dtIds': [0, 1],\n",
" 'gtIds': [0, 1],\n",
" 'dtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'gtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'dtScores': [1.0, 1.0],\n",
" 'gtIgnore': array([0, 0]),\n",
" 'dtIgnore': array([[False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False]])},\n",
" {'image_id': 0,\n",
" 'category_id': 99,\n",
" 'aRng': [0, 1024],\n",
" 'maxDet': 100,\n",
" 'dtIds': [0, 1],\n",
" 'gtIds': [0, 1],\n",
" 'dtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'gtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'dtScores': [1.0, 1.0],\n",
" 'gtIgnore': array([1, 1]),\n",
" 'dtIgnore': array([[ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True]])},\n",
" {'image_id': 0,\n",
" 'category_id': 99,\n",
" 'aRng': [1024, 9216],\n",
" 'maxDet': 100,\n",
" 'dtIds': [0, 1],\n",
" 'gtIds': [0, 1],\n",
" 'dtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'gtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'dtScores': [1.0, 1.0],\n",
" 'gtIgnore': array([0, 0]),\n",
" 'dtIgnore': array([[False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False],\n",
" [False, False]])},\n",
" {'image_id': 0,\n",
" 'category_id': 99,\n",
" 'aRng': [9216, 10000000000.0],\n",
" 'maxDet': 100,\n",
" 'dtIds': [0, 1],\n",
" 'gtIds': [0, 1],\n",
" 'dtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'gtMatches': array([[0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.],\n",
" [0., 1.]]),\n",
" 'dtScores': [1.0, 1.0],\n",
" 'gtIgnore': array([1, 1]),\n",
" 'dtIgnore': array([[ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True],\n",
" [ True, True]])}]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"evalImgs = coco_eval_segm.evalImgs\n",
"\n",
"evalImgs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Mostly seems like that the scores and the matches look OK\n",
"\n",
"but for safety, just check it out"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[[1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0]]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dtScores_all = [x['dtScores'] for x in evalImgs]\n",
"dtScores_all"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### test self.eval, which is used to compute scores in self.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/plain": [
"(10, 101, 1, 4, 3)"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coco_eval_segm.eval['precision'].shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## what about the shape?\n",
"\n",
"A quick tutorial extracted from the [source code](https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py)\n",
"```\n",
" # The evaluation parameters are as follows (defaults in brackets):\n",
" # imgIds - [all] N img ids to use for evaluation\n",
" # catIds - [all] K cat ids to use for evaluation\n",
" # iouThrs - [.5:.05:.95] T=10 IoU thresholds for evaluation\n",
" # recThrs - [0:.01:1] R=101 recall thresholds for evaluation\n",
" # areaRng - [...] A=4 object area ranges for evaluation\n",
" # maxDets - [1 10 100] M=3 thresholds on max detections per image\n",
"\n",
" T = len(p.iouThrs)\n",
" R = len(p.recThrs)\n",
" K = len(p.catIds) if p.useCats else 1\n",
" A = len(p.areaRng)\n",
" M = len(p.maxDets)\n",
" precision = -np.ones((T,R,K,A,M)) # -1 for the precision of absent categories\n",
" recall = -np.ones((T,K,A,M))\n",
" scores = -np.ones((T,R,K,A,M))\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"T: [0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95]\n",
"R: [0. 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13\n",
" 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27\n",
" 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41\n",
" 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55\n",
" 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69\n",
" 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83\n",
" 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97\n",
" 0.98 0.99 1. ]\n",
"K: [99]\n",
"A: [[0, 10000000000.0], [0, 1024], [1024, 9216], [9216, 10000000000.0]]\n",
"M: [1, 10, 100]\n"
]
}
],
"source": [
"print('T: ', coco_eval_segm.params.iouThrs)\n",
"print('R: ', coco_eval_segm.params.recThrs)\n",
"print('K: ', coco_eval_segm.params.catIds)\n",
"print('A: ', coco_eval_segm.params.areaRng)\n",
"print('M: ', coco_eval_segm.params.maxDets)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## try reducing thresholds to much smaller tests"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"coco_eval_segm.params.iouThrs = [1.]\n",
"coco_eval_segm.params.recThrs = [.5]"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.500\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.500\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### A bit easier to start with 0.5 having 2 instances than the previous 0.252 mAP score\n",
"\n",
"let's inspect the fields that are used in `coco_eval_<type>.summarize()`, most importantly `coco_eval_<type>.eval['precision']` and `coco_eval_<type>.eval['recall']`"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 1, 1, 4, 3)"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coco_eval_segm.eval['precision'].shape"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[[[[ 0. , 0.5, 0.5],\n",
" [-1. , -1. , -1. ],\n",
" [ 0. , 0.5, 0.5],\n",
" [-1. , -1. , -1. ]]]]])"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coco_eval_segm.eval['precision']"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[[[ 0. , 0.5, 0.5],\n",
" [-1. , -1. , -1. ],\n",
" [ 0. , 0.5, 0.5],\n",
" [-1. , -1. , -1. ]]]])"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coco_eval_segm.eval['recall']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### What can we see?\n",
"\n",
"1. The first dim is reduced to length one, because we are now using only a single `iouThrs=[1.]`\n",
"1. The second dim is the same, since the recall threshold is also reduced to `recThrs=[0.5]`\n",
"1. The third dim is one because there is only a single class, the 'box'\n",
"1. The fourth dim is 4 because there are 4 area ranges that are being tested separately: `all`, `small`, `medium`, `large`. Our boxes have side of 50, therefore they fall into the `medium` category - this is why the second and the third row is filled with `-1`\n",
"1. The fifth dim is 3 because there are three cases tested: when only the top `1`, `10` and `100` detections are taken into consideration only.\n",
"\n",
"Ideally the `coco_eval_segm.eval['precision']` should look like the following:\n",
"```\n",
"array([[[[ 1. , 1. , 1. ],\n",
" [-1. , -1. , -1. ],\n",
" [ 1. , 1. , 1. ],\n",
" [-1. , -1. , -1. ]]]])\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Strange behaviour\n",
"\n",
"if the `recThrs` is increased over `1/num_of_inst` even by the smallest measure, then the precision score falls to zero:"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_segm.params.iouThrs = [1.]\n",
"coco_eval_segm.params.recThrs = [.50000001]\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[[[[ 0., 0., 0.],\n",
" [-1., -1., -1.],\n",
" [ 0., 0., 0.],\n",
" [-1., -1., -1.]]]]])"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coco_eval_segm.eval['precision']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Nothing remains now, let's debug `.accumulate`\n",
"\n",
"copy the whole function from the repo, and hack a `pdb` tracer inside (line 80)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.500\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.500\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.500\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_segm.params.iouThrs = [1.]\n",
"coco_eval_segm.params.recThrs = [.5]\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"import pdb\n",
"import time\n",
"def accumulate(self, p = None):\n",
" '''\n",
" Accumulate per image evaluation results and store the result in self.eval\n",
" :param p: input params for evaluation\n",
" :return: None\n",
" '''\n",
" print('Accumulating evaluation results...')\n",
" tic = time.time()\n",
" if not self.evalImgs:\n",
" print('Please run evaluate() first')\n",
" # allows input customized parameters\n",
" if p is None:\n",
" p = self.params\n",
" p.catIds = p.catIds if p.useCats == 1 else [-1]\n",
" T = len(p.iouThrs)\n",
" R = len(p.recThrs)\n",
" K = len(p.catIds) if p.useCats else 1\n",
" A = len(p.areaRng)\n",
" M = len(p.maxDets)\n",
" precision = -np.ones((T,R,K,A,M)) # -1 for the precision of absent categories\n",
" recall = -np.ones((T,K,A,M))\n",
" scores = -np.ones((T,R,K,A,M))\n",
"\n",
" # create dictionary for future indexing\n",
" _pe = self._paramsEval\n",
" catIds = _pe.catIds if _pe.useCats else [-1]\n",
" setK = set(catIds)\n",
" setA = set(map(tuple, _pe.areaRng))\n",
" setM = set(_pe.maxDets)\n",
" setI = set(_pe.imgIds)\n",
" # get inds to evaluate\n",
" k_list = [n for n, k in enumerate(p.catIds) if k in setK]\n",
" m_list = [m for n, m in enumerate(p.maxDets) if m in setM]\n",
" a_list = [n for n, a in enumerate(map(lambda x: tuple(x), p.areaRng)) if a in setA]\n",
" i_list = [n for n, i in enumerate(p.imgIds) if i in setI]\n",
" I0 = len(_pe.imgIds)\n",
" A0 = len(_pe.areaRng)\n",
" # retrieve E at each category, area range, and max number of detections\n",
" for k, k0 in enumerate(k_list):\n",
" Nk = k0*A0*I0\n",
" for a, a0 in enumerate(a_list):\n",
" Na = a0*I0\n",
" for m, maxDet in enumerate(m_list):\n",
" E = [self.evalImgs[Nk + Na + i] for i in i_list]\n",
" E = [e for e in E if not e is None]\n",
" if len(E) == 0:\n",
" continue\n",
" dtScores = np.concatenate([e['dtScores'][0:maxDet] for e in E])\n",
"\n",
" # different sorting method generates slightly different results.\n",
" # mergesort is used to be consistent as Matlab implementation.\n",
" inds = np.argsort(-dtScores, kind='mergesort')\n",
" dtScoresSorted = dtScores[inds]\n",
"\n",
" dtm = np.concatenate([e['dtMatches'][:,0:maxDet] for e in E], axis=1)[:,inds]\n",
" dtIg = np.concatenate([e['dtIgnore'][:,0:maxDet] for e in E], axis=1)[:,inds]\n",
" gtIg = np.concatenate([e['gtIgnore'] for e in E])\n",
" npig = np.count_nonzero(gtIg==0 )\n",
" if npig == 0:\n",
" continue\n",
" tps = np.logical_and( dtm, np.logical_not(dtIg) )\n",
" fps = np.logical_and(np.logical_not(dtm), np.logical_not(dtIg) )\n",
"\n",
" tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float)\n",
" fp_sum = np.cumsum(fps, axis=1).astype(dtype=np.float)\n",
" for t, (tp, fp) in enumerate(zip(tp_sum, fp_sum)):\n",
" tp = np.array(tp)\n",
" fp = np.array(fp)\n",
" nd = len(tp)\n",
" rc = tp / npig\n",
" pr = tp / (fp+tp+np.spacing(1))\n",
" q = np.zeros((R,))\n",
" ss = np.zeros((R,))\n",
" \n",
"#################################################################################################### \n",
"######################## PDB ################################################################ \n",
"#################################################################################################### \n",
" pdb.set_trace()\n",
"####################################################################################################\n",
"#################################################################################################### \n",
"#################################################################################################### \n",
" \n",
" if nd:\n",
" recall[t,k,a,m] = rc[-1]\n",
" else:\n",
" recall[t,k,a,m] = 0\n",
"\n",
" # numpy is slow without cython optimization for accessing elements\n",
" # use python array gets significant speed improvement\n",
" pr = pr.tolist(); q = q.tolist()\n",
"\n",
" for i in range(nd-1, 0, -1):\n",
" if pr[i] > pr[i-1]:\n",
" pr[i-1] = pr[i]\n",
"\n",
" inds = np.searchsorted(rc, p.recThrs, side='left')\n",
" try:\n",
" for ri, pi in enumerate(inds):\n",
" q[ri] = pr[pi]\n",
" ss[ri] = dtScoresSorted[pi]\n",
" except:\n",
" pass\n",
" precision[t,:,k,a,m] = np.array(q)\n",
" scores[t,:,k,a,m] = np.array(ss)\n",
" self.eval = {\n",
" 'params': p,\n",
" 'counts': [T, R, K, A, M],\n",
" 'date': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),\n",
" 'precision': precision,\n",
" 'recall': recall,\n",
" 'scores': scores,\n",
" }\n",
" toc = time.time()\n",
" print('DONE (t={:0.2f}s).'.format( toc-tic))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Debug:\n",
"\n",
"the debugger will stop at the computation of each entry (row-major) of this array:\n",
"```\n",
"array([[[[ 0. , 0.5, 0.5],\n",
" [-1. , -1. , -1. ],\n",
" [ 0. , 0.5, 0.5],\n",
" [-1. , -1. , -1. ]]]])\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 80,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Accumulating evaluation results...\n",
"> <ipython-input-79-2b2fdef2e0f1>(85)accumulate()\n",
"-> if nd:\n",
"(Pdb) tps\n",
"array([[False]])\n",
"(Pdb) fps\n",
"array([[ True]])\n",
"(Pdb) print('Only a single detection is allowed, and it is listed as a false-positive detection')\n",
"Only a single detection is allowed, and it is listed as a false-positive detection\n",
"(Pdb) c\n",
"> <ipython-input-79-2b2fdef2e0f1>(80)accumulate()\n",
"-> pdb.set_trace()\n",
"(Pdb) tps\n",
"array([[False, True]])\n",
"(Pdb) fps\n",
"array([[ True, False]])\n",
"(Pdb) tp\n",
"array([0., 1.])\n",
"(Pdb) fp\n",
"array([1., 1.])\n",
"(Pdb) print('something is fishy again...')\n",
"something is fishy again...\n",
"(Pdb) tps_sum\n",
"*** NameError: name 'tps_sum' is not defined\n",
"(Pdb) tp_sum\n",
"array([[0., 1.]])\n",
"(Pdb) fp_sum\n",
"array([[1., 1.]])\n",
"(Pdb) print('this is possibly the result of the np.cumsum')\n",
"this is possibly the result of the np.cumsum\n",
"(Pdb) tp\n",
"array([0., 1.])\n",
"(Pdb) tp / npig #this is assigned to the recall score\n",
"array([0. , 0.5])\n",
"(Pdb) print('more specifically the last entry of this')\n",
"more specifically the last entry of this\n",
"(Pdb) (tp / npig)[-1]\n",
"0.5\n",
"(Pdb) tp / (fp+tp+np.spacing(1)) #this is assigned to the precision score\n",
"array([0. , 0.5])\n",
"(Pdb) print('I have completely no intuition about how this will be exactly assigned to the precision score')\n",
"I have completely no intuition about how this will be exactly assigned to the precision score\n",
"(Pdb) exit\n"
]
},
{
"ename": "BdbQuit",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mBdbQuit\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-80-4467590f2895>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0maccumulate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcoco_eval_segm\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m<ipython-input-79-2b2fdef2e0f1>\u001b[0m in \u001b[0;36maccumulate\u001b[0;34m(self, p)\u001b[0m\n\u001b[1;32m 78\u001b[0m \u001b[0;31m######################## PDB ################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 79\u001b[0m \u001b[0;31m####################################################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 80\u001b[0;31m \u001b[0mpdb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_trace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 81\u001b[0m \u001b[0;31m####################################################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 82\u001b[0m \u001b[0;31m####################################################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-79-2b2fdef2e0f1>\u001b[0m in \u001b[0;36maccumulate\u001b[0;34m(self, p)\u001b[0m\n\u001b[1;32m 78\u001b[0m \u001b[0;31m######################## PDB ################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 79\u001b[0m \u001b[0;31m####################################################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 80\u001b[0;31m \u001b[0mpdb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_trace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 81\u001b[0m \u001b[0;31m####################################################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 82\u001b[0m \u001b[0;31m####################################################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/anaconda3/envs/debugmask/lib/python3.7/bdb.py\u001b[0m in \u001b[0;36mtrace_dispatch\u001b[0;34m(self, frame, event, arg)\u001b[0m\n\u001b[1;32m 86\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;31m# None\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 87\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mevent\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'line'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 88\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdispatch_line\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 89\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mevent\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'call'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 90\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdispatch_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0marg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/anaconda3/envs/debugmask/lib/python3.7/bdb.py\u001b[0m in \u001b[0;36mdispatch_line\u001b[0;34m(self, frame)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstop_here\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbreak_here\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0muser_line\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 113\u001b[0;31m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mquitting\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mBdbQuit\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 114\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrace_dispatch\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mBdbQuit\u001b[0m: "
]
}
],
"source": [
"accumulate(coco_eval_segm)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Conclusion:\n",
"The debugging suggests that the ordering of the annotations could be misaligned, leading to false positive entries which will reduce the score"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<pre>\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"</pre>\n",
"### A few more cases with increasing number of instances"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO GT annots\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Parsing images: 100%|██████████| 1/1 [00:00<00:00, 213.83it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO Predictions\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Parsing images: 1it [00:00, 521.03it/s]\n"
]
}
],
"source": [
"num_of_inst = 3\n",
"dataset = debugdataset.DebugDataset(\n",
" dataset_size=1, \n",
" min_num_instances=num_of_inst, \n",
" max_num_instances=num_of_inst\n",
")\n",
"\n",
"predictions = []\n",
"for img, target, idx in dataset:\n",
" target.add_field(\"scores\", torch.ones(len(target))) \n",
" predictions.append(target)\n",
"\n",
"cocoGt = COCOWrapper(dataset)\n",
"cocoDt = COCOWrapper(dataset, predictions)\n",
"coco_eval_bbox = COCOeval(cocoGt, cocoDt, 'bbox')\n",
"coco_eval_segm = COCOeval(cocoGt, cocoDt, 'segm')"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAIAAAC6s0uzAAAEuElEQVR4nO3duwoCQRQFQa/4/798TQ1E8UUrVqWbnGChmWCYwwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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DA90>"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"img, target, idx = dataset[0]\n",
"img"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualize the masks as well for safety"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 0\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADbJJREFUeJzt3X+s3XV9x/Hna/QH/qSAhHRts2IkM/yxAWkQojEG4obMCH+gwZjZmC5NNpZoXOJgS7aY7A/dH6Imi64Rt7o4haEbDWFhCJhlf1it8kOgQ65O03ZgpwK6GRnoe3+cT91ZV733Te+951x8PpKb+/1+vt97zvuQ02fPj3toqgpJ0tL80qwHkKS1xGhKUoPRlKQGoylJDUZTkhqMpiQ1rEg0k1ye5JEkC0muW4nrkKRZyHL/nmaSU4CvAa8HDgNfAt5aVQ8v6xVJ0gysxCPNi4CFqvpGVf038GngyhW4HkladetW4DK3AIem9g8Dr/p5P7AhG+tUXrQCo0jS0vyAJ75TVWctdt5KRHNJkuwGdgOcygt5VS6b1SiSxOfqlm8t5byVeHp+BNg2tb91rP0fVbWnqnZU1Y71bFyBMSRp+a1ENL8EnJvknCQbgGuAfStwPZK06pb96XlVPZvk94E7gFOAj1fVQ8t9PZI0CyvymmZV3Q7cvhKXLUmz5CeCJKnBaEpSg9GUpAajKUkNRlOSGoymJDUYTUlqMJqS1GA0JanBaEpSg9GUpAajKUkNRlOSGoymJDUYTUlqMJqS1GA0JanBaEpSg9GUpAajKUkNRlOSGoymJDUYTUlqMJqS1GA0JanBaEpSg9GUpAajKUkNRlO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V6dXVWPje3HgbPH9tzdjvH07wImj9rmfu7xNPc+4ChwJ5NnIE9W1bMnmO2nc4/jTwFnru7EAHwQeA/wk7F/JvM/cwH/lOTLSXaPtXm+f5wD/AfwV+NlkI8leREznHnW0VyzavLX2Fz+6kGSFwOfAd5VVd+fPjavc1fVj6vqfCaP3i4CXjnjkX6uJG8EjlbVl2c9S9NrqupC4A3AtUleO31wDu8f65i8TPaRqroA+C8mT8d/arVnnnU0jwDbpva3jrV59e0kmwHG96NjfW5uR5L1TIL5yar67Fie+7mPqaongXuYPLXdlOTYR32nZ/vp3OP4acB3V3nUVwNvSvJN4NNMnqJ/iPmemao6Mr4fBf6eyV9Q83z/OAwcrqr9Y/8WJhGd2cyzjuaXgHPHO44bmLxAvm/GM/08+4CdY3snk9cMj62/fbxzdzHw1NRTh1WTJMCNwMGq+sDUoXmf+6wkm8b2C5i8DnuQSTyvHqcdP/ex23M1cPd4tLFqqur6qtpaVduZ3G/vrqq3McczJ3lRkpcc2wZ+A3iQOb5/VNXjwKEkvzqWLgMenunMq/mi7s94ofcKJu/yfh3441nPMzXXp4DHgGeY/G23i8lrUHcBjwKfA84Y5wb4i3EbvgrsmNHMr2HyNOUB4L7xdcUamPvXgHvH3A8CfzLWXw58EVgA/g7YONZPHfsL4/jLZ3xfeR3/++753M48Zrt/fD107M/bGrh/nA8cGPePfwBOn+XMfiJIkhpm/fRcktYUoylJDUZTkhqMpiQ1GE1JajCaktRgNCWpwWhKUsP/ABWrjEvNx3EDAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 1\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpY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41NcBb03yTeBmJpfoH2W2Z6aqDo/PR4C/Y/IX1Cw/Pg4Bh6pq39i/jUlEpzbztKN5P3DueMdxPZMXyPdOeaafZy+wY2zvYPKa4dH1a8c7dxcDz867dFgxSQLcBByoqg/NOzTrc5+ZZOPYfgmT12EPMInn1eO0Y+c+en+uBu4dzzZWTFXdUFVbqmobk8ftvVX1TmZ45iQvS/KKo9vArwGPMMOPj6p6CjiY5JfH0mXAY1OdeSVf1P0ZL/ReweRd3q8DfzTteebN9RngSeB5Jn/bXcfkNah7gCeAzwOnj3MD/Pm4D18Ftk9p5tczuUx5GHhwfFyxCub+FeCBMfcjwB+P9XOALwFzwN8CG8b6KWN/bhw/Z8qPlTfyP++ez+zMY7aHxsejR/+8rYLHx/nA/vH4+HvgtGnO7G8ESVLDtC/PJWlVMZqS1GA0JanBaEpSg9GUpAajKUkNRlOSGoymJDX8N2jBjUPXyIkvAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 2\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADbJJREFUeJzt3X+o3fV9x/Hna/llq63xFyFLwqI0rPjHphI0YilFcVNXGv+wRSkzlIzA5sDioIsbbBT2R90ftRWGXahu6ehane1qEIezahn7o9FY48/MenVKkqlZraZupU7b9/44n7izLHrvJ7n3fs91zwdc7vf7+X7vPe8TTp4533PuJakqJEkz80tDDyBJC4nRlKQORlOSOhhNSepgNCWpg9GUpA5zEs0klyR5OslUkq1zcRuSNITM9s9pJlkE/BC4GNgHPARcVVVPz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rZwAPAlPA3wHL2vpxbX+qHT9j4MfKx/ifd88nduY226Pt48lDf98WwOPjLGBXe3x8BzhpyJn9jSBJ6jD05bkkLShGU5I6GE1J6mA0JamD0ZSkDkZTkjoYTUnqYDQlqcN/A6Z6jEkVKvDHAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"for inst_idx, mask in enumerate(target.get_field('masks')):\n",
" print(\"instance:\", inst_idx)\n",
" plt.imshow(mask.get_mask_tensor())\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Now compute the results"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bbox\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\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=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.667\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
"\n",
"\n",
"segm\n",
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\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=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.442\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.667\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"print('bbox')\n",
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()\n",
"print('\\n\\nsegm')\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bbox\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.667\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.667\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
"\n",
"\n",
"segm\n",
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.667\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.667\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_bbox.params.iouThrs = [1.]\n",
"coco_eval_bbox.params.recThrs = [.66666]\n",
"\n",
"coco_eval_segm.params.iouThrs = [1.]\n",
"coco_eval_segm.params.recThrs = [.66666]\n",
"\n",
"print('bbox')\n",
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()\n",
"print('\\n\\nsegm')\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Precision:\n",
"[[[[[ 0. 0.66666667 0.66666667]\n",
" [-1. -1. -1. ]\n",
" [ 0. 0.66666667 0.66666667]\n",
" [-1. -1. -1. ]]]]]\n",
"\n",
"\n",
"Recall:\n",
"[[[[ 0. 0.66666667 0.66666667]\n",
" [-1. -1. -1. ]\n",
" [ 0. 0.66666667 0.66666667]\n",
" [-1. -1. -1. ]]]]\n"
]
}
],
"source": [
"print('Precision:')\n",
"print(coco_eval_segm.eval['precision'])\n",
"print('\\n\\nRecall:')\n",
"print(coco_eval_segm.eval['recall'])"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bbox\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
"\n",
"\n",
"segm\n",
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.667\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_bbox.params.iouThrs = [1.]\n",
"coco_eval_bbox.params.recThrs = [.7]\n",
"\n",
"coco_eval_segm.params.iouThrs = [1.]\n",
"coco_eval_segm.params.recThrs = [.7]\n",
"\n",
"print('bbox')\n",
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()\n",
"print('\\n\\nsegm')\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Precision:\n",
"[[[[[ 0. 0. 0.]\n",
" [-1. -1. -1.]\n",
" [ 0. 0. 0.]\n",
" [-1. -1. -1.]]]]]\n",
"\n",
"\n",
"Recall:\n",
"[[[[ 0. 0.66666667 0.66666667]\n",
" [-1. -1. -1. ]\n",
" [ 0. 0.66666667 0.66666667]\n",
" [-1. -1. -1. ]]]]\n"
]
}
],
"source": [
"print('Precision:')\n",
"print(coco_eval_segm.eval['precision'])\n",
"print('\\n\\nRecall:')\n",
"print(coco_eval_segm.eval['recall'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4 instances should systematically end up in 0.75"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO GT annots\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Parsing images: 100%|██████████| 1/1 [00:00<00:00, 156.83it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Building COCO Predictions\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Parsing images: 1it [00:00, 365.07it/s]\n"
]
}
],
"source": [
"num_of_inst = 4\n",
"dataset = debugdataset.DebugDataset(\n",
" dataset_size=1, \n",
" min_num_instances=num_of_inst, \n",
" max_num_instances=num_of_inst\n",
")\n",
"\n",
"predictions = []\n",
"for img, target, idx in dataset:\n",
" target.add_field(\"scores\", torch.ones(len(target))) \n",
" predictions.append(target)\n",
"\n",
"cocoGt = COCOWrapper(dataset)\n",
"cocoDt = COCOWrapper(dataset, predictions)\n",
"coco_eval_bbox = COCOeval(cocoGt, cocoDt, 'bbox')\n",
"coco_eval_segm = COCOeval(cocoGt, cocoDt, 'segm')"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAIAAAC6s0uzAAAFaElEQVR4nO3Vi2kDQRAFQc3ln/M4gTNYH7utU1UAy2Ng6dsNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHgXUw/4FbtbTzgxc81rA/CAox4AAJ9IgAEgIMAAEBBgAAgIMAAEBBgAAgIMAAEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAICDAABAQaAgAADQECAASAgwAAQEGAACAgwAAQEGAACAgwAAQEGgIAAA0BAgAEgIMAAEBBgAAgIMAAEBBgAAgIMAAEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAICDAABAQaAgAADQECAASAgwAAQEGAACAgwAAQEGAACAgwAAQEGgIAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AEBBoCAAANAQIABICDAABAQYAAICDAABAQYAAICDAABAQaAgAADQECAASAgwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBlfQGQ5w2NLu3OxwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<PIL.Image.Image image mode=RGB size=640x480 at 0x7F66280B87B8>"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"img, target, idx = dataset[0]\n",
"img"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualize the masks as well for safety"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 0\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADbBJREFUeJzt3X+s3XV9x/Hna/2FPykgIV3bDIxkhj82IA1CNMZA3JAZ8Q80GDMb06XJxhKNS7RsyRaT/aH7Q9Rk0TXiVhenMHRCCAtDwCz7Q7SOHwIdcnWatgM7FdDNyEDf++N8ys666r3v9t57zmXPR3Jzv9/P93vPeZ/m9Nnz4x5IVSFJWppfmvUAkrSWGE1JajCaktRgNCWpwWhKUoPRlKSGFYlmksuTPJJkIcmelbgOSZqFLPfvaSZZB3wDeD1wCPgq8LaqenhZr0iSZmAlHmleBCxU1beq6r+AzwJXrsD1SNKqW78Cl7kVODi1fwh41S/6gY3ZVKfwohUYRZKW5kc88b2qOnOx81YimkuSZDewG+AUXsirctmsRpEkvlg3fWcp563E0/PDwPap/W1j7X+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J8YrafwOo3QAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 1\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADbFJREFUeJzt3X+o3fV9x/Hna/llq63xFyFLwqI0rPjHpiFoxFKK4qZZafzDFqXMUDICmwOLgy5usFHYH3V/1FYYdqG6paNrdbabQRzORsvYH43G+tvMenVKkqlZrVq3Uqfte3+cT9xZFr33Y+6933Pt8wGX+/1+vt97zvuEk2fOj3tIqgpJ0sz80tADSNJCYjQlqYPRlKQORlOSOhhNSepgNCWpw5xEM8nFSZ5MMpVk+1xchyQNIbP9e5pJFgE/AC4CDgD3A1dU1ROzekWSNIC5eKR5DjBVVc9U1X8D3wQ2z8H1SNK8WzwHl7kK2D+2fwA4951+YGmW1XEcPwejSNLMvMbLP6yq06Y7by6iOSNJtgHbAI7j/ZybC4caRZL4Tt323EzOm4un5weBNWP7q9va/1FVO6pqQ1VtWMKyORhDkmbfXETzfmBdktOTLAUuB3bNwfVI0ryb9afnVfVmkt8H7gIWATdX1eOzfT2SNIQ5eU2zqu4E7pyLy5akIfmJIEnqYDQlqYPRlKQORlOSOhhNSepgNCWpg9GUpA5GU5I6GE1J6mA0JamD0ZSkDkZTkjoYTUnqYDQlqYPRlKQORlOSOhhNSepgNCWpg9GUpA5GU5I6GE1J6mA0JamD0ZSkDkZTkjoYTUnqYDQlqYPRlKQORlOSOhhNSepgNCWpg9GUpA5GU5I6GE1J6mA0JamD0ZSkDkZTkjpMG80kNyc5lOSxsbWTk9y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BU+Z3YgC+BHwO+HnbP4XJn7mAf0ryQJJtbW2S7x+nA/8B/FV7GeSrSY5nwJmHjuaCVaN/xibyVw+SnAB8C/hsVf14/Nikzl1VP6uqsxg9ejsH+PDAI72jJB8HDlXVA0PP0ukjVbUeuAS4KslHxw9O4P1jMaOXyW6sqrOB/2L0dPwt8z3z0NE8CKwZ21/d1ibVi0lWArTvh9r6xNyOJEsYBfPrVfXttjzxcx9WVa8A9zJ6ars8yeGP+o7P9tbc7fiJwEvzPOr5wCeSPAt8k9FT9C8z2TNTVQfb90PA3zP6B2qS7x8HgANVtaft38YoooPNPHQ07wfWtXcclzJ6gXzXwDO9k13Alra9hdFrhofXr2zv3G0EXh176jBvkgS4CdhXVV8cOzTpc5+WZHnbfh+j12H3MYrnZe20I+c+fHsuA+5pjzbmTVVdW1Wrq2oto/vtPVX1aSZ45iTHJ/nA4W3gN4DHmOD7R1W9AOxP8qtt6ULgiUFnns8Xdd/mhd5NjN7lfRr446HnGZvrG8DzwBuM/rXbyug1qN3AU8B3gJPbuQH+ot2GR4ENA838EUZPUx4BHmpfmxbA3L8GPNjmfgz4k7Z+BnAfMAX8HbCsrR/X9qfa8TMGvq98jP9993xiZ26zPdy+Hj/8920B3D/OAva2+8c/ACcNObOfCJKkDkM/PZekBcVoSlIHoylJHYymJHUwmpLUwWhKUgejKUkdjKYkdfgfkXWMSx7NJD8AAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 2\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAD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AXh17NJh3iQJcDOwr6q+OHZo0uc+NcmKtv0+Rq/D7mMUz8vbaUfOffj7uRy4tz3bmDdVdV1Vra6qtYwet/dW1aeZ4JmTHJfkA4e3gd8AHmOCHx9V9QKwP8mvtqWLgCcGnXk+X9R9mxd6NzJ6l/dp4I+Hnmdsrm8AzwNvMPrbbguj16B2AU8B3wVOaucG+Iv2PTwKrB9o5o8wukx5BNjbPjYugLl/DXiozf0Y8Cdt/QzgfmAK+DtgWVtf3van2vEzBn6sfIz/efd8Ymdusz3cPh4//OdtATw+zgb2tMfHd4ATh5zZ3wiSpA5DX55L0oJiNCWpg9GUpA5GU5I6GE1J6mA0JamD0ZSkDkZTkjr8N0OTjEv/2sduAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"instance: 3\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD8CAYAAADzEfagAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADa9JREFUeJzt3V2MXOV9x/Hvr35NIMG8Cbm2VYNiNeKiBWTxIqIoAtGCG8VckAgUFStyZamlEhGVUtNKrSL1IvQiJEgVqRXTOlWaQEkaLERFiSGqehGDCebVJSwUZLuAGwKENgqF5N+LeUynrmH3wbt7Zun3I632nOecnf0PGn89Z2YXp6qQJM3MLw09gCQtJEZTkjoYTUnqYDQlqYPRlKQORlOSOsxJNJNcmuTJJFNJts7F95CkIWS2f04zySLgh8AlwAHgAeCqqnpiVr+RJA1gLp5pngtMVdUzVfVfwDeBjXPwfSRp3i2eg9tcBewf2z8AnPdOX7A0y2o5x83BKJI0M6/x8o+q6tTpzpuLaM5Iki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TUnqYDQlqcN/A9knjEu3katkAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"for inst_idx, mask in enumerate(target.get_field('masks')):\n",
" print(\"instance:\", inst_idx)\n",
" plt.imshow(mask.get_mask_tensor())\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Now compute the results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bbox\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\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=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.750\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
"\n",
"\n",
"segm\n",
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\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=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.564\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.750\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"print('bbox')\n",
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()\n",
"print('\\n\\nsegm')\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bbox\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.750\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.750\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
"\n",
"\n",
"segm\n",
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.750\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.750\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_bbox.params.iouThrs = [1.]\n",
"coco_eval_bbox.params.recThrs = [.75]\n",
"\n",
"coco_eval_segm.params.iouThrs = [1.]\n",
"coco_eval_segm.params.recThrs = [.75]\n",
"\n",
"print('bbox')\n",
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()\n",
"print('\\n\\nsegm')\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 120,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Precision:\n",
"[[[[[ 0. 0.75 0.75]\n",
" [-1. -1. -1. ]\n",
" [ 0. 0.75 0.75]\n",
" [-1. -1. -1. ]]]]]\n",
"\n",
"\n",
"Recall:\n",
"[[[[ 0. 0.75 0.75]\n",
" [-1. -1. -1. ]\n",
" [ 0. 0.75 0.75]\n",
" [-1. -1. -1. ]]]]\n"
]
}
],
"source": [
"print('Precision:')\n",
"print(coco_eval_segm.eval['precision'])\n",
"print('\\n\\nRecall:')\n",
"print(coco_eval_segm.eval['recall'])"
]
},
{
"cell_type": "code",
"execution_count": 121,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bbox\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
"\n",
"\n",
"segm\n",
"Running per image evaluation...\n",
"Evaluate annotation type *segm*\n",
"DONE (t=0.00s).\n",
"Accumulating evaluation results...\n",
"DONE (t=0.00s).\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.000\n",
" Average Precision (AP) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 1 ] = 0.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets= 10 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= all | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= small | maxDets=100 ] = -1.000\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area=medium | maxDets=100 ] = 0.750\n",
" Average Recall (AR) @[ IoU=1.00:1.00 | area= large | maxDets=100 ] = -1.000\n"
]
}
],
"source": [
"coco_eval_bbox.params.iouThrs = [1.]\n",
"coco_eval_bbox.params.recThrs = [.76]\n",
"\n",
"coco_eval_segm.params.iouThrs = [1.]\n",
"coco_eval_segm.params.recThrs = [.76]\n",
"\n",
"print('bbox')\n",
"coco_eval_bbox.evaluate()\n",
"coco_eval_bbox.accumulate()\n",
"coco_eval_bbox.summarize()\n",
"print('\\n\\nsegm')\n",
"coco_eval_segm.evaluate()\n",
"coco_eval_segm.accumulate()\n",
"coco_eval_segm.summarize()"
]
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Precision:\n",
"[[[[[ 0. 0. 0.]\n",
" [-1. -1. -1.]\n",
" [ 0. 0. 0.]\n",
" [-1. -1. -1.]]]]]\n",
"\n",
"\n",
"Recall:\n",
"[[[[ 0. 0.75 0.75]\n",
" [-1. -1. -1. ]\n",
" [ 0. 0.75 0.75]\n",
" [-1. -1. -1. ]]]]\n"
]
}
],
"source": [
"print('Precision:')\n",
"print(coco_eval_segm.eval['precision'])\n",
"print('\\n\\nRecall:')\n",
"print(coco_eval_segm.eval['recall'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"please contact: [email protected]"
]
}
],
"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.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment