小米开源框架MACE 创建模型部署文件
转载自https://www.jianshu.com/p/823f7d7eaf58
文章内容翻译自 MACE 官方手册,记录本人阅读与开发过程,力求不失原意,但推荐阅读原文。
https://media.readthedocs.org/pdf/mace/latest/mace.pdf
Github地址:https://github.com/xiaomi/mace
声明:如有侵权,请联系作者删除
创建模型部署文件
部署 MACE 模型的第一步是创建一个 YAML 模型部署文件。
文件描述了模型的部署情况,每个文件会生成一个静态库(如果指定了多个ABI类型,则每一个均会生成对应的静态库)。部署文件可以包含一个或多个模型,例如,一个智能相机应用可能包含人脸识别、物体识别、语音识别模型,这些都可以定义在一个部署文件中。
范例
下面是一个 Android 演示程序的部署文件例子。
# The name of library
library_name: mobilenet
target_abis: [arm64-v8a]
embed_model_data: 1
# The build mode for model(s).
# 'code' stand for transfer model(s) into cpp code, 'proto' for model(s) in protobuf file(s).
build_type: code
linkshared: 0
# One yaml config file can contain multi models' config message.
models:mobilenet_v1: # model tag, which will be used in model loading and must be specific.platform: tensorflow# support local path, http:// and https://model_file_path: https://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v1/mobilenet-v1-1.0.pbmodel_sha256_checksum: 71b10f540ece33c49a7b51f5d4095fc9bd78ce46ebf0300487b2ee23d71294e6subgraphs:- input_tensors: inputinput_shapes: 1,224,224,3output_tensors: MobilenetV1/Predictions/Reshape_1output_shapes: 1,1001runtime: cpu+gpulimit_opencl_kernel_time: 0nnlib_graph_mode: 0obfuscate: 0winograd: 0mobilenet_v2:platform: tensorflowmodel_file_path: https://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v2/mobilenet-v2-1.0.pbmodel_sha256_checksum: 369f9a5f38f3c15b4311c1c84c032ce868da9f371b5f78c13d3ea3c537389bb4subgraphs:- input_tensors: inputinput_shapes: 1,224,224,3output_tensors: MobilenetV2/Predictions/Reshape_1output_shapes: 1,1001runtime: cpu+gpulimit_opencl_kernel_time: 0nnlib_graph_mode: 0obfuscate: 0winograd: 0
配置
library_name | library name. |
---|---|
target_abis | The target ABI to build, can be one or more of 'host', 'armeabi-v7a' or 'arm64-v8a'. |
target_socs | [optional] build for specified socs if you just want use the model for that socs. |
embed_model_data | Whether embedding model weights as the code, default to 0. |
build_type | model build type, can be ['proto', 'code']. 'proto' for converting model to ProtoBuf file and 'code' for converting model to c++ code. |
linkshared | [optional] Use dynamic linking for libmace library when setting to 1, or static linking when setting to 0, default to 0. |
model_name | model name. should be unique if there are multiple models. LIMIT: if build_type is code, model_name will used in c++ code so that model_name must fulfill c++ name specification. |
platform | The source framework, one of [tensorflow, caffe]. |
model_file_path | The path of the model file, can be local or remote. |
model_sha256_checksum | The SHA256 checksum of the model file. |
weight_file_path | [optional] The path of the model weights file, used by Caffe model. |
weight_sha256_checksum | [optional] The SHA256 checksum of the weight file, used by Caffe model. |
subgraphs | subgraphs key. ** DO NOT EDIT ** |
input_tensors | The input tensor names (tensorflow), top name of inputs' layer (caffe). one or more strings. |
output_tensors | The output tensor names (tensorflow), top name of outputs' layer (caffe). one or more strings. |
input_shapes | The shapes of the input tensors, in NHWC order. |
output_shapes | The shapes of the output tensors, in NHWC order. |
input_ranges | The numerical range of the input tensors, default [-1, 1]. It is only for test. |
validation_inputs_data | [optional] Specify Numpy validation inputs. When not provided, [-1, 1] random values will be used. |
runtime | The running device, one of [cpu, gpu, dsp, cpu_gpu]. cpu_gpu contains cpu and gpu model definition so you can run the model on both cpu and gpu. |
data_type | [optional] The data type used for specified runtime. [fp16_fp32, fp32_fp32] for gpu, default is fp16_fp32. [fp32] for cpu. [uint8] for dsp. |
limit_opencl_kernel_time | [optional] Whether splitting the OpenCL kernel within 1 ms to keep UI responsiveness, default to 0. |
nnlib_graph_mode | [optional] Control the DSP precision and performance, default to 0 usually works for most cases. |
obfuscate | [optional] Whether to obfuscate the model operator name, default to 0. |
winograd | [optional] Whether to enable Winograd convolution, will increase memory consumption. |
小米开源框架MACE 创建模型部署文件相关推荐
- 小米开源框架MACE 源码阅读笔记 1
转载自 https://www.jianshu.com/p/7061fd67d419 前扯 在前不久的某高峰论坛上,小米开源了其移动端的深度学习框架Mobile AI Compute Engine(M ...
- 小米开源框架MACE 源码阅读笔记
转载自 https://www.jianshu.com/p/7061fd67d419 前扯 在前不久的某高峰论坛上,小米开源了其移动端的深度学习框架Mobile AI Compute Engine(M ...
- 小米开源框架mace android案例调试
小米开源框架mace android案例调试 1. 准备工作 编译环境准备:请参照小米官方的文档: https://mace.readthedocs.io/en/latest/installation ...
- 小米开源框架MACE - 源码阅读笔记一
首先先一目了然看一下其目录结构(这些个源码可以在github上下载到,只要在GitHub搜索mace即可): 介绍 MACE(Mobile AI Compute Engine)是一个针对移动异构计算平 ...
- 小米开源框架MACE 如何构建和使用
转载自https://www.jianshu.com/p/3be518027ac2 文章内容翻译自 MACE 官方手册,记录本人阅读与开发过程,力求不失原意,但推荐阅读原文. https://medi ...
- 小米开源框架MACE 简介
转载自 https://www.jianshu.com/p/2ab68779d05b 前言 MACE 是小米公司自研的移动端深度学习框架 Mobile AI Compute Engine,2017年1 ...
- 开源的跨平台AI模型部署总有一款是你的菜
导读 Mediapipe是Google开源的一个跨平台模型部署项目 除此之外,Mediapipe还提供了大量的开源模型 我们能够很方便的使用MediaPipe将模型部署在Android.IOS.Des ...
- python支持向量机框架_Netflix 内部 Python 框架 Metaflow 正式开源,可加速机器学习模型部署...
近日,美国视频流媒体平台及视频出版制作公司 Netflix 网飞的数据科学团队宣布正式开源其 Python 库 Metaflow,以帮助更多数据科学家与工程师构建.管理相关的数据科学项目. Metaf ...
- 小米开源监控系统监控mysql_小米开源监控 Open-Falcon 3.0 部署
一.系统环境准备 目前我这里使用单机版进行部署,也可以前后端进行分离,前端,后端,数据库分别在不同的服务器上进行部署搭建 1.更改主机名 [root@localhost ~]# hostnamectl ...
最新文章
- Linux修改终端显示前缀及环境变量
- python编程需要安装什么软件_[零基础学pythyon]安装python编程环境
- 持续集成工具jenkins的部署--Windows篇
- 测试回收站2测试回收站2测试回收站2测试回收站2测试回收站2测试回收站2测试回收站2测试回收站2测试回收站2测试回收站2测试回收站2
- 如何对mysql做物理备份_如何创建物理MySQL备份
- java 关键字 sizeof_Java 基本数据类型 sizeof 功能
- SharePoint如何模拟用户
- 升级换代!Facebook全新电商搜索系统Que2Search
- git cherry pick用法
- Visual Studio启动、附加进程调试,多个Web Application时启动多个WebServer关闭方法
- linux运行bak,linux 备份学习
- Lingo基本使用方法
- Android Fingerprint完全解析(三) :Fingerprint Hal层分析
- C. Not Adjacent Matrix
- Windows语言栏不见了,解决办法。任务栏的语言栏没了、不显示了。语言栏异常导致不能输入中文。默认中文输入法设置。
- 11G rac修改监听端口
- OPENWRT 修改串口(ttyS*)笔记
- 经典C语言算法题之快乐数
- 数仓开发之DWD层(一)
- WmiPrvSE.exe 长时间占用CPU
热门文章
- 8255A红绿灯c语言程序,51单片机外接8255A做成的交通灯程序及PROTEUS仿真结果(附对应C语言程序).doc...
- join on后面 加条件 与 where后面加条件的区别
- 怎么样用Windows创建虚拟磁盘
- 在任务计划时无法设置账户信息的解决方法
- 全网最全linux Csa 文件创建,删除的方法,教你五分钟掌握干货
- mysql超类_在MySQL Workbench图中表示超类/子类(或超类型...
- 最近苹果开发者支持电话更换了,再也不需要自己给苹果打电话了
- 【win10】查看笔记本电池使用情况
- 求大神相助,慧荣3271AD量产问题,气死中。
- 【Cocos2d-x】模仿热血传奇开门动画