|author||Dmitry Kovalev <email@example.com>||Wed May 05 22:27:26 2021 -0700|
|committer||Dmitry Kovalev <firstname.lastname@example.org>||Wed May 05 22:27:26 2021 -0700|
Source code cleanup + README update Change-Id: I4874f60bbd6ccf5c7878b44152ceabf0095f621c
Currently, this demo is verified to work only on Linux and macOS.
Clone this repo with submodules:
git clone --recurse-submodules https://github.com/google-coral/webcoral
.tflite model files to
Build WASM files inside a Docker container:
DOCKER_SHELL_COMMAND="make COMPILATION_MODE=opt wasm" make docker-shell
Run local web server using python:
Server is listening on port
On macOS, you don't need to install anything else.
On Linux, you need to install device rules to make the Coral USB Accelerator visible in Chrome. You probably already have them installed if you are using Coral products. If not, this repo has a bash script to install the device rules:
and corresponding uninstall command if needed:
To use the USB Accelerator from the web browser, you need to update the USB Accelerator's firmware as follows. The firmware is usually automatically flashed by libedgetpu library when using C++ or Python programs, but that’s not the case from the browser.
If you run
lsusb command right after plugging USB device in, you'll see:
Bus 001 Device 008: ID 1a6e:089a Global Unichip Corp.
This means firmware is not flashed yet. It is possible to flash firmware directly from Chrome or using command line.
To flash firmware from command line:
To flash from Chrome browser, point it to http://localhost:8000/ and press
Flash Device Firmware button. WARNING: this only works on Linux now. There is an issue on macOS. It is already fixed and the fix will be available in Chrome 91.
Either way, you should now verify it's flashed by again running
lsusb and you should see:
Bus 001 Device 009: ID 18d1:9302 Google Inc.
which means that device is ready to use.
Open Chrome at http://localhost:8000/. Choose the model you want to run and press the Initialize Interpreter button. Selecting an Edge TPU model then requires you to select the USB Accelerator in the dialog; selecting a CPU model will be ready immediately. At this moment, you can run inference on any local image file by pressing the Choose Image File button.