Coder Social home page Coder Social logo

midea-ai / aidget Goto Github PK

View Code? Open in Web Editor NEW
150.0 15.0 32.0 9.02 MB

Ai edge toolbox,专门面向边端设备尤其是嵌入式RTOS平台,AI模型部署工具链,包括模型推理引擎和模型压缩工具

License: Apache License 2.0

Python 97.01% Shell 0.41% CMake 0.14% C++ 2.17% C 0.27%
inference inference-engine mcu pruning rtos simd tflm resrep asr wakeup

aidget's Introduction

关于

👋 Hi, I'm Aidget.

Aidget 发音 [eɪdʒɪt]
Aidget = Ai edge toolbox
Aidget = Compressor +  Inference Engine
Aidget中文名:边端AI算法部署工具链

Aidget介绍

Aidget是美的AI创新中心自研的高性能深度学习推理引擎和模型自动化压缩工具链,主要应用于linux/rtos/android/ios等不同边端系统,面向armv7/v8dsp等不同边端平台提供指令级加速;针对多计算单元设备,提供高性能异构计算能力;针对边端小内存设备,在内存管理方面做了精心的优化设计;同时,Aidget支持模型小型化、控制流子图和dynamic shape等推理高阶特性。

目前已正式运用到美的集团各事业部不同项目的AI部署业务中,成功支持了语音冰箱、空调、机器人等智能家电量产销售。

Aidget开发初衷

目前AI算法通用部署工具链无法满足生产需求:

  • 操作系统和芯片种类繁多,工程化部署难度高、人效低
  • 通用工具链无法适用于资源及其有限的家电和IoT设备
  • 通用工具链对语音算法支持较弱

AI算法部署的痛点:

  • 工程与算法脱节
  • 在资源极低的家电设备上,性能无法保证
  • 操作系统和芯片种类繁多,重复工作量大
  • 大量需求与语音相关

Aidget核心设计理念:

  • a 模型压缩自动化

    • 保证易用性
    • 提升压缩率
  • b 边端高性能

    • 解决低资源瓶颈
    • 缩短部署周期

整体特点

  • 轻量级部署
    • 推理框架主体代码无任何第三方库依赖;
    • 可根据模型实际使用的算子进行定制化裁剪,缩小库体积;
    • 统一c++算子注册接口,可方便地部署到包括移动设备和嵌入式设备等各种边缘设备上;
    • 支持模型FP16和INT8量化,进一步减少50%-75%的模型体积。
  • 通用性强
    • 支持onnx和tflite两种主流的模型文件格式;
    • 算子支持列表丰富,支持158个onnx算子,支持79个tflite算子;
    • 支持多输入/多输出、支持任意维度的输入输出、支持dynamic shape、支持带控制流的模型;
    • 支持linux/rtos/android/ios。
  • 易用性强
    • api接口简单易用,所需的public头文件也非常精简;
    • 同时提供了c++ api接口和c api接口,方便不同部署场景调用;
    • 支持cmake/makefile编译;
    • 支持定制化添加编译参数;
    • 支持不同平台libaidget.so/libaidget.a的部署;
    • 支持python x86推理验证;
    • 支持python x86后量化;
    • 支持推理数据与numpy导入/导出。
  • 高性能推理
    • 针对arm v7/v8架构,手写neon汇编kernel,充分提升cpu算子性能;
    • 针对cadence dsp架构,通过优化dsp汇编算子,充分发挥dsp的算力;
    • 广泛使用winograd卷积算法提升卷积性能,并取得了不错的加速效果;
    • 针对不同cpu架构实现了不同分块大小的矩阵乘法,显著提升了matmul、lstm等算子性能;
    • 支持int8/fp16量化模型的推理部署,针对arm v8.2架构扩展指令集进行了适配,取得了更好的加速效果。

架构设计

aidget推理框架分为模型转换converter和推理引擎runtime两部分

  • 模型转换
    • aidget_converter:由parser和optimizer两部分组成,前者负责解析onnx和tflite模型,把训练框架算子转换成aidget算子格式,后者负责图优化,通过算子融合、冗余算子消除、算子替换、布局调整等方式优化图,一般离线运行;
  • 推理引擎
    • aidget推理引擎的输入是一个二进制模型文件,推理时首先加载模型,然后经过预处理把模型从抽象的图转换为具体的算子和张量连接的描述形式,然后再通过内存复用逻辑和执行调度逻辑,把模型中的每一个算子下发到后端设备上进行算子kernel。

致谢

Aidget借鉴与参考了如下项目:

联系我们

email: [email protected]

aidget's People

Contributors

aidget avatar zhao-dongyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aidget's Issues

yolov7_ResRep训练后剪枝报错

我使用YOLOv7剪枝时遇到如下报错,具体位置在yolo.py中class Detect的forward函数里,这块是yolo原本就有的,各位大佬我该如何解决这个问题完成剪枝呢
Aidget\compressor\examples\pruning\YOLOv7\models\yolo.py:52: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if self.grid[i].shape[2:4] != x[i].shape[2:4]:

关于scratch from zero prune_training的疑惑

又继续学习Aidget模型压缩了

看了下剪枝的Markdown文件中给出的运行prune_training.py命令参数--weights '',意思是从零训练吧。

上次走通剪枝+蒸馏baseline是用的yolov7官方预训练模型进行剪枝训练,今天想按照Markdown里的weights ''命令参数从0剪枝训练发现会报错。

原因是prune_training.py line125加载了不存在的opt.weights路径,我把这行注释了反正是可以正常训练了也不知道对不对
model = torch.load(opt.weights, map_location=device)['model'].float().cuda()
ResRep_object = ResRep(copy.deepcopy(model))        
model = ResRep_object.wrapped_model

还有就是我自己是single_gpu剪枝训练的,代码save的是EMA model,EMA策略会不会使剪枝失效啊?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.