在实际移动设备上基准机器学习模型速度的工具
edgebenchmark的Python项目详细描述
边缘基准
在实际设备上测量机器学习模型的速度!在
安装
pip install edgebenchmark
首次使用
在使用边缘基准测试之前,请在http://52.231.69.96/app/#/register注册并在profile部分生成您的秘密令牌。在
然后,运行以下命令
^{pr2}$当您看到如下提示时,请插入您的秘密令牌。在
Edge Benchmark Token [None]:
您的秘密令牌保存在~/.edgebenchmark/token
。在
边缘基准使用
边缘基准测试可以直接从命令行使用edgebenchmark
命令,也可以从Python脚本中使用。在
Edge Benchmark CLI
edgebenchcli工具提供了几个命令:configure
、ncnn
和{
edgebenchmark --help
Usage: edgebenchmark [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit. Commands: configure ncnn tflite
configure
命令在First use部分中解释。在
tflite
命令用于测试TensorFlow-Lite模型的速度。
您可以设置许多参数来控制基准测试过程,还可以选择要进行基准测试的设备(--devices
)。
下面,您可以看到tflite
命令的所有选项。在
edgebenchmark tflite --help
Usage: edgebenchmark tflite [OPTIONS]
Options:
--features FEATURES
-d, --devices TEXT [required]
--model_path MODEL_PATH [required]
--num_threads INTEGER
--warmup_runs INTEGER
--num_runs INTEGER
--run_delay FLOAT
--use_nnapi / --no-use_nnapi
--use_legacy_nnapi / --no-use_legacy_nnapi
--use_gpu / --no-use_gpu
--help Show this message and exit.
Edge Benchmark Python包
如果您喜欢直接从Python测试机器学习模型,可以使用我们的Python包edgebenchmark
。在
from edgebenchmark import TFLiteBenchmark
benchmark = TFLiteBenchmark()
benchmark.num_threads = 2
benchmark.warmup_runs = 10
benchmark.num_runs = 13
benchmark.run_delay = 3.3
benchmark.use_nnapi = False
benchmark.use_legacy_nnapi = False
benchmark.use_gpu = False
benchmark.features = "{}"
benchmark.devices = ["SamsungGalaxyNote3"]
model_path = "model.tflite"
benchmark.run(model_path)
许可证
- 项目
标签: