|
3 | 3 | {
|
4 | 4 | "cell_type": "markdown",
|
5 | 5 | "metadata": {
|
6 |
| - "colab_type": "text", |
7 | 6 | "id": "zBubcXOfW3Au"
|
8 | 7 | },
|
9 | 8 | "source": [
|
|
13 | 12 | },
|
14 | 13 | {
|
15 | 14 | "cell_type": "code",
|
16 |
| - "execution_count": 0, |
| 15 | + "execution_count": null, |
17 | 16 | "metadata": {
|
18 | 17 | "cellView": "both",
|
19 |
| - "colab": {}, |
20 |
| - "colab_type": "code", |
21 | 18 | "id": "rKwqeqWBXANA"
|
22 | 19 | },
|
23 | 20 | "outputs": [],
|
|
38 | 35 | {
|
39 | 36 | "cell_type": "markdown",
|
40 | 37 | "metadata": {
|
41 |
| - "colab_type": "text", |
42 | 38 | "id": "dGib_ljiVqZp"
|
43 | 39 | },
|
44 | 40 | "source": [
|
45 |
| - "# Build the C++ \"edgetpu\" examples for Coral\n", |
| 41 | + "# Build the libcoral C++ examples\n", |
46 | 42 | "\n",
|
47 |
| - "This Colab provides a convenient way to build the C++ \"edgetpu\" inferencing examples: [github.com/google-coral/edgetpu/tree/master/src/cpp/examples](https://github.com/google-coral/edgetpu/tree/master/src/cpp/examples).\n", |
| 43 | + "This Colab provides a convenient way to build the [libcoral C++ examples](https://github.com/google-coral/libcoral/tree/master/coral/examples).\n", |
48 | 44 | "\n",
|
49 |
| - "Simply run this notebook and it produces the downloadable binaries for your target system (default target is `aarch64`, which is compatible with the Coral Dev Board).\n", |
| 45 | + "Simply run this notebook and it produces the downloadable binaries for your target system (default target is `aarch64`, which is compatible with the Coral Dev Board and Dev Board Mini).\n", |
50 | 46 | "\n",
|
51 | 47 | "To start the build, select **Runtime \u003e Run all** in the Colab toolbar.\n"
|
52 | 48 | ]
|
53 | 49 | },
|
54 | 50 | {
|
55 | 51 | "cell_type": "markdown",
|
56 | 52 | "metadata": {
|
57 |
| - "colab_type": "text", |
58 | 53 | "id": "viewin-badges"
|
59 | 54 | },
|
60 | 55 | "source": [
|
|
66 | 61 | {
|
67 | 62 | "cell_type": "markdown",
|
68 | 63 | "metadata": {
|
69 |
| - "colab_type": "text", |
70 |
| - "id": "fmb_p_OkCp0J" |
| 64 | + "id": "0H4Bv2yWFyMZ" |
71 | 65 | },
|
72 | 66 | "source": [
|
73 |
| - "## Install Bazel" |
| 67 | + "## Download examples from GitHub" |
74 | 68 | ]
|
75 | 69 | },
|
76 | 70 | {
|
77 | 71 | "cell_type": "code",
|
78 |
| - "execution_count": 0, |
| 72 | + "execution_count": null, |
79 | 73 | "metadata": {
|
80 |
| - "colab": {}, |
81 |
| - "colab_type": "code", |
82 |
| - "id": "B6KvyX7hFdVB" |
| 74 | + "id": "2ZbLwr4bF655" |
83 | 75 | },
|
84 | 76 | "outputs": [],
|
85 | 77 | "source": [
|
86 |
| - "! sudo apt install curl\n", |
87 |
| - "! curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -\n", |
88 |
| - "! echo \"deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8\" | sudo tee /etc/apt/sources.list.d/bazel.list" |
| 78 | + "! git clone https://github.com/google-coral/libcoral.git" |
89 | 79 | ]
|
90 | 80 | },
|
91 | 81 | {
|
92 | 82 | "cell_type": "code",
|
93 |
| - "execution_count": 0, |
| 83 | + "execution_count": null, |
94 | 84 | "metadata": {
|
95 |
| - "colab": {}, |
96 |
| - "colab_type": "code", |
97 |
| - "id": "w9YmfWd0Fnjj" |
| 85 | + "id": "b5-XBtOHTKUq" |
98 | 86 | },
|
99 | 87 | "outputs": [],
|
100 | 88 | "source": [
|
101 |
| - "! sudo apt update \u0026\u0026 sudo apt install bazel" |
| 89 | + "%cd libcoral" |
| 90 | + ] |
| 91 | + }, |
| 92 | + { |
| 93 | + "cell_type": "code", |
| 94 | + "execution_count": null, |
| 95 | + "metadata": { |
| 96 | + "id": "xYJGPVCH-8q0" |
| 97 | + }, |
| 98 | + "outputs": [], |
| 99 | + "source": [ |
| 100 | + "! git submodule init \u0026\u0026 git submodule update libedgetpu" |
102 | 101 | ]
|
103 | 102 | },
|
104 | 103 | {
|
105 | 104 | "cell_type": "markdown",
|
106 | 105 | "metadata": {
|
107 |
| - "colab_type": "text", |
108 |
| - "id": "0H4Bv2yWFyMZ" |
| 106 | + "id": "fmb_p_OkCp0J" |
109 | 107 | },
|
110 | 108 | "source": [
|
111 |
| - "## Download examples from GitHub" |
| 109 | + "## Install Bazel" |
112 | 110 | ]
|
113 | 111 | },
|
114 | 112 | {
|
115 | 113 | "cell_type": "code",
|
116 |
| - "execution_count": 0, |
| 114 | + "execution_count": null, |
117 | 115 | "metadata": {
|
118 |
| - "colab": {}, |
119 |
| - "colab_type": "code", |
120 |
| - "id": "2ZbLwr4bF655" |
| 116 | + "id": "B6KvyX7hFdVB" |
121 | 117 | },
|
122 | 118 | "outputs": [],
|
123 | 119 | "source": [
|
124 |
| - "! git clone https://github.com/google-coral/edgetpu.git" |
| 120 | + "! sudo apt install curl\n", |
| 121 | + "! curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -\n", |
| 122 | + "! echo \"deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8\" | sudo tee /etc/apt/sources.list.d/bazel.list" |
| 123 | + ] |
| 124 | + }, |
| 125 | + { |
| 126 | + "cell_type": "code", |
| 127 | + "execution_count": null, |
| 128 | + "metadata": { |
| 129 | + "id": "w9YmfWd0Fnjj" |
| 130 | + }, |
| 131 | + "outputs": [], |
| 132 | + "source": [ |
| 133 | + "! sudo apt update \u0026\u0026 sudo apt install bazel" |
125 | 134 | ]
|
126 | 135 | },
|
127 | 136 | {
|
128 | 137 | "cell_type": "markdown",
|
129 | 138 | "metadata": {
|
130 |
| - "colab_type": "text", |
131 |
| - "id": "y_kKEIB-F8n_" |
| 139 | + "id": "WUDlTRR3lv4F" |
132 | 140 | },
|
133 | 141 | "source": [
|
134 |
| - "## Build all examples for Dev Board" |
| 142 | + "## Install dependencies to cross-compile" |
135 | 143 | ]
|
136 | 144 | },
|
137 | 145 | {
|
138 | 146 | "cell_type": "code",
|
139 |
| - "execution_count": 0, |
| 147 | + "execution_count": null, |
140 | 148 | "metadata": {
|
141 |
| - "colab": {}, |
142 |
| - "colab_type": "code", |
143 |
| - "id": "WMiVEbZReILd" |
| 149 | + "id": "xDY70hQaChPI" |
144 | 150 | },
|
145 | 151 | "outputs": [],
|
146 | 152 | "source": [
|
147 |
| - "! sudo apt-get install -y crossbuild-essential-armhf crossbuild-essential-arm64 bazel" |
| 153 | + "! bash docker/update_sources.sh" |
148 | 154 | ]
|
149 | 155 | },
|
150 | 156 | {
|
151 | 157 | "cell_type": "code",
|
152 |
| - "execution_count": 0, |
| 158 | + "execution_count": null, |
153 | 159 | "metadata": {
|
154 |
| - "colab": {}, |
155 |
| - "colab_type": "code", |
156 |
| - "id": "b5-XBtOHTKUq" |
| 160 | + "id": "Qv3WwZEAtNGu" |
157 | 161 | },
|
158 | 162 | "outputs": [],
|
159 | 163 | "source": [
|
160 |
| - "%cd edgetpu" |
| 164 | + "! sudo dpkg --add-architecture arm64 \u0026\u0026 sudo apt-get update\n", |
| 165 | + "\n", |
| 166 | + "! sudo apt-get install -y crossbuild-essential-arm64 libpython3-dev:arm64 libusb-1.0-0-dev:arm64 xxd" |
| 167 | + ] |
| 168 | + }, |
| 169 | + { |
| 170 | + "cell_type": "markdown", |
| 171 | + "metadata": { |
| 172 | + "id": "y_kKEIB-F8n_" |
| 173 | + }, |
| 174 | + "source": [ |
| 175 | + "## Build all examples for Coral boards" |
161 | 176 | ]
|
162 | 177 | },
|
163 | 178 | {
|
164 | 179 | "cell_type": "markdown",
|
165 | 180 | "metadata": {
|
166 |
| - "colab_type": "text", |
167 | 181 | "id": "adMIBqbAS0zb"
|
168 | 182 | },
|
169 | 183 | "source": [
|
170 |
| - "The following line builds for an ARM64 system (`aarch64`). Alternative CPU architectures are `k8` and `armv7a`." |
| 184 | + "The following line builds for an ARM64 systems (Coral Dev Board and Dev Board Mini). Alternative CPU architectures are `k8` and `armv7a`." |
171 | 185 | ]
|
172 | 186 | },
|
173 | 187 | {
|
174 | 188 | "cell_type": "code",
|
175 |
| - "execution_count": 0, |
| 189 | + "execution_count": null, |
176 | 190 | "metadata": {
|
177 |
| - "colab": {}, |
178 |
| - "colab_type": "code", |
179 | 191 | "id": "lG1HxB21BA8d"
|
180 | 192 | },
|
181 | 193 | "outputs": [],
|
|
186 | 198 | {
|
187 | 199 | "cell_type": "markdown",
|
188 | 200 | "metadata": {
|
189 |
| - "colab_type": "text", |
190 | 201 | "id": "-8zj1nAPpeQg"
|
191 | 202 | },
|
192 | 203 | "source": [
|
|
195 | 206 | },
|
196 | 207 | {
|
197 | 208 | "cell_type": "code",
|
198 |
| - "execution_count": 0, |
| 209 | + "execution_count": null, |
199 | 210 | "metadata": {
|
200 |
| - "colab": {}, |
201 |
| - "colab_type": "code", |
202 | 211 | "id": "SU79MMc5rD0I"
|
203 | 212 | },
|
204 | 213 | "outputs": [],
|
205 | 214 | "source": [
|
206 | 215 | "from google.colab import files\n",
|
207 | 216 | "\n",
|
208 |
| - "files.download('bazel-out/aarch64-opt/bin/src/cpp/examples/classify_image')\n", |
209 |
| - "files.download('bazel-out/aarch64-opt/bin/src/cpp/examples/two_models_one_tpu')\n", |
210 |
| - "files.download('bazel-out/aarch64-opt/bin/src/cpp/examples/two_models_two_tpus_threaded')" |
| 217 | + "files.download('bazel-out/aarch64-opt/bin/coral/examples/backprop_last_layer')\n", |
| 218 | + "files.download('bazel-out/aarch64-opt/bin/coral/examples/classify_image')\n", |
| 219 | + "files.download('bazel-out/aarch64-opt/bin/coral/examples/model_pipelining')\n", |
| 220 | + "files.download('bazel-out/aarch64-opt/bin/coral/examples/two_models_one_tpu')\n", |
| 221 | + "files.download('bazel-out/aarch64-opt/bin/coral/examples/two_models_two_tpus_threaded')" |
211 | 222 | ]
|
212 | 223 | },
|
213 | 224 | {
|
214 | 225 | "cell_type": "markdown",
|
215 | 226 | "metadata": {
|
216 |
| - "colab_type": "text", |
217 | 227 | "id": "Y_YDWKRvx8v-"
|
218 | 228 | },
|
219 | 229 | "source": [
|
220 | 230 | "The downloads might fail if you used **Run all**. If so, just retry by clicking **Run cell** in this last code cell.\n",
|
221 | 231 | "\n",
|
222 |
| - "**Note:** You probably need to modify the file permissions in order to run it." |
| 232 | + "**Note:** The list of compiled files above might be incomplete, and you probably need to modify the file permissions in order to run them." |
223 | 233 | ]
|
224 | 234 | }
|
225 | 235 | ],
|
|
0 commit comments