Skip to content

Commit

Permalink
add exception for empty situation
Browse files Browse the repository at this point in the history
  • Loading branch information
MulongXie committed Mar 2, 2020
1 parent 80d6596 commit bda6aa0
Show file tree
Hide file tree
Showing 5 changed files with 829 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
272 changes: 272 additions & 0 deletions result_processing/.ipynb_checkpoints/box_plot-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import numpy as np\n",
"import cv2\n",
"from glob import glob\n",
"from os.path import join as pjoin\n",
"from tqdm import tqdm"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def resize_label(bboxes, d_height, gt_height, bias=0):\n",
" bboxes_new = []\n",
" scale = gt_height/d_height\n",
" for bbox in bboxes:\n",
" bbox = [int(b * scale + bias) for b in bbox]\n",
" bboxes_new.append(bbox)\n",
" return bboxes_new\n",
"\n",
"\n",
"def draw_bounding_box(org, corners, color=(0, 255, 0), line=2, show=False):\n",
" board = org.copy()\n",
" for i in range(len(corners)):\n",
" board = cv2.rectangle(board, (corners[i][0], corners[i][1]), (corners[i][2], corners[i][3]), color, line)\n",
" if show:\n",
" cv2.imshow('a', cv2.resize(board, (300, 600)))\n",
" cv2.waitKey(0)\n",
" return board\n",
"\n",
"\n",
"def load_detect_result_json(reslut_file_root):\n",
" result_files = glob(pjoin(reslut_file_root, '*.json'))\n",
" compos_reform = {}\n",
" print('Loading %d detection results' % len(result_files))\n",
" for reslut_file in tqdm(result_files):\n",
" img_name = reslut_file.split('\\\\')[-1].split('_')[0]\n",
" compos = json.load(open(reslut_file, 'r'))['compos']\n",
" for compo in compos:\n",
" if img_name not in compos_reform:\n",
" compos_reform[img_name] = {'bboxes': [[compo['column_min'], compo['row_min'], compo['column_max'], compo['row_max']]],\n",
" 'categories': [compo['category']]}\n",
" else:\n",
" compos_reform[img_name]['bboxes'].append([compo['column_min'], compo['row_min'], compo['column_max'], compo['row_max']])\n",
" compos_reform[img_name]['categories'].append(compo['category'])\n",
" return compos_reform\n",
"\n",
"\n",
"def load_ground_truth_json(gt_file):\n",
" def get_img_by_id(img_id):\n",
" for image in images:\n",
" if image['id'] == img_id:\n",
" return image['file_name'].split('/')[-1][:-4], (image['height'], image['width'])\n",
"\n",
" def cvt_bbox(bbox):\n",
" '''\n",
" :param bbox: [x,y,width,height]\n",
" :return: [col_min, row_min, col_max, row_max]\n",
" '''\n",
" bbox = [int(b) for b in bbox]\n",
" return [bbox[0], bbox[1], bbox[0] + bbox[2], bbox[1] + bbox[3]]\n",
"\n",
" data = json.load(open(gt_file, 'r'))\n",
" images = data['images']\n",
" annots = data['annotations']\n",
" compos = {}\n",
" print('Loading %d ground truth' % len(annots))\n",
" for annot in tqdm(annots):\n",
" img_name, size = get_img_by_id(annot['image_id'])\n",
" if img_name not in compos:\n",
" compos[img_name] = {'bboxes': [cvt_bbox(annot['bbox'])], 'categories': [annot['category_id']], 'size':size}\n",
" else:\n",
" compos[img_name]['bboxes'].append(cvt_bbox(annot['bbox']))\n",
" compos[img_name]['categories'].append(annot['category_id'])\n",
" return compos\n",
"\n",
"\n",
"def eval(detection, ground_truth, img_root, show=True):\n",
" def match(org, d_bbox, gt_bboxes, matched):\n",
" '''\n",
" :param matched: mark if the ground truth component is matched\n",
" :param d_bbox: [col_min, row_min, col_max, row_max]\n",
" :param gt_bboxes: list of ground truth [[col_min, row_min, col_max, row_max]]\n",
" :return: Boolean: if IOU large enough or detected box is contained by ground truth\n",
" '''\n",
" area_d = (d_bbox[2] - d_bbox[0]) * (d_bbox[3] - d_bbox[1])\n",
" for i, gt_bbox in enumerate(gt_bboxes):\n",
" if matched[i] == 0:\n",
" continue\n",
" area_gt = (gt_bbox[2] - gt_bbox[0]) * (gt_bbox[3] - gt_bbox[1])\n",
" col_min = max(d_bbox[0], gt_bbox[0])\n",
" row_min = max(d_bbox[1], gt_bbox[1])\n",
" col_max = min(d_bbox[2], gt_bbox[2])\n",
" row_max = min(d_bbox[3], gt_bbox[3])\n",
" # if not intersected, area intersection should be 0\n",
" w = max(0, col_max - col_min)\n",
" h = max(0, row_max - row_min)\n",
" area_inter = w * h\n",
" if area_inter == 0:\n",
" continue\n",
" iod = area_inter / area_d\n",
" iou = area_inter / (area_d + area_gt - area_inter)\n",
"\n",
" # if show:\n",
" # print(\"IoDetection: %.3f, IoU: %.3f\" % (iod, iou))\n",
" # broad = draw_bounding_box(org, [d_bbox], color=(0, 0, 255))\n",
" # draw_bounding_box(broad, [gt_bbox], color=(0, 255, 0), show=True)\n",
"\n",
" if iou >= 0.5 or iod == 1:\n",
" matched[i] = 0\n",
" return True\n",
" return False\n",
"\n",
" pres = []\n",
" recalls = []\n",
" amount = len(detection)\n",
" for i, image_id in enumerate(detection):\n",
" TP, FP, FN = 0, 0, 0\n",
" img = cv2.imread(pjoin(img_root, image_id + '.jpg'))\n",
" d_compos = detection[image_id]\n",
" gt_compos = ground_truth[image_id]\n",
" d_compos['bboxes'] = resize_label(d_compos['bboxes'], 800, gt_compos['size'][0])\n",
" matched = np.ones(len(gt_compos['bboxes']), dtype=int)\n",
" for d_bbox in d_compos['bboxes']:\n",
" if match(img, d_bbox, gt_compos['bboxes'], matched):\n",
" TP += 1\n",
" else:\n",
" FP += 1\n",
" FN += sum(matched)\n",
"\n",
" precesion = TP / (TP+FP)\n",
" recall = TP / (TP+FN)\n",
"\n",
" pres.append(precesion)\n",
" recalls.append(recall)\n",
" if show:\n",
" print(\"Number of gt boxes: %d, Number of detected boxes: %d\" % (\n",
" len(gt_compos['bboxes']), len(d_compos['bboxes'])))\n",
" print('[%d/%d] TP:%d, FP:%d, FN:%d, Precesion:%.3f, Recall:%.3f' % (i, amount, TP, FP, FN, precesion, recall))\n",
"\n",
" broad = draw_bounding_box(img, d_compos['bboxes'], color=(0, 0, 255), line=3)\n",
" draw_bounding_box(broad, gt_compos['bboxes'], color=(0, 255, 0), show=True, line=2)\n",
"\n",
" if i % 200 == 0:\n",
" print('[%d/%d] TP:%d, FP:%d, FN:%d, Precesion:%.3f, Recall:%.3f' % (i, amount, TP, FP, FN, precesion, recall))\n",
"\n",
" return pres, recalls"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 0%| | 0/9419 [00:00<?, ?it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loading 9419 detection results\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 18%|██████████████▏ | 1742/9419 [00:06<00:26, 288.34it/s]\n"
]
},
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-5-46d485acea1a>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdetect\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mload_detect_result_json\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'E:\\\\Mulong\\\\Result\\\\rico\\\\rico_uied\\\\rico_new_uied_cls\\\\ip'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[0mgt\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mload_ground_truth_json\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'E:/Mulong/Datasets/rico/test.json'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0mpres\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mrecalls\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0meval\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdetect\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mgt\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'E:\\\\Mulong\\\\Datasets\\\\rico\\\\combined'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mshow\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32m<ipython-input-4-89050ccdec40>\u001b[0m in \u001b[0;36mload_detect_result_json\u001b[1;34m(reslut_file_root)\u001b[0m\n\u001b[0;32m 24\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mreslut_file\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mtqdm\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresult_files\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[0mimg_name\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mreslut_file\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'\\\\'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'_'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 26\u001b[1;33m \u001b[0mcompos\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mjson\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mload\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mreslut_file\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'compos'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 27\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mcompo\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mcompos\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 28\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mimg_name\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mcompos_reform\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"detect = load_detect_result_json('E:\\\\Mulong\\\\Result\\\\rico\\\\rico_uied\\\\rico_new_uied_cls\\\\ip')\n",
"gt = load_ground_truth_json('E:/Mulong/Datasets/rico/test.json')\n",
"pres, recalls = eval(detect, gt, 'E:\\\\Mulong\\\\Datasets\\\\rico\\\\combined', show=False)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"D:\\Anaconda\\lib\\site-packages\\matplotlib\\figure.py:448: UserWarning: Matplotlib is currently using module://ipykernel.pylab.backend_inline, which is a non-GUI backend, so cannot show the figure.\n",
" % get_backend())\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYi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Q9143k38MSqug/4feAfuzH8aeBhwDvpjf3d9KZkvjftjn/qNd0b/zcD/wd8YmGeSdu8QnURJFlD782iJy9xKZKOE565S1KDPHOXpAZ55i5JDTLcJalBhrskNchwl6QGGe6S1CDDXZIa9P965KgdOKExlwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"fig = plt.figure() # 创建画布\n",
"ax = plt.subplot() # 创建作图区域\n",
"ax.boxplot([pres, recalls])\n",
"ax.set_xticklabels(['precisions', 'recalls'])\n",
"plt.grid(axis='y')\n",
"fig.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.5.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit bda6aa0

Please sign in to comment.