本文档列出了在一些 Android 和 iOS 设备上运行常见模型时 TensorFlow Lite 的跑分。
这些跑分数据由 Android TFLite benchmark binary 及 iOS benchmark app 产生。
安卓环境的跑分
对于安卓环境的跑分,为了减少设备间的差异性,CPU 亲和性被设置为使用大核跑分。 (查看详情)
假设模型被下载并解压缩到 /data/local/tmp/tflite_models
路径。用于跑分的二进制文件
使用 这些命令构建。
此外,我们假设该文件位于 /data/local/tmp
目录。
使用以下语句运行跑分:
adb shell taskset ${CPU_MASK} /data/local/tmp/benchmark_model \
--num_threads=1 \
--graph=/data/local/tmp/tflite_models/${GRAPH} \
--warmup_runs=1 \
--num_runs=50 \
--use_nnapi=false
在这里, ${GRAPH}
是模型的名字, ${CPU_MASK}
是CPU亲和度设置。
请从下表中选择:
Device | CPU_MASK |
---|---|
Pixel 2 | f0 |
Pixel xl | 0c |
模型名称 | 设备 | 平均推理时间 |
---|---|---|
Mobilenet_1.0_224(float) | Pixel 2 | 123.3 ms |
Pixel XL | 113.3 ms | |
Mobilenet_1.0_224 (quant) | Pixel 2 | 65.4 ms |
Pixel XL | 74.6 ms | |
NASNet mobile | Pixel 2 | 273.8 ms |
Pixel XL | 210.8 ms | |
SqueezeNet | Pixel 2 | 234.0 ms |
Pixel XL | 158.0 ms | |
Inception_ResNet_V2 | Pixel 2 | 2846.0 ms |
Pixel XL | 1973.0 ms | |
Inception_V4 | Pixel 2 | 3180.0 ms |
Pixel XL | 2262.0 ms |
模型名称 | 设备 | 平均推理时间 |
---|---|---|
Mobilenet_1.0_224(float) | iPhone 8 | 32.2 ms |
Mobilenet_1.0_224 (quant) | iPhone 8 | 24.4 ms |
NASNet mobile | iPhone 8 | 60.3 ms |
SqueezeNet | iPhone 8 | 44.3 |
Inception_ResNet_V2 | iPhone 8 | 562.4 ms |
Inception_V4 | iPhone 8 | 661.0 ms |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-06-07 UTC.
[]
[]