|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Speed up the execution !\n", |
| 7 | + "# Multi-Template Matching\n", |
| 8 | + "## Tutorial 3 : Speed up the execution !\n", |
8 | 9 | "\n", |
9 | 10 | "This tutorial shows 2 simple ways to increase the speed of execution with template matching. \n", |
10 | 11 | "This is especially interesting if you need to run the detection on many images !\n", |
11 | 12 | "\n", |
12 | 13 | "## Citations\n", |
13 | | - "If you use this implementation for your research, please cite:\n", |
| 14 | + "<a rel=\"license\" href=\"http://creativecommons.org/licenses/by/4.0/\"><img alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by/4.0/88x31.png\" /></a><br />This tutorial is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/4.0/\">Creative Commons Attribution 4.0 International License</a>. \n", |
| 15 | + "You are free to distribute and/or modify this tutorial, provided you attribute the author: \n", |
| 16 | + "\n", |
| 17 | + "Multi-Template Matching python package online tutorial - _III - Speed-up execution_ \n", |
| 18 | + "Laurent Thomas - 2019 \n", |
| 19 | + "https://github.com/multi-template-matching/MultiTemplateMatching-Python/blob/master/tutorials/SpeedingUp.ipynb\n", |
14 | 20 | "\n", |
15 | | - "*Multi-Template Matching: a versatile tool for object-localization in microscopy images;* \n", |
16 | | - "Laurent SV Thomas, Jochen Gehrig\n", |
17 | | - "bioRxiv 619338; doi: https://doi.org/10.1101/619338\n", |
18 | 21 | "\n", |
19 | 22 | "## Let's code !" |
20 | 23 | ] |
|
55 | 58 | "cell_type": "markdown", |
56 | 59 | "metadata": {}, |
57 | 60 | "source": [ |
58 | | - "The key function of the package is `matchTemplates`. \n", |
59 | | - "We can check its documentation within a jupyter notebook using ?, or in usual python using help()" |
60 | | - ] |
61 | | - }, |
62 | | - { |
63 | | - "cell_type": "code", |
64 | | - "execution_count": 37, |
65 | | - "metadata": {}, |
66 | | - "outputs": [], |
67 | | - "source": [ |
68 | | - "# This opens a documentation panel at the bottom\n", |
69 | | - "matchTemplates?" |
70 | | - ] |
71 | | - }, |
72 | | - { |
73 | | - "cell_type": "markdown", |
74 | | - "metadata": {}, |
75 | | - "source": [ |
76 | | - "Let's open some test image (from the GitHub repository)." |
| 61 | + "Let's open some test image (from the GitHub repository). \n", |
| 62 | + "This is a widefield microscopy image of a zebrafish larvae, mounted in a 96 well plate using agar. \n", |
| 63 | + "We will use Multi-Template-Matching for the detection of the head. \n", |
| 64 | + "This is useful since the larvae are not positioned exactly at the same spot in every well. \n", |
| 65 | + "For this tutorial we will use the same image though, as the goal is to compare the performance for different parameters. " |
77 | 66 | ] |
78 | 67 | }, |
79 | 68 | { |
|
105 | 94 | } |
106 | 95 | ], |
107 | 96 | "source": [ |
108 | | - "image = cv2.imread(r\"../images/Fish.tif\", -1)\n", |
| 97 | + "image = cv2.imread(r\"../images/Fish.tif\", -1) # this assume you cloned the repo, you can also download the image separatly\n", |
109 | 98 | "plt.figure(figsize = (10,10))\n", |
110 | 99 | "plt.axis(\"off\")\n", |
111 | 100 | "plt.imshow(image, cmap=\"gray\")" |
|
115 | 104 | "cell_type": "markdown", |
116 | 105 | "metadata": {}, |
117 | 106 | "source": [ |
118 | | - "As usually we define a template to search.\n", |
119 | | - "Here we will crop the template from the image to be searched, in practice it is not a realistic scenario, one would would usually have a generic template different from the searched image. \n", |
120 | | - "But here the point is to show the difference in compoutation time." |
| 107 | + "As usually we define a template to search. \n", |
| 108 | + "Here we will crop the template from the image to be searched, in practice it is not a realistic scenario, one would would usually have a generic template different from the searched image. \n", |
| 109 | + "But here the point is to show the difference in computation time." |
121 | 110 | ] |
122 | 111 | }, |
123 | 112 | { |
|
433 | 422 | "source": [ |
434 | 423 | "And now comes the major trick: because we performed the detection on downscale images, __we have to scale up the detected bounding-boxes__. \n", |
435 | 424 | "Fortunately, there are such utilitary functions for bounding boxes in the gluoncv library. \n", |
436 | | - "To install gluoncv, open a terminal in your active python environment and type `pip install gluoncv`." |
| 425 | + "To install gluoncv, open a terminal in your active python environment and type `pip install gluoncv`. \n", |
| 426 | + "For this tutorial I'm using version 0.5.0." |
437 | 427 | ] |
438 | 428 | }, |
439 | 429 | { |
|
0 commit comments