Skip to content

Commit f0bac57

Browse files
committed
Internal Change
PiperOrigin-RevId: 351217149
1 parent b064174 commit f0bac57

3 files changed

+71
-65
lines changed

build_cpp_examples.ipynb

+69-59
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"colab_type": "text",
76
"id": "zBubcXOfW3Au"
87
},
98
"source": [
@@ -13,11 +12,9 @@
1312
},
1413
{
1514
"cell_type": "code",
16-
"execution_count": 0,
15+
"execution_count": null,
1716
"metadata": {
1817
"cellView": "both",
19-
"colab": {},
20-
"colab_type": "code",
2118
"id": "rKwqeqWBXANA"
2219
},
2320
"outputs": [],
@@ -38,23 +35,21 @@
3835
{
3936
"cell_type": "markdown",
4037
"metadata": {
41-
"colab_type": "text",
4238
"id": "dGib_ljiVqZp"
4339
},
4440
"source": [
45-
"# Build the C++ \"edgetpu\" examples for Coral\n",
41+
"# Build the libcoral C++ examples\n",
4642
"\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",
4844
"\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",
5046
"\n",
5147
"To start the build, select **Runtime \u003e Run all** in the Colab toolbar.\n"
5248
]
5349
},
5450
{
5551
"cell_type": "markdown",
5652
"metadata": {
57-
"colab_type": "text",
5853
"id": "viewin-badges"
5954
},
6055
"source": [
@@ -66,116 +61,133 @@
6661
{
6762
"cell_type": "markdown",
6863
"metadata": {
69-
"colab_type": "text",
70-
"id": "fmb_p_OkCp0J"
64+
"id": "0H4Bv2yWFyMZ"
7165
},
7266
"source": [
73-
"## Install Bazel"
67+
"## Download examples from GitHub"
7468
]
7569
},
7670
{
7771
"cell_type": "code",
78-
"execution_count": 0,
72+
"execution_count": null,
7973
"metadata": {
80-
"colab": {},
81-
"colab_type": "code",
82-
"id": "B6KvyX7hFdVB"
74+
"id": "2ZbLwr4bF655"
8375
},
8476
"outputs": [],
8577
"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"
8979
]
9080
},
9181
{
9282
"cell_type": "code",
93-
"execution_count": 0,
83+
"execution_count": null,
9484
"metadata": {
95-
"colab": {},
96-
"colab_type": "code",
97-
"id": "w9YmfWd0Fnjj"
85+
"id": "b5-XBtOHTKUq"
9886
},
9987
"outputs": [],
10088
"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"
102101
]
103102
},
104103
{
105104
"cell_type": "markdown",
106105
"metadata": {
107-
"colab_type": "text",
108-
"id": "0H4Bv2yWFyMZ"
106+
"id": "fmb_p_OkCp0J"
109107
},
110108
"source": [
111-
"## Download examples from GitHub"
109+
"## Install Bazel"
112110
]
113111
},
114112
{
115113
"cell_type": "code",
116-
"execution_count": 0,
114+
"execution_count": null,
117115
"metadata": {
118-
"colab": {},
119-
"colab_type": "code",
120-
"id": "2ZbLwr4bF655"
116+
"id": "B6KvyX7hFdVB"
121117
},
122118
"outputs": [],
123119
"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"
125134
]
126135
},
127136
{
128137
"cell_type": "markdown",
129138
"metadata": {
130-
"colab_type": "text",
131-
"id": "y_kKEIB-F8n_"
139+
"id": "WUDlTRR3lv4F"
132140
},
133141
"source": [
134-
"## Build all examples for Dev Board"
142+
"## Install dependencies to cross-compile"
135143
]
136144
},
137145
{
138146
"cell_type": "code",
139-
"execution_count": 0,
147+
"execution_count": null,
140148
"metadata": {
141-
"colab": {},
142-
"colab_type": "code",
143-
"id": "WMiVEbZReILd"
149+
"id": "xDY70hQaChPI"
144150
},
145151
"outputs": [],
146152
"source": [
147-
"! sudo apt-get install -y crossbuild-essential-armhf crossbuild-essential-arm64 bazel"
153+
"! bash docker/update_sources.sh"
148154
]
149155
},
150156
{
151157
"cell_type": "code",
152-
"execution_count": 0,
158+
"execution_count": null,
153159
"metadata": {
154-
"colab": {},
155-
"colab_type": "code",
156-
"id": "b5-XBtOHTKUq"
160+
"id": "Qv3WwZEAtNGu"
157161
},
158162
"outputs": [],
159163
"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"
161176
]
162177
},
163178
{
164179
"cell_type": "markdown",
165180
"metadata": {
166-
"colab_type": "text",
167181
"id": "adMIBqbAS0zb"
168182
},
169183
"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`."
171185
]
172186
},
173187
{
174188
"cell_type": "code",
175-
"execution_count": 0,
189+
"execution_count": null,
176190
"metadata": {
177-
"colab": {},
178-
"colab_type": "code",
179191
"id": "lG1HxB21BA8d"
180192
},
181193
"outputs": [],
@@ -186,7 +198,6 @@
186198
{
187199
"cell_type": "markdown",
188200
"metadata": {
189-
"colab_type": "text",
190201
"id": "-8zj1nAPpeQg"
191202
},
192203
"source": [
@@ -195,31 +206,30 @@
195206
},
196207
{
197208
"cell_type": "code",
198-
"execution_count": 0,
209+
"execution_count": null,
199210
"metadata": {
200-
"colab": {},
201-
"colab_type": "code",
202211
"id": "SU79MMc5rD0I"
203212
},
204213
"outputs": [],
205214
"source": [
206215
"from google.colab import files\n",
207216
"\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')"
211222
]
212223
},
213224
{
214225
"cell_type": "markdown",
215226
"metadata": {
216-
"colab_type": "text",
217227
"id": "Y_YDWKRvx8v-"
218228
},
219229
"source": [
220230
"The downloads might fail if you used **Run all**. If so, just retry by clicking **Run cell** in this last code cell.\n",
221231
"\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."
223233
]
224234
}
225235
],

retrain_classification_ptq_tf1.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,7 @@
427427
"id": "RxvgOYTDSWTx"
428428
},
429429
"source": [
430-
"## Train the model\n",
431-
"\n",
432-
"\u003c!-- TODO(markdaoust): delete steps_per_epoch in TensorFlow r1.14/r2.0 --\u003e"
430+
"## Train the model\n"
433431
]
434432
},
435433
{

retrain_classification_ptq_tf2.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,7 @@
427427
"id": "RxvgOYTDSWTx"
428428
},
429429
"source": [
430-
"## Train the model\n",
431-
"\n",
432-
"\u003c!-- TODO(markdaoust): delete steps_per_epoch in TensorFlow r1.14/r2.0 --\u003e"
430+
"## Train the model\n"
433431
]
434432
},
435433
{

0 commit comments

Comments
 (0)