nncase/docs/readme_ZH.md

9.4 KiB
Raw Permalink Blame History

nncase

GitHub repository Gitee repository GitHub release

Switch to English

nncase 是一个为 AI 加速器设计的神经网络编译器。 技术交流 QQ 群790699378 答案:人工智能 Telegram: nncase community

[TOC]


K230

安装

  • Linux

    pip install nncase nncase-kpu
    
  • Windows:

    1. pip install nncase
    2. 在下面release链接中下载`nncase_kpu-2.x.x-py2.py3-none-win_amd64.whl`
    3. pip install nncase_kpu-2.x.x-py2.py3-none-win_amd64.whl
    

已经发布Python包见Release页面。

支持的算子

benchmark test

kind model shape quant_type(If/W) nncase_fps tflite_onnx_result accuracy info
Image Classification mobilenetv2 [1,224,224,3] u8/u8 600.24 top-1 = 71.3%
top-5 = 90.1%
top-1 = 71.1%
top-5 = 90.0%
dataset(ImageNet 2012, 50000 images)
tflite
resnet50V2 [1,3,224,224] u8/u8 86.17 top-1 = 75.44%
top-5 = 92.56%
top-1 = 75.11%
top-5 = 92.36%
dataset(ImageNet 2012, 50000 images)
onnx
yolov8s_cls [1,3,224,224] u8/u8 130.497 top-1 = 72.2%
top-5 = 90.9%
top-1 = 72.2%
top-5 = 90.8%
dataset(ImageNet 2012, 50000 images)
yolov8s_cls(v8.0.207)
Object Detection yolov5s_det [1,3,640,640] u8/u8 23.645 bbox
mAP50-90 = 0.374
mAP50 = 0.567
bbox
mAP50-90 = 0.369
mAP50 = 0.566
dataset(coco val2017, 5000 images)
yolov5s_det(v7.0 tag, rect=False, conf=0.001, iou=0.65)
yolov8s_det [1,3,640,640] u8/u8 9.373 bbox
mAP50-90 = 0.446
mAP50 = 0.612
mAP75 = 0.484
bbox
mAP50-90 = 0.404
mAP50 = 0.593
mAP75 = 0.45
dataset(coco val2017, 5000 images)
yolov8s_det(v8.0.207, rect = False)
Image Segmentation yolov8s_seg [1,3,640,640] u8/u8 7.845 bbox
mAP50-90 = 0.444
mAP50 = 0.606
mAP75 = 0.484
segm
mAP50-90 = 0.371
mAP50 = 0.578
mAP75 = 0.396
bbox
mAP50-90 = 0.444
mAP50 = 0.606
mAP75 = 0.484
segm
mAP50-90 = 0.371
mAP50 = 0.579
mAP75 = 0.397
dataset(coco val2017, 5000 images)
yolov8s_seg(v8.0.207, rect = False, conf_thres = 0.0008)
Pose Estimation yolov8n_pose_320 [1,3,320,320] u8/u8 36.066 bbox
mAP50-90 = 0.6
mAP50 = 0.843
mAP75 = 0.654
keypoints
mAP50-90 = 0.358
mAP50 = 0.646
mAP75 = 0.353
bbox
mAP50-90 = 0.6
mAP50 = 0.841
mAP75 = 0.656
keypoints
mAP50-90 = 0.359
mAP50 = 0.648
mAP75 = 0.357
dataset(coco val2017, 2346 images)
yolov8n_pose(v8.0.207, rect = False)
yolov8n_pose_640 [1,3,640,640] u8/u8 10.88 bbox
mAP50-90 = 0.694
mAP50 = 0.909
mAP75 = 0.776
keypoints
mAP50-90 = 0.509
mAP50 = 0.798
mAP75 = 0.544
bbox
mAP50-90 = 0.694
mAP50 = 0.909
mAP75 = 0.777
keypoints
mAP50-90 = 0.508
mAP50 = 0.798
mAP75 = 0.54
dataset(coco val2017, 2346 images)
yolov8n_pose(v8.0.207, rect = False)
yolov8s_pose [1,3,640,640] u8/u8 5.568 bbox
mAP50-90 = 0.733
mAP50 = 0.925
mAP75 = 0.818
keypoints
mAP50-90 = 0.605
mAP50 = 0.857
mAP75 = 0.666
bbox
mAP50-90 = 0.734
mAP50 = 0.925
mAP75 = 0.819
keypoints
mAP50-90 = 0.604
mAP50 = 0.859
mAP75 = 0.669
dataset(coco val2017, 2346 images)
yolov8s_pose(v8.0.207, rect = False)

Demo示例

eye gaze space_resize face pose
gif gif

K210/K510

支持的算子


特性

  • 支持多输入输出网络,支持多分支结构
  • 静态内存分配,不需要堆内存
  • 算子合并和优化
  • 支持 float 和量化 uint8 推理
  • 支持训练后量化,使用浮点模型和量化校准集
  • 平坦模型,支持零拷贝加载

架构

nncase arch

源码编译

推荐直接通过pip安装nncase来使用目前K510、K230芯片相关的源码并未开源因此无法直接通过编译源码来使用nncase-k510nncase-kpu(K230)。

如果你的模型中存在nncase尚未支持的算子可以在issue中提出需求或者自己实现并提交PR。后续版本将会进行集成或者联系我们提供临时版本。 以下为编译 nncase 的步骤

git clone https://github.com/kendryte/nncase.git
cd nncase
mkdir build && cd build

# 使用Ninja编译
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
ninja && ninja install

# 使用make编译
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
make && make install

资源

嘉楠开发者社区

嘉楠开发者社区中包含所有K210、K510、K230相关的资源包括

  • 资料下载 --> 三款芯片对应的开发板可使用的预编译镜像。
  • 文档 --> 三款芯片及不同版本对应的文档。
  • 模型库 --> K210、K230上可运行的应用于工业、安防、教育等场景的示例以及代码。
  • 模型训练 --> 针对K210、K230的模型训练平台支持多种场景的训练。

Bilibili

K210相关仓库

K230相关仓库