Skip to content
Branch: master
Find file History
pengchongjin and allenwang28 \nInternal refactor
PiperOrigin-RevId: 263877713
Latest commit f59154b Aug 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information. Add EfficientNet-EdgeTPU blog post link. Aug 6, 2019 Add eval_ckpt tool for MixNet. Jul 23, 2019 \nInternal refactor Aug 19, 2019


Blog post:

EfficientNet-EdgeTPU are a family of image classification neural network models customized for deployment on Google Edge TPU. These networks are closely related to [EfficientNets] (

EfficientNet-EdgeTPU were developed using the AutoML MNAS framework by augmenting the neural network search space with building blocks tuned to execute efficiently on the EdgeTPU neural network accelerator architecture. The neural architecture search was incentivized to discover models that achieve low parameter footprint and low latency on EdgeTpu, while simultaneously achieving high classification accuracy. This neural architecture search produced a baseline model: edgetpunet-S, which is subsequently scaled up using EfficientNet's compound scaling method to produce the M and L models.

Using Pretrained EfficientNet-EdgeTPU Checkpoints

We have provided pretrained checkpoints and float/quantized TFLite models:

A quick way to use these checkpoints is to run:

$ export MODEL=efficientnet-edgetpu-S
$ wget${MODEL}.tar.gz
$ tar zxf ${MODEL}.tar.gz
$ wget -O panda.jpg
$ wget
$ python --model_name=$MODEL --ckpt_dir=$MODEL --example_img=panda.jpg --labels_map_file=labels_map.txt --include_background_label

Note that these models were trained with label#0 marked as the background label for easier deployment. TFLite models can be evaluated using this tool.

Training EfficientNet-EdgeTPU on Cloud TPUs

Please refer to our tutorial:

Post-training quantization

EdgeTPUs support inference using integer quantized models only. We found that using the Tensorflow Lite's post-training quantization tool works remarkably well for producing a EdgeTPU-compatible quantized model from a floating-point training checkpoint. For full integer quantization, the post-training quantization tool requires a representative dataset for calibrating the dynamic ranges of the activations.

We provide a tool that invokes the post-training quantization tool to produce quantized tensorflow-lite model:

$ export MODEL=efficientnet-edgetpu-S
$ wget${MODEL}.tar.gz
$ tar zxf ${MODEL}.tar.gz
$ python --model_name=$MODEL --ckpt_dir=$MODEL --data_dir=/path/to/representative_dataset/ --output_tflite=${MODEL}_quant.tflite

To produce a float model that bypasses the post-training quantization:

$ python --model_name=$MODEL --ckpt_dir=$MODEL --output_tflite=${MODEL}_float.tflite --quantize=False

The table below compared the accuracy of float models (on CPU) and the quantized models on EdgeTPU:

Model Imagenet top-1 accuracy (float) Imagenet top-1 accuracy (quantized)
efficientnet-edgetpu-S 77.23% 77.0 %
efficientnet-edgetpu-M 78.69 78.6 %
efficientnet-edgetpu-L 80.62 80.2%

The script can also be used to export a tensorflow saved_model from a training checkpoint:

$ python --model_name=$MODEL --ckpt_dir=/path/to/model-ckpt/ --output_saved_model_dir=/path/to/output_saved_model/ --output_tflite=${MODEL}_float.tflite --quantize=False
You can’t perform that action at this time.