Edge TPU can be used on Mac and Windows as well as Raspberry Pi, but it seems that it can be compiled only on Debian-based Linux, so I made it possible to compile using Docker so that it can also be compiled on Mac and Windows.
Create the following as a Dockerfile
FROM debian:buster-slim
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list \
&& apt-get update \
&& apt-get install edgetpu-compiler \
WORKDIR /home/edgetpu-compiler
ENTRYPOINT ["edgetpu_compiler"]
Docker build Build the created Dockerfile with the following command
docker image build -t edgetpu-compiler .
Create a directory in the same directory as dockerfile
mkdir model
Store the tflite quantized with INT8 in the model directory.
Compile the tflite model quantized with INT8 into a model for Edeg TPU with the following command
docker run --rm -it -v $(pwd):/home/edgetpu-compiler edgetpu-compiler model/{MODEL}
For the {MODEL}
part, specify the tflite quantized by INT8 prepared earlier. If files like {MODEL} _edgetpu.log and {MODEL} _edgetpu.tflite are created, you should have successfully compiled.
Even if you don't have a Linux environment, you can easily compile it into a model for EdgeTPU on Mac or Windows and infer it with EdgeTPU.
This article was written with reference to the following information. -Use Edge TPU compiler on Docker container
Recommended Posts