Skip to content

Commit

Permalink
dev version 190618_2200
Browse files Browse the repository at this point in the history
  • Loading branch information
lbborkowski committed Jun 19, 2019
1 parent 0b982c4 commit 5782640
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions WindTurbineDetector_dev.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
"import glob\n",
"\n",
"PATH_TO_TEST_IMAGES_DIR = '/content/wind-turbine-detector/images/samples/orig'\n",
"TEST_IMAGE_PATHS = glob.glob(os.path.join(PATH_TO_TEST_IMAGES_DIR, \"*.*\"))\n",
"TEST_IMAGE_PATHS = glob.glob(os.path.join(PATH_TO_TEST_IMAGES_DIR, \"*.jpg\"))\n",
"print(TEST_IMAGE_PATHS)\n",
"\n",
"# Size, in inches, of the output images.\n",
Expand Down Expand Up @@ -804,12 +804,17 @@
"source": [
"scoresWTs = np.array([])\n",
"BBsWTs = np.empty((0, 4))\n",
"detectedWTs=[]\n",
"chipsize = 300\n",
"for image_path in TEST_IMAGE_PATHS:\n",
" image = Image.open(image_path)\n",
" width, height = image.size\n",
" for x0 in range(0, width, chipsize):\n",
" for y0 in range(0, height, chipsize):\n",
" ii=0\n",
" for x0 in range(0, width, chipsize): # width\n",
" ii=ii+1\n",
" jj=0\n",
" for y0 in range(0, height, chipsize): # height\n",
" jj=jj+1\n",
" box = (x0, y0,\n",
" x0+chipsize,\n",
" y0+chipsize)\n",
Expand All @@ -835,10 +840,24 @@
" line_thickness=8)\n",
" plt.figure(figsize=IMAGE_SIZE)\n",
" plt.axis('off')\n",
" for jj in range(len(output_dict['detection_scores'][output_dict['detection_scores']>0.5])):\n",
" plt.plot(chipsize*np.mean([BBsWTs[-1-jj][1],BBsWTs[-1-jj][3]]),chipsize*np.mean([[BBsWTs[-1-jj][0],BBsWTs[-1-jj][2]]]),'bo')\n",
" plt.imshow(image_np)\n",
" "
" for kk in range(len(output_dict['detection_scores'][output_dict['detection_scores']>0.5])):\n",
" plt.plot(chipsize*np.mean([BBsWTs[-1-kk][1],BBsWTs[-1-kk][3]]),chipsize*np.mean([[BBsWTs[-1-kk][0],BBsWTs[-1-kk][2]]]),'bo')\n",
" detectedWTs.append([image_path,ii,jj])\n",
" plt.imshow(image_np)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "SlQByra45P0B",
"colab_type": "code",
"colab": {}
},
"source": [
"print(detectedWTs)\n",
"print(len(detectedWTs))"
],
"execution_count": 0,
"outputs": []
Expand Down

0 comments on commit 5782640

Please sign in to comment.