[example] fix plt commands in detection

This commit is contained in:
Evan Shelhamer 2014-08-13 09:22:42 -07:00
Родитель da2138c75d
Коммит bb903025df
1 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -414,7 +414,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"\n",
"df = pd.read_hdf('_temp/det_output.h5', 'df')\n",
"print(df.shape)\n",
@ -525,10 +528,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
"gray()\n",
"matshow(predictions_df.values)\n",
"xlabel('Classes')\n",
"ylabel('Windows')"
"plt.gray()\n",
"plt.matshow(predictions_df.values)\n",
"plt.xlabel('Classes')\n",
"plt.ylabel('Windows')"
],
"language": "python",
"metadata": {},
@ -626,17 +629,17 @@
"print(f.order(ascending=False)[:5])\n",
"\n",
"# Show top detection in red, second-best top detection in blue.\n",
"im = imread('images/fish-bike.jpg')\n",
"imshow(im)\n",
"im = plt.imread('images/fish-bike.jpg')\n",
"plt.imshow(im)\n",
"currentAxis = plt.gca()\n",
"\n",
"det = df.iloc[i]\n",
"coords = (det['xmin'], det['ymin']), det['xmax'] - det['xmin'], det['ymax'] - det['ymin']\n",
"currentAxis.add_patch(Rectangle(*coords, fill=False, edgecolor='r', linewidth=5))\n",
"currentAxis.add_patch(plt.Rectangle(*coords, fill=False, edgecolor='r', linewidth=5))\n",
"\n",
"det = df.iloc[j]\n",
"coords = (det['xmin'], det['ymin']), det['xmax'] - det['xmin'], det['ymax'] - det['ymin']\n",
"currentAxis.add_patch(Rectangle(*coords, fill=False, edgecolor='b', linewidth=5))"
"currentAxis.add_patch(plt.Rectangle(*coords, fill=False, edgecolor='b', linewidth=5))"
],
"language": "python",
"metadata": {},
@ -776,12 +779,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
"imshow(im)\n",
"plt.imshow(im)\n",
"currentAxis = plt.gca()\n",
"colors = ['r', 'b', 'y']\n",
"for c, det in zip(colors, nms_dets[:3]):\n",
" currentAxis.add_patch(\n",
" Rectangle((det[0], det[1]), det[2]-det[0], det[3]-det[1],\n",
" plt.Rectangle((det[0], det[1]), det[2]-det[0], det[3]-det[1],\n",
" fill=False, edgecolor=c, linewidth=5)\n",
" )\n",
"print 'scores:', nms_dets[:3, 4]"